1 /* Samba Unix/Linux SMB client library
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * @brief Some stuff used by reg_parse and reg_format.
19 * It might be usefull elsewehre but need some review of the interfaces.
20 * @file reg_parse_internal.h
21 * @author Gregor Beck <gb@sernet.de>
24 #ifndef __REG_PARSE_INTERNAL_H
25 #define __REG_PARSE_INTERNAL_H
31 #define USE_NATIVE_ICONV
32 #if defined USE_NATIVE_ICONV && defined HAVE_NATIVE_ICONV
33 # define smb_iconv_t iconv_t
34 # define smb_iconv(CD, IPTR, ILEN, OPTR, OLEN) \
35 iconv(CD, (char**)(IPTR), ILEN, OPTR, OLEN)
36 # define smb_iconv_open iconv_open
37 # define smb_iconv_close iconv_close
40 size_t iconvert_talloc(const void* ctx
,
42 const char* src
, size_t srclen
,
47 const char* short_name
;
48 size_t short_name_len
;
49 const char* long_name
;
53 const struct hive_info
* hive_info(const char* name
, int nlen
);
55 const char* get_charset(const char* c
);
57 bool set_iconv(smb_iconv_t
* t
, const char* to
, const char* from
);
61 * @param[in,out] ptr parse position
62 * @param[in] mem_ctx talloc context
63 * @param[out] name ptr 2 value
64 * @param[out] value ptr 2 value
65 * @return true on success
67 bool srprs_option(const char** ptr
, const void* mem_ctx
, char** name
, char** value
);
70 * Write Byte Order Mark for \p charset to file.
71 * If \c charset==NULL write BOM for \p ctype.
73 * @param[in] file file to write to
77 * @return number of bytes written, -1 on error
80 int write_bom(FILE* file
, const char* charset
, charset_t ctype
);
83 * Parse Byte Order Mark.
85 * @param[in,out] ptr parse position
86 * @param[out] name name of characterset
87 * @param[out] ctype charset_t
89 * @return true if found
92 bool srprs_bom(const char** ptr
, const char** name
, charset_t
* ctype
);
100 int cbuf_puts_case(struct cbuf
* s
, const char* str
, size_t len
, enum fmt_case fmt
);
102 #endif /* __REG_PARSE_INTERNAL_H */