libsmbconf: Document smbconf_transaction_cancel().
[Samba.git] / source3 / registry / reg_parse_internal.h
blobef5916175696e0770648dfb10a995b16bedf1966
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/>.
17 /**
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>
22 * @date Sep 2010
24 #ifndef __REG_PARSE_INTERNAL_H
25 #define __REG_PARSE_INTERNAL_H
27 #include "includes.h"
28 #include "system/iconv.h"
30 struct cbuf;
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
39 #endif
41 size_t iconvert_talloc(const void* ctx,
42 smb_iconv_t cd,
43 const char* src, size_t srclen,
44 char** pdst);
46 struct hive_info {
47 uint32_t handle;
48 const char* short_name;
49 size_t short_name_len;
50 const char* long_name;
51 size_t long_name_len;
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);
60 /**
61 * Parse option string
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);
70 /**
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
75 * @param[in] charset
76 * @param[in] ctype
78 * @return number of bytes written, -1 on error
79 * @todo write to cbuf
81 int write_bom(FILE* file, const char* charset, charset_t ctype);
83 /**
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
91 * @ingroup parse bom
93 bool srprs_bom(const char** ptr, const char** name, charset_t* ctype);
95 enum fmt_case {
96 FMT_CASE_PRESERVE=0,
97 FMT_CASE_UPPER,
98 FMT_CASE_LOWER,
99 FMT_CASE_TITLE
101 int cbuf_puts_case(struct cbuf* s, const char* str, size_t len, enum fmt_case fmt);
103 #endif /* __REG_PARSE_INTERNAL_H */