s3-smbd Remove manual override of DEBUGELVEL during exit
[Samba/bjacke.git] / source3 / registry / reg_parse_internal.h
blob153d48cb3185517cff7143d5445080d6c796c8d7
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"
29 struct cbuf;
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
38 #endif
40 size_t iconvert_talloc(const void* ctx,
41 smb_iconv_t cd,
42 const char* src, size_t srclen,
43 char** pdst);
45 struct hive_info {
46 uint32_t handle;
47 const char* short_name;
48 size_t short_name_len;
49 const char* long_name;
50 size_t long_name_len;
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);
59 /**
60 * Parse option string
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);
69 /**
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
74 * @param[in] charset
75 * @param[in] ctype
77 * @return number of bytes written, -1 on error
78 * @todo write to cbuf
80 int write_bom(FILE* file, const char* charset, charset_t ctype);
82 /**
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
90 * @ingroup parse bom
92 bool srprs_bom(const char** ptr, const char** name, charset_t* ctype);
94 enum fmt_case {
95 FMT_CASE_PRESERVE=0,
96 FMT_CASE_UPPER,
97 FMT_CASE_LOWER,
98 FMT_CASE_TITLE
100 int cbuf_puts_case(struct cbuf* s, const char* str, size_t len, enum fmt_case fmt);
102 #endif /* __REG_PARSE_INTERNAL_H */