2 * Samba Unix/Linux SMB client library
4 * Copyright (C) Gregor Beck 2010
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * @brief Adapter to use reg_parse with the registry api
23 * @author Gregor Beck <gb@sernet.de>
31 #include "reg_parse.h"
33 struct registry_value
;
37 * Protoype for function called to open a key.
40 * @param[in] parent the parent of the key to open, may be NULL
41 * @param[in] name the name of the key relative to parent.
42 * @param[out] key the opened key
44 * @return WERR_OK on success
46 typedef WERROR (*reg_import_callback_openkey_t
) (void* private_data
,
52 * Protoype for function called to close a key.
55 * @param key the key to close
57 * @return WERR_OK on success
59 typedef WERROR (*reg_import_callback_closekey_t
) (void* private_data
,
63 * Protoype for function called to create (or open an existing) key.
66 * @param[in] parent the parent of the key to create, may be NULL
67 * @param[in] name the name of the key relative to parent.
68 * @param[out] key the opened key
69 * @param[out] existing whether we opened an existing key
71 * @return WERR_OK on success
73 typedef WERROR (*reg_import_callback_createkey_t
)(void* private_data
,
80 * Protoype for function called to delete a key.
83 * @param parent the parent of the key to delete, may be NULL
84 * @param[in] name the name of the key relative to parent.
86 * @return WERR_OK on success
88 typedef WERROR (*reg_import_callback_deletekey_t
)(void* private_data
,
93 * Protoype for function called to delete a value.
96 * @param parent the key of the value to delete
97 * @param[in] name the name of the value to delete.
99 * @return WERR_OK on success
101 typedef WERROR (*reg_import_callback_deleteval_t
)(void* private_data
,
106 * Protoype for function called to set a value.
108 * @param private_data
109 * @param parent the key of the value to set
110 * @param name the name of the value
111 * @param type the type of the value
112 * @param data the value of the value
113 * @param size the number of bytes of data
115 * @return WERR_OK on success
117 typedef WERROR (*reg_import_callback_setval_blob_t
)(void* private_data
,
125 * Protoype for function called to set a value given as struct registry_value.
127 * @param private_data
128 * @param parent the key of the value to set
129 * @param name the name of the value
130 * @param val the value of the value
132 * @return WERR_OK on success
134 typedef WERROR (*reg_import_callback_setval_registry_value_t
) (
138 const struct registry_value
* val
);
141 * Protoype for function called to set a value given as struct struct regval_blob.
143 * @param private_data
144 * @param parent the key of the value to set
145 * @param val the value
147 * @return WERR_OK on success
149 typedef WERROR (*reg_import_callback_setval_regval_blob_t
)(
152 const struct regval_blob
* val
);
155 * Type handling the output of a reg_import object.
156 * It containes the functions to call and an opaque data pointer.
158 struct reg_import_callback
{
159 /** Function called to open key */
160 reg_import_callback_openkey_t openkey
;
161 /** Function called to close key */
162 reg_import_callback_closekey_t closekey
;
163 /** Function called to create or open key */
164 reg_import_callback_createkey_t createkey
;
165 /** Function called to delete key */
166 reg_import_callback_deletekey_t deletekey
;
167 /** Function called to delete value */
168 reg_import_callback_deleteval_t deleteval
;
170 /** Function called to set value */
172 reg_import_callback_setval_blob_t blob
;
173 reg_import_callback_setval_registry_value_t registry_value
;
174 reg_import_callback_setval_regval_blob_t regval_blob
;
176 /** Which function is called to set a value */
178 NONE
=0, /**< no setval function used */
179 BLOB
, /**< @ref reg_import_callback_setval_blob_t blob */
180 REGISTRY_VALUE
, /**< @ref reg_import_callback_setval_registry_value_t registry_value */
181 REGVAL_BLOB
, /**< @ref reg_import_callback_setval_regval_blob_t regval_blob */
183 void* data
; /**< Private data passed to callback function */
188 * Create a new reg_import object.
189 * Because its only purpose is to act as an reg_parse_callback the return type
192 * @param talloc_ctx the talloc parent
193 * @param cb the output handler
195 * @return a talloc'ed reg_import object, NULL on error
197 struct reg_parse_callback
* reg_import_adapter(TALLOC_CTX
*talloc_ctx
,
198 struct reg_import_callback cb
);