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
);
100 * Get a file descriptor on which to poll. confdb_handle_t is NOT a
101 * file descriptor and may not be used directly.
103 confdb_error_t
confdb_fd_get (
104 confdb_handle_t handle
,
108 * Dispatch configuration changes
110 confdb_error_t
confdb_dispatch (
111 confdb_handle_t handle
,
112 confdb_dispatch_t dispatch_types
);
116 * Change notification
118 confdb_error_t
confdb_track_changes (
119 confdb_handle_t handle
,
120 unsigned int object_handle
,
123 confdb_error_t
confdb_stop_track_changes (
124 confdb_handle_t handle
);
129 confdb_error_t
confdb_object_create (
130 confdb_handle_t handle
,
131 unsigned int parent_object_handle
,
134 unsigned int *object_handle
);
136 confdb_error_t
confdb_object_destroy (
137 confdb_handle_t handle
,
138 unsigned int object_handle
);
140 confdb_error_t
confdb_object_parent_get (
141 confdb_handle_t handle
,
142 unsigned int object_handle
,
143 unsigned int *parent_object_handle
);
148 confdb_error_t
confdb_key_create (
149 confdb_handle_t handle
,
150 unsigned int parent_object_handle
,
156 confdb_error_t
confdb_key_delete (
157 confdb_handle_t handle
,
158 unsigned int parent_object_handle
,
167 confdb_error_t
confdb_key_get (
168 confdb_handle_t handle
,
169 unsigned int parent_object_handle
,
175 confdb_error_t
confdb_key_replace (
176 confdb_handle_t handle
,
177 unsigned int parent_object_handle
,
187 * "find" loops through all objects of a given name and is also
188 * a quick way of finding a specific object,
189 * "iter" returns ech object in sequence.
191 confdb_error_t
confdb_object_find_start (
192 confdb_handle_t handle
,
193 unsigned int parent_object_handle
);
195 confdb_error_t
confdb_object_find (
196 confdb_handle_t handle
,
197 unsigned int parent_object_handle
,
200 unsigned int *object_handle
);
202 confdb_error_t
confdb_object_iter_start (
203 confdb_handle_t handle
,
204 unsigned int parent_object_handle
);
206 confdb_error_t
confdb_object_iter (
207 confdb_handle_t handle
,
208 unsigned int parent_object_handle
,
209 unsigned int *object_handle
,
211 int *object_name_len
);
216 confdb_error_t
confdb_key_iter_start (
217 confdb_handle_t handle
,
218 unsigned int object_handle
);
220 confdb_error_t
confdb_key_iter (
221 confdb_handle_t handle
,
222 unsigned int parent_object_handle
,
229 #endif /* OPENAIS_CONFDB_H_DEFINED */