2 * Copyright (c) 2008 Red Hat, Inc.
6 * Author: Christine Caulfield (ccaulfi@redhat.com)
8 * This software licensed under BSD license, the text of which follows:
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
13 * - Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * - Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * - Neither the name of the MontaVista Software, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived from this
20 * software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32 * THE POSSIBILITY OF SUCH DAMAGE.
34 #ifndef OPENAIS_CONFDB_H_DEFINED
35 #define OPENAIS_CONFDB_H_DEFINED
38 * @addtogroup confdb_openais
42 typedef uint64_t confdb_handle_t
;
44 #define OBJECT_PARENT_HANDLE 0
49 CONFDB_DISPATCH_BLOCKING
54 CONFDB_ERR_LIBRARY
= 2,
55 CONFDB_ERR_TIMEOUT
= 5,
56 CONFDB_ERR_TRY_AGAIN
= 6,
57 CONFDB_ERR_INVALID_PARAM
= 7,
58 CONFDB_ERR_NO_MEMORY
= 8,
59 CONFDB_ERR_BAD_HANDLE
= 9,
60 CONFDB_ERR_ACCESS
= 11,
61 CONFDB_ERR_NOT_EXIST
= 12,
62 CONFDB_ERR_EXIST
= 14,
63 CONFDB_ERR_CONTEXT_NOT_FOUND
= 17,
64 CONFDB_ERR_NOT_SUPPORTED
= 20,
65 CONFDB_ERR_SECURITY
= 29,
69 typedef void (*confdb_change_notify_fn_t
) (
70 confdb_handle_t handle
,
71 unsigned int parent_object_handle
,
72 unsigned int object_handle
,
81 confdb_change_notify_fn_t confdb_change_notify_fn
;
87 * Create a new confdb connection
89 confdb_error_t
confdb_initialize (
90 confdb_handle_t
*handle
,
91 confdb_callbacks_t
*callbacks
);
94 * Close the confdb handle
96 confdb_error_t
confdb_finalize (
97 confdb_handle_t handle
);
101 * Write back the configuration
103 confdb_error_t
confdb_write (
104 confdb_handle_t handle
,
108 * Get a file descriptor on which to poll. confdb_handle_t is NOT a
109 * file descriptor and may not be used directly.
111 confdb_error_t
confdb_fd_get (
112 confdb_handle_t handle
,
116 * Dispatch configuration changes
118 confdb_error_t
confdb_dispatch (
119 confdb_handle_t handle
,
120 confdb_dispatch_t dispatch_types
);
124 * Change notification
126 confdb_error_t
confdb_track_changes (
127 confdb_handle_t handle
,
128 unsigned int object_handle
,
131 confdb_error_t
confdb_stop_track_changes (
132 confdb_handle_t handle
);
137 confdb_error_t
confdb_object_create (
138 confdb_handle_t handle
,
139 unsigned int parent_object_handle
,
142 unsigned int *object_handle
);
144 confdb_error_t
confdb_object_destroy (
145 confdb_handle_t handle
,
146 unsigned int object_handle
);
148 confdb_error_t
confdb_object_parent_get (
149 confdb_handle_t handle
,
150 unsigned int object_handle
,
151 unsigned int *parent_object_handle
);
156 confdb_error_t
confdb_key_create (
157 confdb_handle_t handle
,
158 unsigned int parent_object_handle
,
164 confdb_error_t
confdb_key_delete (
165 confdb_handle_t handle
,
166 unsigned int parent_object_handle
,
175 confdb_error_t
confdb_key_get (
176 confdb_handle_t handle
,
177 unsigned int parent_object_handle
,
183 confdb_error_t
confdb_key_replace (
184 confdb_handle_t handle
,
185 unsigned int parent_object_handle
,
195 * "find" loops through all objects of a given name and is also
196 * a quick way of finding a specific object,
197 * "iter" returns ech object in sequence.
199 confdb_error_t
confdb_object_find_start (
200 confdb_handle_t handle
,
201 unsigned int parent_object_handle
);
203 confdb_error_t
confdb_object_find (
204 confdb_handle_t handle
,
205 unsigned int parent_object_handle
,
208 unsigned int *object_handle
);
210 confdb_error_t
confdb_object_iter_start (
211 confdb_handle_t handle
,
212 unsigned int parent_object_handle
);
214 confdb_error_t
confdb_object_iter (
215 confdb_handle_t handle
,
216 unsigned int parent_object_handle
,
217 unsigned int *object_handle
,
219 int *object_name_len
);
224 confdb_error_t
confdb_key_iter_start (
225 confdb_handle_t handle
,
226 unsigned int object_handle
);
228 confdb_error_t
confdb_key_iter (
229 confdb_handle_t handle
,
230 unsigned int parent_object_handle
,
237 #endif /* OPENAIS_CONFDB_H_DEFINED */