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
28 #include "system/iconv.h"
32 #define USE_NATIVE_ICONV
33 #if defined USE_NATIVE_ICONV && defined HAVE_NATIVE_ICONV
34 # define smb_iconv_t iconv_t
35 # define smb_iconv(CD, IPTR, ILEN, OPTR, OLEN) \
36 iconv(CD, (char**)(IPTR), ILEN, OPTR, OLEN)
37 # define smb_iconv_open iconv_open
38 # define smb_iconv_close iconv_close
41 size_t iconvert_talloc(const void* ctx
,
43 const char* src
, size_t srclen
,
48 const char* short_name
;
49 size_t short_name_len
;
50 const char* long_name
;
54 const struct hive_info
* hive_info(const char* name
, int nlen
);
56 const char* get_charset(const char* c
);
58 bool set_iconv(smb_iconv_t
* t
, const char* to
, const char* from
);
62 * @param[in,out] ptr parse position
63 * @param[in] mem_ctx talloc context
64 * @param[out] name ptr 2 value
65 * @param[out] value ptr 2 value
66 * @return true on success
68 bool srprs_option(const char** ptr
, const void* mem_ctx
, char** name
, char** value
);
71 * Write Byte Order Mark for \p charset to file.
72 * If \c charset==NULL write BOM for \p ctype.
74 * @param[in] file file to write to
78 * @return number of bytes written, -1 on error
81 int write_bom(FILE* file
, const char* charset
, charset_t ctype
);
84 * Parse Byte Order Mark.
86 * @param[in,out] ptr parse position
87 * @param[out] name name of characterset
88 * @param[out] ctype charset_t
90 * @return true if found
93 bool srprs_bom(const char** ptr
, const char** name
, charset_t
* ctype
);
101 int cbuf_puts_case(struct cbuf
* s
, const char* str
, size_t len
, enum fmt_case fmt
);
103 #endif /* __REG_PARSE_INTERNAL_H */