124
125
* Returns an error if the file does not parse correctly.
127
* "filename" is valid.
130
* "cfg" is non-NULL and "*cfg" is NULL.
128
*\li "filename" is valid.
130
*\li "type" is valid.
131
*\li "cfg" is non-NULL and "*cfg" is NULL.
133
* ISC_R_SUCCESS - success
134
* ISC_R_NOMEMORY - no memory available
135
* ISC_R_INVALIDFILE - file doesn't exist or is unreadable
136
* others - file contains errors
134
* \li #ISC_R_SUCCESS - success
135
*\li #ISC_R_NOMEMORY - no memory available
136
*\li #ISC_R_INVALIDFILE - file doesn't exist or is unreadable
137
*\li others - file contains errors
140
141
cfg_parser_destroy(cfg_parser_t **pctxp);
142
143
* Destroy a configuration parser.
146
cfg_obj_isvoid(cfg_obj_t *obj);
147
cfg_obj_isvoid(const cfg_obj_t *obj);
148
149
* Return true iff 'obj' is of void type (e.g., an optional
149
150
* value not specified).
153
cfg_obj_ismap(cfg_obj_t *obj);
154
cfg_obj_ismap(const cfg_obj_t *obj);
155
156
* Return true iff 'obj' is of a map type.
159
cfg_map_get(cfg_obj_t *mapobj, const char* name, cfg_obj_t **obj);
160
cfg_map_get(const cfg_obj_t *mapobj, const char* name, const cfg_obj_t **obj);
161
162
* Extract an element from a configuration object, which
162
163
* must be of a map type.
165
* 'mapobj' points to a valid configuration object of a map type.
166
* 'name' points to a null-terminated string.
167
* 'obj' is non-NULL and '*obj' is NULL.
166
* \li 'mapobj' points to a valid configuration object of a map type.
167
* \li 'name' points to a null-terminated string.
168
* \li 'obj' is non-NULL and '*obj' is NULL.
170
* ISC_R_SUCCESS - success
171
* ISC_R_NOTFOUND - name not found in map
171
* \li #ISC_R_SUCCESS - success
172
* \li #ISC_R_NOTFOUND - name not found in map
175
cfg_map_getname(cfg_obj_t *mapobj);
176
cfg_map_getname(const cfg_obj_t *mapobj);
177
178
* Get the name of a named map object, like a server "key" clause.
180
* 'mapobj' points to a valid configuration object of a map type.
181
* \li 'mapobj' points to a valid configuration object of a map type.
183
* A pointer to a configuration object naming the map object,
184
* \li A pointer to a configuration object naming the map object,
184
185
* or NULL if the map object does not have a name.
188
cfg_obj_istuple(cfg_obj_t *obj);
189
cfg_obj_istuple(const cfg_obj_t *obj);
190
191
* Return true iff 'obj' is of a map type.
194
cfg_tuple_get(cfg_obj_t *tupleobj, const char *name);
195
cfg_tuple_get(const cfg_obj_t *tupleobj, const char *name);
196
197
* Extract an element from a configuration object, which
197
198
* must be of a tuple type.
200
* 'tupleobj' points to a valid configuration object of a tuple type.
201
* 'name' points to a null-terminated string naming one of the
202
* fields of said tuple type.
201
* \li 'tupleobj' points to a valid configuration object of a tuple type.
202
* \li 'name' points to a null-terminated string naming one of the
203
*\li fields of said tuple type.
206
cfg_obj_isuint32(cfg_obj_t *obj);
207
cfg_obj_isuint32(const cfg_obj_t *obj);
208
209
* Return true iff 'obj' is of integer type.
212
cfg_obj_asuint32(cfg_obj_t *obj);
213
cfg_obj_asuint32(const cfg_obj_t *obj);
214
215
* Returns the value of a configuration object of 32-bit integer type.
217
* 'obj' points to a valid configuration object of 32-bit integer type.
218
* \li 'obj' points to a valid configuration object of 32-bit integer type.
220
* A 32-bit unsigned integer.
221
* \li A 32-bit unsigned integer.
224
cfg_obj_isuint64(cfg_obj_t *obj);
225
cfg_obj_isuint64(const cfg_obj_t *obj);
226
227
* Return true iff 'obj' is of integer type.
230
cfg_obj_asuint64(cfg_obj_t *obj);
231
cfg_obj_asuint64(const cfg_obj_t *obj);
232
233
* Returns the value of a configuration object of 64-bit integer type.
235
* 'obj' points to a valid configuration object of 64-bit integer type.
236
* \li 'obj' points to a valid configuration object of 64-bit integer type.
238
* A 64-bit unsigned integer.
239
* \li A 64-bit unsigned integer.
242
cfg_obj_isstring(cfg_obj_t *obj);
243
cfg_obj_isstring(const cfg_obj_t *obj);
244
245
* Return true iff 'obj' is of string type.
248
cfg_obj_asstring(cfg_obj_t *obj);
249
cfg_obj_asstring(const cfg_obj_t *obj);
250
251
* Returns the value of a configuration object of a string type
251
252
* as a null-terminated string.
254
* 'obj' points to a valid configuration object of a string type.
255
* \li 'obj' points to a valid configuration object of a string type.
257
* A pointer to a null terminated string.
258
* \li A pointer to a null terminated string.
261
cfg_obj_isboolean(cfg_obj_t *obj);
262
cfg_obj_isboolean(const cfg_obj_t *obj);
263
264
* Return true iff 'obj' is of a boolean type.
267
cfg_obj_asboolean(cfg_obj_t *obj);
268
cfg_obj_asboolean(const cfg_obj_t *obj);
269
270
* Returns the value of a configuration object of a boolean type.
272
* 'obj' points to a valid configuration object of a boolean type.
273
* \li 'obj' points to a valid configuration object of a boolean type.
276
* \li A boolean value.
279
cfg_obj_issockaddr(cfg_obj_t *obj);
280
cfg_obj_issockaddr(const cfg_obj_t *obj);
281
282
* Return true iff 'obj' is a socket address.
285
cfg_obj_assockaddr(cfg_obj_t *obj);
285
const isc_sockaddr_t *
286
cfg_obj_assockaddr(const cfg_obj_t *obj);
287
288
* Returns the value of a configuration object representing a socket address.
290
* 'obj' points to a valid configuration object of a socket address type.
291
* \li 'obj' points to a valid configuration object of a socket address type.
293
* A pointer to a sockaddr. The sockaddr must be copied by the caller
294
* \li A pointer to a sockaddr. The sockaddr must be copied by the caller
298
cfg_obj_isnetprefix(cfg_obj_t *obj);
299
cfg_obj_isnetprefix(const cfg_obj_t *obj);
300
301
* Return true iff 'obj' is a network prefix.
304
cfg_obj_asnetprefix(cfg_obj_t *obj, isc_netaddr_t *netaddr,
305
cfg_obj_asnetprefix(const cfg_obj_t *obj, isc_netaddr_t *netaddr,
305
306
unsigned int *prefixlen);
307
308
* Gets the value of a configuration object representing a network
308
309
* prefix. The network address is returned through 'netaddr' and the
309
310
* prefix length in bits through 'prefixlen'.
312
* 'obj' points to a valid configuration object of network prefix type.
313
* 'netaddr' and 'prefixlen' are non-NULL.
313
* \li 'obj' points to a valid configuration object of network prefix type.
314
*\li 'netaddr' and 'prefixlen' are non-NULL.
317
cfg_obj_islist(cfg_obj_t *obj);
318
cfg_obj_islist(const cfg_obj_t *obj);
319
320
* Return true iff 'obj' is of list type.
323
cfg_list_first(cfg_obj_t *obj);
323
const cfg_listelt_t *
324
cfg_list_first(const cfg_obj_t *obj);
325
326
* Returns the first list element in a configuration object of a list type.
328
* 'obj' points to a valid configuration object of a list type or NULL.
329
* \li 'obj' points to a valid configuration object of a list type or NULL.
331
* A pointer to a cfg_listelt_t representing the first list element,
332
* \li A pointer to a cfg_listelt_t representing the first list element,
332
333
* or NULL if the list is empty or nonexistent.
336
cfg_list_next(cfg_listelt_t *elt);
336
const cfg_listelt_t *
337
cfg_list_next(const cfg_listelt_t *elt);
338
339
* Returns the next element of a list of configuration objects.
341
* 'elt' points to cfg_listelt_t obtained from cfg_list_first() or
342
* \li 'elt' points to cfg_listelt_t obtained from cfg_list_first() or
342
343
* a previous call to cfg_list_next().
345
* A pointer to a cfg_listelt_t representing the next element,
346
* \li A pointer to a cfg_listelt_t representing the next element,
346
347
* or NULL if there are no more elements.
350
cfg_listelt_value(cfg_listelt_t *elt);
351
cfg_list_length(const cfg_obj_t *obj, isc_boolean_t recurse);
353
* Returns the length of a list of configure objects. If obj is
354
* not a list, returns 0. If recurse is true, add in the length of
355
* all contained lists.
359
cfg_listelt_value(const cfg_listelt_t *elt);
352
361
* Returns the configuration object associated with cfg_listelt_t.
355
* 'elt' points to cfg_listelt_t obtained from cfg_list_first() or
364
* \li 'elt' points to cfg_listelt_t obtained from cfg_list_first() or
356
365
* cfg_list_next().
359
* A non-NULL pointer to a configuration object.
368
* \li A non-NULL pointer to a configuration object.
363
cfg_print(cfg_obj_t *obj,
372
cfg_print(const cfg_obj_t *obj,
364
373
void (*f)(void *closure, const char *text, int textlen),
367
376
* Print the configuration object 'obj' by repeatedly calling the
368
377
* function 'f', passing 'closure' and a region of text starting
369
378
* at 'text' and comprising 'textlen' characters.