cfg.h File Reference

This is the new, table-driven, YACC-free configuration file parser. More...

#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/refcount.h>
#include <isc/types.h>
#include <isc/list.h>

Go to the source code of this file.

Defines

#define ISCCFG_CFG_H   1
#define CFG_PRINTER_XKEY   0x1
#define CFG_PRINTER_ONELINE   0x2
 Print the configuration object 'obj' by repeatedly calling the function 'f', passing 'closure' and a region of text starting at 'text' and comprising 'textlen' characters.

Typedefs

typedef struct cfg_parser cfg_parser_t
 A configuration parser.
typedef struct cfg_type cfg_type_t
 A configuration type definition object. There is a single static cfg_type_t object for each data type supported by the configuration parser.
typedef struct cfg_obj cfg_obj_t
 A configuration object. This is the basic building block of the configuration parse tree. It contains a value (which may be of one of several types) and information identifying the file and line number the value came from, for printing error messages.
typedef struct cfg_listelt cfg_listelt_t
 A configuration object list element.
typedef isc_result_t(* cfg_parsecallback_t )(const char *clausename, const cfg_obj_t *obj, void *arg)
 A callback function to be called when parsing an option that needs to be interpreted at parsing time, like "directory".

Functions

ISC_LANG_BEGINDECLS void cfg_parser_attach (cfg_parser_t *src, cfg_parser_t **dest)
 Reference a parser object.
isc_result_t cfg_parser_create (isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret)
 Create a configuration file parser. Any warning and error messages will be logged to 'lctx'.
void cfg_parser_setcallback (cfg_parser_t *pctx, cfg_parsecallback_t callback, void *arg)
 Make the parser call 'callback' whenever it encounters a configuration clause with the callback attribute, passing it the clause name, the clause value, and 'arg' as arguments.
isc_result_t cfg_parse_file (cfg_parser_t *pctx, const char *filename, const cfg_type_t *type, cfg_obj_t **ret)
isc_result_t cfg_parse_buffer (cfg_parser_t *pctx, isc_buffer_t *buffer, const cfg_type_t *type, cfg_obj_t **ret)
 Read a configuration containing data of type 'type' and make '*ret' point to its parse tree.
isc_result_t cfg_parser_mapadd (cfg_parser_t *pctx, cfg_obj_t *mapobj, cfg_obj_t *obj, const char *clause)
 Add the object 'obj' to the specified clause in mapbody 'mapobj'. Used for adding new zones.
void cfg_parser_reset (cfg_parser_t *pctx)
 Reset an existing parser so it can be re-used for a new file or buffer.
void cfg_parser_destroy (cfg_parser_t **pctxp)
 Remove a reference to a configuration parser; destroy it if there are no more references.
isc_boolean_t cfg_obj_isvoid (const cfg_obj_t *obj)
 Return true iff 'obj' is of void type (e.g., an optional value not specified).
isc_boolean_t cfg_obj_ismap (const cfg_obj_t *obj)
 Return true iff 'obj' is of a map type.
isc_result_t cfg_map_get (const cfg_obj_t *mapobj, const char *name, const cfg_obj_t **obj)
 Extract an element from a configuration object, which must be of a map type.
const cfg_obj_tcfg_map_getname (const cfg_obj_t *mapobj)
 Get the name of a named map object, like a server "key" clause.
unsigned int cfg_map_count (const cfg_obj_t *mapobj)
 Get the number of elements defined in the symbol table of a map object.
isc_boolean_t cfg_obj_istuple (const cfg_obj_t *obj)
 Return true iff 'obj' is of a map type.
const cfg_obj_tcfg_tuple_get (const cfg_obj_t *tupleobj, const char *name)
 Extract an element from a configuration object, which must be of a tuple type.
isc_boolean_t cfg_obj_isuint32 (const cfg_obj_t *obj)
 Return true iff 'obj' is of integer type.
isc_uint32_t cfg_obj_asuint32 (const cfg_obj_t *obj)
 Returns the value of a configuration object of 32-bit integer type.
isc_boolean_t cfg_obj_isuint64 (const cfg_obj_t *obj)
 Return true iff 'obj' is of integer type.
isc_uint64_t cfg_obj_asuint64 (const cfg_obj_t *obj)
 Returns the value of a configuration object of 64-bit integer type.
isc_boolean_t cfg_obj_isstring (const cfg_obj_t *obj)
 Return true iff 'obj' is of string type.
const char * cfg_obj_asstring (const cfg_obj_t *obj)
 Returns the value of a configuration object of a string type as a null-terminated string.
isc_boolean_t cfg_obj_isboolean (const cfg_obj_t *obj)
 Return true iff 'obj' is of a boolean type.
isc_boolean_t cfg_obj_asboolean (const cfg_obj_t *obj)
 Returns the value of a configuration object of a boolean type.
isc_boolean_t cfg_obj_issockaddr (const cfg_obj_t *obj)
 Return true iff 'obj' is a socket address.
const isc_sockaddr_tcfg_obj_assockaddr (const cfg_obj_t *obj)
 Returns the value of a configuration object representing a socket address.
isc_dscp_t cfg_obj_getdscp (const cfg_obj_t *obj)
 Returns the DSCP value of a configuration object representing a socket address.
isc_boolean_t cfg_obj_isnetprefix (const cfg_obj_t *obj)
 Return true iff 'obj' is a network prefix.
void cfg_obj_asnetprefix (const cfg_obj_t *obj, isc_netaddr_t *netaddr, unsigned int *prefixlen)
 Gets the value of a configuration object representing a network prefix. The network address is returned through 'netaddr' and the prefix length in bits through 'prefixlen'.
isc_boolean_t cfg_obj_islist (const cfg_obj_t *obj)
 Return true iff 'obj' is of list type.
const cfg_listelt_tcfg_list_first (const cfg_obj_t *obj)
 Returns the first list element in a configuration object of a list type.
const cfg_listelt_tcfg_list_next (const cfg_listelt_t *elt)
 Returns the next element of a list of configuration objects.
unsigned int cfg_list_length (const cfg_obj_t *obj, isc_boolean_t recurse)
 Returns the length of a list of configure objects. If obj is not a list, returns 0. If recurse is true, add in the length of all contained lists.
cfg_obj_tcfg_listelt_value (const cfg_listelt_t *elt)
 Returns the configuration object associated with cfg_listelt_t.
void cfg_print (const cfg_obj_t *obj, void(*f)(void *closure, const char *text, int textlen), void *closure)
void cfg_printx (const cfg_obj_t *obj, unsigned int flags, void(*f)(void *closure, const char *text, int textlen), void *closure)
void cfg_print_grammar (const cfg_type_t *type, void(*f)(void *closure, const char *text, int textlen), void *closure)
 Print a summary of the grammar of the configuration type 'type'.
isc_boolean_t cfg_obj_istype (const cfg_obj_t *obj, const cfg_type_t *type)
 Return true iff 'obj' is of type 'type'.
void cfg_obj_attach (cfg_obj_t *src, cfg_obj_t **dest)
 Reference a configuration object.
void cfg_obj_destroy (cfg_parser_t *pctx, cfg_obj_t **obj)
 Delete a reference to a configuration object; destroy the object if there are no more references.
void cfg_obj_log (const cfg_obj_t *obj, isc_log_t *lctx, int level, const char *fmt,...) ISC_FORMAT_PRINTF(4
void const char * cfg_obj_file (const cfg_obj_t *obj)
 Log a message concerning configuration object 'obj' to the logging channel of 'pctx', at log level 'level'. The message will be prefixed with the file name(s) and line number where 'obj' was defined.
unsigned int cfg_obj_line (const cfg_obj_t *obj)
 Return the line in file where this object was defined.


Detailed Description

This is the new, table-driven, YACC-free configuration file parser.

Definition in file cfg.h.


Define Documentation

#define ISCCFG_CFG_H   1

Definition at line 21 of file cfg.h.

#define CFG_PRINTER_XKEY   0x1

Definition at line 433 of file cfg.h.

Referenced by main(), and print_sstring().

#define CFG_PRINTER_ONELINE   0x2

Print the configuration object 'obj' by repeatedly calling the function 'f', passing 'closure' and a region of text starting at 'text' and comprising 'textlen' characters.

If CFG_PRINTER_XKEY the contents of shared keys will be obscured by replacing them with question marks ('?')

Definition at line 434 of file cfg.h.

Referenced by ns_server_showzone(), nzf_append(), print_close(), print_indent(), print_list(), print_open(), and print_symval().


Typedef Documentation

typedef struct cfg_parser cfg_parser_t

A configuration parser.

Definition at line 49 of file cfg.h.

typedef struct cfg_type cfg_type_t

A configuration type definition object. There is a single static cfg_type_t object for each data type supported by the configuration parser.

Definition at line 56 of file cfg.h.

typedef struct cfg_obj cfg_obj_t

A configuration object. This is the basic building block of the configuration parse tree. It contains a value (which may be of one of several types) and information identifying the file and line number the value came from, for printing error messages.

Definition at line 65 of file cfg.h.

typedef struct cfg_listelt cfg_listelt_t

A configuration object list element.

Definition at line 70 of file cfg.h.

typedef isc_result_t(* cfg_parsecallback_t)(const char *clausename, const cfg_obj_t *obj, void *arg)

A callback function to be called when parsing an option that needs to be interpreted at parsing time, like "directory".

Definition at line 78 of file cfg.h.


Function Documentation

ISC_LANG_BEGINDECLS void cfg_parser_attach ( cfg_parser_t src,
cfg_parser_t **  dest 
)

Reference a parser object.

Definition at line 573 of file parser.c.

References isc_refcount_increment, cfg_parser::references, and REQUIRE.

Referenced by setup_newzones().

isc_result_t cfg_parser_create ( isc_mem_t mctx,
isc_log_t lctx,
cfg_parser_t **  ret 
)

Create a configuration file parser. Any warning and error messages will be logged to 'lctx'.

The parser object returned can be used for a single call to cfg_parse_file() or cfg_parse_buffer(). It must not be reused for parsing multiple files or buffers.

Definition at line 396 of file parser.c.

References cfg_parser::callback, cfg_parser::callbackarg, cfg_create_list(), CHECK, cleanup(), CLEANUP_OBJ, cfg_parser::closed_files, cfg_parser::errors, cfg_parser::flags, ISC_FALSE, isc_lex_create(), isc_lex_destroy(), isc_lex_setcomments(), isc_lex_setspecials(), ISC_LEXCOMMENT_C, ISC_LEXCOMMENT_CPLUSPLUS, ISC_LEXCOMMENT_SHELL, isc_mem_attach(), isc_mem_get, isc_mem_putanddetach, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_refcount_init(), isc_tokentype_unknown, cfg_parser::lctx, cfg_parser::lexer, cfg_parser::line, cfg_parser::mctx, cfg_parser::open_files, cfg_parser::references, REQUIRE, cfg_parser::seen_eof, cfg_parser::token, isc_token::type, cfg_parser::ungotten, and cfg_parser::warnings.

Referenced by get_rndckey(), load_configuration(), main(), parse_config(), read_confkey(), read_sessionkey(), and run_server().

void cfg_parser_setcallback ( cfg_parser_t pctx,
cfg_parsecallback_t  callback,
void *  arg 
)

Make the parser call 'callback' whenever it encounters a configuration clause with the callback attribute, passing it the clause name, the clause value, and 'arg' as arguments.

To restore the default of not invoking callbacks, pass callback==NULL and arg==NULL.

Definition at line 486 of file parser.c.

References cfg_parser::callback, and cfg_parser::callbackarg.

Referenced by load_configuration(), and main().

isc_result_t cfg_parse_file ( cfg_parser_t pctx,
const char *  filename,
const cfg_type_t type,
cfg_obj_t **  ret 
)

Definition at line 543 of file parser.c.

References CHECK, cleanup(), parse2(), parser_openfile(), and REQUIRE.

Referenced by get_rndckey(), load_configuration(), main(), parse_config(), read_confkey(), read_sessionkey(), and setup_newzones().

isc_result_t cfg_parse_buffer ( cfg_parser_t pctx,
isc_buffer_t buffer,
const cfg_type_t type,
cfg_obj_t **  ret 
)

Read a configuration containing data of type 'type' and make '*ret' point to its parse tree.

The configuration is read from the file 'filename' (isc_parse_file()) or the buffer 'buffer' (isc_parse_buffer()).

Returns an error if the file does not parse correctly.

Requires:

Returns:

Definition at line 558 of file parser.c.

References CHECK, cleanup(), isc_lex_openbuffer(), cfg_parser::lexer, parse2(), and REQUIRE.

Referenced by newzone_parse(), ns_config_parsedefaults(), and ns_lwresd_parseeresolvconf().

isc_result_t cfg_parser_mapadd ( cfg_parser_t pctx,
cfg_obj_t mapobj,
cfg_obj_t obj,
const char *  clause 
)

Add the object 'obj' to the specified clause in mapbody 'mapobj'. Used for adding new zones.

Require:

Definition at line 2652 of file parser.c.

References isc_symvalue::as_pointer, CFG_CLAUSEFLAG_MULTI, cfg_create_list(), cfg_obj_attach(), CHECK, cfg_map::clausesets, cleanup(), CLEANUP_OBJ, create_listelt(), cfg_clausedef::flags, free_listelt(), INSIST, ISC_LIST_APPEND, ISC_R_EXISTS, ISC_R_FAILURE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_symexists_reject, isc_symtab_define(), isc_symtab_lookup(), cfg_obj::list, cfg_obj::map, map, cfg_clausedef::name, cfg_listelt::obj, cfg_type::rep, REQUIRE, cfg_map::symtab, cfg_obj::type, and cfg_obj::value.

Referenced by do_addzone(), and do_modzone().

void cfg_parser_reset ( cfg_parser_t pctx  ) 

Reset an existing parser so it can be re-used for a new file or buffer.

Definition at line 495 of file parser.c.

References cfg_parser::errors, ISC_FALSE, isc_lex_close(), cfg_parser::lexer, cfg_parser::line, REQUIRE, cfg_parser::seen_eof, cfg_parser::ungotten, and cfg_parser::warnings.

Referenced by newzone_parse(), and setup_newzones().

void cfg_parser_destroy ( cfg_parser_t **  pctxp  ) 

Remove a reference to a configuration parser; destroy it if there are no more references.

Definition at line 581 of file parser.c.

References CLEANUP_OBJ, cfg_parser::closed_files, isc_lex_destroy(), isc_mem_putanddetach, isc_refcount_decrement, cfg_parser::lexer, cfg_parser::mctx, cfg_parser::open_files, and cfg_parser::references.

Referenced by get_rndckey(), load_configuration(), main(), newzone_cfgctx_destroy(), read_confkey(), read_sessionkey(), and shutdown_server().

isc_boolean_t cfg_obj_isvoid ( const cfg_obj_t obj  ) 

Return true iff 'obj' is of void type (e.g., an optional value not specified).

Definition at line 622 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by bind9_check_controlskeys(), cfg_acl_fromconfig2(), check_lockfile(), check_options(), configure_rpz(), configure_rpz_zone(), configure_session_key(), configure_view(), configure_view_nametable(), count_acl_elements(), get_key_info(), load_configuration(), ns_zone_configure(), setoptstring(), and validate_masters().

isc_boolean_t cfg_obj_ismap ( const cfg_obj_t obj  ) 

Return true iff 'obj' is of a map type.

Definition at line 1667 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

isc_result_t cfg_map_get ( const cfg_obj_t mapobj,
const char *  name,
const cfg_obj_t **  obj 
)

Extract an element from a configuration object, which must be of a map type.

Requires:

Returns:

Definition at line 1673 of file parser.c.

References isc_symvalue::as_pointer, ISC_R_SUCCESS, isc_symtab_lookup(), cfg_obj::map, map, MAP_SYM, cfg_type::rep, REQUIRE, cfg_map::symtab, cfg_obj::type, and cfg_obj::value.

Referenced by add_initial_keys(), bind9_check_controls(), bind9_check_key(), bind9_check_logging(), bind9_check_namedconf(), channel_fromconf(), check_dns64(), check_dscp(), check_dual_stack(), check_filteraaaa(), check_forward(), check_lockfile(), check_nonzero(), check_options(), check_order(), check_recursionacls(), check_servers(), check_viewconf(), check_zoneconf(), checkacl(), configure_peer(), configure_rrl(), configure_staticstub(), configure_view(), configure_view_acl(), configure_view_dnsseckeys(), configure_view_nametable(), configure_view_sortlist(), configure_zone(), configure_zone_acl(), configure_zone_ssutable(), count_zones(), create_empty_zone(), delete_zoneconf(), find_name_in_list_from_map(), get_acl_def(), get_checknames(), get_key_info(), get_maps(), get_masters_def(), get_rndckey(), load_configuration(), load_zones_fromconfig(), newzone_parse(), ns_checknames_get(), ns_config_get(), ns_config_getdscp(), ns_config_getport(), ns_controls_configure(), ns_log_configure(), ns_lwdmanager_create(), ns_lwresd_configure(), ns_statschannels_configure(), ns_tkeyctx_fromconfig(), ns_tsigkeyring_fromconfig(), ns_zone_configure(), ns_zone_reusable(), parse_config(), read_confkey(), read_sessionkey(), register_keys(), setup_newzones(), and zonetype_fromconfig().

const cfg_obj_t* cfg_map_getname ( const cfg_obj_t mapobj  ) 

Get the name of a named map object, like a server "key" clause.

Requires:

Returns:

Definition at line 1692 of file parser.c.

References cfg_map::id, cfg_obj::map, cfg_type::rep, REQUIRE, cfg_obj::type, and cfg_obj::value.

Referenced by add_initial_keys(), bind9_check_key(), bind9_check_logging(), cfgkeylist_find(), channel_fromconf(), check_dns64(), check_keylist(), check_servers(), configure_peer(), configure_view(), get_rndckey(), parse_config(), read_confkey(), read_sessionkey(), and rndckey_exists().

unsigned int cfg_map_count ( const cfg_obj_t mapobj  ) 

Get the number of elements defined in the symbol table of a map object.

Requires:

Returns:

Definition at line 1698 of file parser.c.

References isc_symtab_count(), cfg_obj::map, map, cfg_type::rep, REQUIRE, cfg_map::symtab, cfg_obj::type, and cfg_obj::value.

Referenced by check_zoneconf().

isc_boolean_t cfg_obj_istuple ( const cfg_obj_t obj  ) 

Return true iff 'obj' is of a map type.

Definition at line 314 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by cfg_acl_fromconfig2(), and count_acl_elements().

const cfg_obj_t* cfg_tuple_get ( const cfg_obj_t tupleobj,
const char *  name 
)

Extract an element from a configuration object, which must be of a tuple type.

Requires:

Definition at line 320 of file parser.c.

References INSIST, cfg_tuplefielddef::name, cfg_type::of, cfg_type::rep, REQUIRE, cfg_obj::tuple, cfg_obj::type, and cfg_obj::value.

Referenced by add_listener(), bind9_check_controls(), bind9_check_controlskeys(), bind9_check_logging(), bind9_check_namedconf(), category_fromconf(), cfg_acl_fromconfig2(), channel_fromconf(), check_dual_stack(), check_options(), check_orderent(), check_trusted_key(), check_update_policy(), check_zoneconf(), checkacl(), configure_alternates(), configure_forward(), configure_order(), configure_rpz(), configure_rpz_zone(), configure_view(), configure_view_acl(), configure_view_dnsseckeys(), configure_view_nametable(), configure_view_sortlist(), configure_zone(), configure_zone_acl(), configure_zone_ssutable(), count_acl_elements(), create_empty_zone(), delete_zoneconf(), disable_algorithms(), disable_ds_digests(), disabled_algorithms(), disabled_ds_digests(), do_modzone(), dstkey_fromconfig(), find_name_in_list_from_map(), get_acl_def(), get_checknames(), get_key_info(), get_masters_def(), get_viewinfo(), load_configuration(), load_zones_fromconfig(), mustbesecure(), newzone_parse(), ns_checknames_get(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_controls_configure(), ns_listenelt_fromconfig(), ns_log_configure(), ns_lwdmanager_create(), ns_server_changezone(), ns_server_delzone(), ns_server_showzone(), ns_statschannels_configure(), ns_tkeyctx_fromconfig(), ns_tsigkeyring_fromconfig(), ns_zone_configure(), ns_zone_reusable(), parse_config(), portset_fromconf(), setup_newzones(), update_listener(), and validate_masters().

isc_boolean_t cfg_obj_isuint32 ( const cfg_obj_t obj  ) 

Return true iff 'obj' is of integer type.

Definition at line 673 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by channel_fromconf(), check_dual_stack(), configure_alternates(), configure_forward(), configure_rpz(), configure_rpz_zone(), configure_view(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_listenelt_fromconfig(), parse_config(), and portset_fromconf().

isc_uint32_t cfg_obj_asuint32 ( const cfg_obj_t obj  ) 

Returns the value of a configuration object of 32-bit integer type.

Requires:

Returns:

Definition at line 679 of file parser.c.

References cfg_type::rep, REQUIRE, cfg_obj::type, cfg_obj::uint32, and cfg_obj::value.

Referenced by add_listener(), bind9_check_controls(), channel_fromconf(), check_dscp(), check_dual_stack(), check_nonzero(), check_options(), check_trusted_key(), check_zoneconf(), configure_alternates(), configure_forward(), configure_peer(), configure_rpz(), configure_rpz_zone(), configure_rrl(), configure_server_quota(), configure_view(), configure_zone(), dstkey_fromconfig(), load_configuration(), ns_config_getdscp(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_config_getport(), ns_listenelt_fromconfig(), ns_lwdmanager_create(), ns_tkeyctx_fromconfig(), ns_zone_configure(), parse_config(), portset_fromconf(), and update_listener().

isc_boolean_t cfg_obj_isuint64 ( const cfg_obj_t obj  ) 

Return true iff 'obj' is of integer type.

Definition at line 694 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by channel_fromconf().

isc_uint64_t cfg_obj_asuint64 ( const cfg_obj_t obj  ) 

Returns the value of a configuration object of 64-bit integer type.

Requires:

Returns:

Definition at line 700 of file parser.c.

References cfg_type::rep, REQUIRE, cfg_obj::type, cfg_obj::uint64, and cfg_obj::value.

Referenced by channel_fromconf(), configure_view(), ns_zone_configure(), and set_limit().

isc_boolean_t cfg_obj_isstring ( const cfg_obj_t obj  ) 

Return true iff 'obj' is of string type.

Definition at line 891 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by bind9_check_namedconf(), cfg_acl_fromconfig2(), channel_fromconf(), check_lockfile(), check_options(), check_orderent(), check_update_policy(), check_zoneconf(), configure_order(), configure_view(), configure_zone(), configure_zone_ssutable(), count_acl_elements(), load_configuration(), load_zones_fromconfig(), newzone_parse(), ns_config_getclass(), ns_config_getipandkeylist(), ns_config_gettype(), ns_zone_configure(), print_updatepolicy(), and set_limit().

const char* cfg_obj_asstring ( const cfg_obj_t obj  ) 

Returns the value of a configuration object of a string type as a null-terminated string.

Requires:

Returns:

Definition at line 897 of file parser.c.

References isc_textregion::base, cfg_type::rep, REQUIRE, cfg_obj::string, cfg_obj::type, and cfg_obj::value.

Referenced by add_initial_keys(), bind9_check_controls(), bind9_check_controlskeys(), bind9_check_key(), bind9_check_logging(), bind9_check_namedconf(), category_fromconf(), cfg_acl_fromconfig2(), cfg_parse_rpz_policy(), cfgkeylist_find(), channel_fromconf(), check_dual_stack(), check_keylist(), check_lockfile(), check_options(), check_orderent(), check_servers(), check_trusted_key(), check_update_policy(), check_zoneconf(), configure_alternates(), configure_forward(), configure_order(), configure_peer(), configure_rpz_zone(), configure_session_key(), configure_staticstub_servernames(), configure_view(), configure_view_dnsseckeys(), configure_view_nametable(), configure_zone(), configure_zone_ssutable(), controlkeylist_fromcfg(), convert_keyname(), convert_named_acl(), count_acl_elements(), create_empty_zone(), delete_zoneconf(), directory_callback(), disable_algorithms(), disable_ds_digests(), disabled_algorithms(), disabled_ds_digests(), dstkey_fromconfig(), fileexist(), find_name_in_list_from_map(), get_acl_def(), get_checknames(), get_masters_def(), get_rndckey(), get_viewinfo(), load_configuration(), load_zones_fromconfig(), mustbesecure(), newzone_parse(), ns_checknames_get(), ns_config_getclass(), ns_config_getipandkeylist(), ns_config_gettype(), ns_config_getzonetype(), ns_controls_configure(), ns_log_configure(), ns_lwdmanager_create(), ns_server_changezone(), ns_tkeyctx_fromconfig(), ns_zone_configure(), ns_zone_reusable(), on_disable_list(), parse_config(), read_confkey(), read_sessionkey(), register_keys(), rndckey_exists(), set_limit(), setoptstring(), and validate_masters().

isc_boolean_t cfg_obj_isboolean ( const cfg_obj_t obj  ) 

Return true iff 'obj' is of a boolean type.

Definition at line 934 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by check_filteraaaa(), check_viewconf(), check_zoneconf(), configure_view(), load_configuration(), and ns_zone_configure().

isc_boolean_t cfg_obj_asboolean ( const cfg_obj_t obj  ) 

Returns the value of a configuration object of a boolean type.

Requires:

Returns:

Definition at line 940 of file parser.c.

References cfg_obj::boolean, cfg_type::rep, REQUIRE, cfg_obj::type, and cfg_obj::value.

Referenced by channel_fromconf(), check_filteraaaa(), check_recursionacls(), check_viewconf(), check_zoneconf(), configure_peer(), configure_rpz(), configure_rpz_zone(), configure_rrl(), configure_view(), configure_zone(), load_configuration(), mustbesecure(), ns_zone_configure(), ns_zone_reusable(), and setup_newzones().

isc_boolean_t cfg_obj_issockaddr ( const cfg_obj_t obj  ) 

Return true iff 'obj' is a socket address.

Definition at line 2270 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by check_dual_stack(), configure_alternates(), ns_config_getipandkeylist(), parse_config(), and validate_masters().

const isc_sockaddr_t* cfg_obj_assockaddr ( const cfg_obj_t obj  ) 

Returns the value of a configuration object representing a socket address.

Requires:

Returns:

Definition at line 2276 of file parser.c.

References cfg_type::rep, REQUIRE, cfg_obj::sockaddr, cfg_obj::type, and cfg_obj::value.

Referenced by check_dns64(), check_zoneconf(), configure_alternates(), configure_forward(), configure_peer(), configure_staticstub_serveraddrs(), configure_view(), get_view_querysource_dispatch(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_controls_configure(), ns_statschannels_configure(), ns_zone_configure(), and parse_config().

isc_dscp_t cfg_obj_getdscp ( const cfg_obj_t obj  ) 

Returns the DSCP value of a configuration object representing a socket address.

Requires:

Returns:

Definition at line 2282 of file parser.c.

References cfg_type::rep, REQUIRE, cfg_obj::sockaddrdscp, cfg_obj::type, and cfg_obj::value.

Referenced by configure_forward(), configure_peer(), get_view_querysource_dispatch(), ns_config_getipandkeylist(), ns_config_getiplist(), and ns_zone_configure().

isc_boolean_t cfg_obj_isnetprefix ( const cfg_obj_t obj  ) 

Return true iff 'obj' is a network prefix.

Definition at line 2123 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by cfg_acl_fromconfig2().

void cfg_obj_asnetprefix ( const cfg_obj_t obj,
isc_netaddr_t netaddr,
unsigned int *  prefixlen 
)

Gets the value of a configuration object representing a network prefix. The network address is returned through 'netaddr' and the prefix length in bits through 'prefixlen'.

Requires:

Definition at line 2129 of file parser.c.

References cfg_netprefix::address, cfg_obj::netprefix, cfg_netprefix::prefixlen, cfg_type::rep, REQUIRE, cfg_obj::type, and cfg_obj::value.

Referenced by cfg_acl_fromconfig2(), check_dns64(), check_servers(), configure_peer(), and configure_view().

isc_boolean_t cfg_obj_islist ( const cfg_obj_t obj  ) 

Return true iff 'obj' is of list type.

Definition at line 1194 of file parser.c.

References ISC_TF, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by add_listener(), cfg_acl_fromconfig2(), cfg_list_length(), count_acl_elements(), delete_zoneconf(), get_checknames(), newzone_parse(), ns_checknames_get(), and update_listener().

const cfg_listelt_t* cfg_list_first ( const cfg_obj_t obj  ) 

Returns the first list element in a configuration object of a list type.

Requires:

Returns:

Definition at line 1200 of file parser.c.

References ISC_LIST_HEAD, cfg_obj::list, cfg_type::rep, REQUIRE, cfg_obj::type, and cfg_obj::value.

Referenced by add_initial_keys(), bind9_check_controls(), bind9_check_controlskeys(), bind9_check_logging(), bind9_check_namedconf(), category_fromconf(), cfg_acl_fromconfig2(), cfg_list_length(), cfgkeylist_find(), check_dns64(), check_dual_stack(), check_keylist(), check_options(), check_order(), check_servers(), check_update_policy(), check_viewconf(), check_zoneconf(), configure_alternates(), configure_forward(), configure_rpz(), configure_staticstub_serveraddrs(), configure_staticstub_servernames(), configure_view(), configure_view_nametable(), configure_zone_ssutable(), controlkeylist_fromcfg(), count_acl_elements(), count_zones(), create_empty_zone(), disable_algorithms(), disable_ds_digests(), disabled_algorithms(), disabled_ds_digests(), find_name_in_list_from_map(), get_acl_def(), get_checknames(), get_key_info(), get_masters_def(), load_configuration(), load_view_keys(), load_zones_fromconfig(), mustbesecure(), newzone_parse(), ns_checknames_get(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_config_listcount(), ns_controls_configure(), ns_listenlist_fromconfig(), ns_log_configure(), ns_lwdmanager_create(), ns_lwresd_configure(), ns_statschannels_configure(), on_disable_list(), parse_config(), portset_fromconf(), rndckey_exists(), and validate_masters().

const cfg_listelt_t* cfg_list_next ( const cfg_listelt_t elt  ) 

Returns the next element of a list of configuration objects.

Requires:

Returns:

Definition at line 1208 of file parser.c.

References ISC_LIST_NEXT, and REQUIRE.

Referenced by add_initial_keys(), bind9_check_controls(), bind9_check_controlskeys(), bind9_check_logging(), bind9_check_namedconf(), category_fromconf(), cfg_acl_fromconfig2(), cfg_list_length(), cfgkeylist_find(), check_dns64(), check_dual_stack(), check_keylist(), check_options(), check_order(), check_servers(), check_update_policy(), check_viewconf(), check_zoneconf(), configure_alternates(), configure_forward(), configure_rpz(), configure_staticstub_serveraddrs(), configure_staticstub_servernames(), configure_view(), configure_view_nametable(), configure_zone_ssutable(), controlkeylist_fromcfg(), count_acl_elements(), count_zones(), create_empty_zone(), disable_algorithms(), disable_ds_digests(), disabled_algorithms(), disabled_ds_digests(), find_name_in_list_from_map(), get_acl_def(), get_checknames(), get_masters_def(), load_configuration(), load_view_keys(), load_zones_fromconfig(), mustbesecure(), ns_checknames_get(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_config_listcount(), ns_controls_configure(), ns_listenlist_fromconfig(), ns_log_configure(), ns_lwdmanager_create(), ns_lwresd_configure(), ns_statschannels_configure(), on_disable_list(), parse_config(), portset_fromconf(), rndckey_exists(), and validate_masters().

unsigned int cfg_list_length ( const cfg_obj_t obj,
isc_boolean_t  recurse 
)

Returns the length of a list of configure objects. If obj is not a list, returns 0. If recurse is true, add in the length of all contained lists.

Definition at line 1218 of file parser.c.

References cfg_list_first(), cfg_list_length(), cfg_list_next(), cfg_obj_islist(), and cfg_listelt::obj.

Referenced by cfg_acl_fromconfig2(), and cfg_list_length().

cfg_obj_t* cfg_listelt_value ( const cfg_listelt_t elt  ) 

Returns the configuration object associated with cfg_listelt_t.

Requires:

Returns:

Definition at line 1237 of file parser.c.

References cfg_listelt::obj, and REQUIRE.

Referenced by add_initial_keys(), bind9_check_controls(), bind9_check_controlskeys(), bind9_check_logging(), bind9_check_namedconf(), category_fromconf(), cfg_acl_fromconfig2(), cfgkeylist_find(), check_dns64(), check_dual_stack(), check_keylist(), check_options(), check_order(), check_servers(), check_update_policy(), check_viewconf(), check_zoneconf(), configure_alternates(), configure_forward(), configure_rpz_zone(), configure_staticstub_serveraddrs(), configure_staticstub_servernames(), configure_view(), configure_view_nametable(), configure_zone_ssutable(), controlkeylist_fromcfg(), count_acl_elements(), create_empty_zone(), delete_zoneconf(), disable_algorithms(), disable_ds_digests(), disabled_algorithms(), disabled_ds_digests(), find_name_in_list_from_map(), get_acl_def(), get_checknames(), get_masters_def(), load_configuration(), load_view_keys(), load_zones_fromconfig(), mustbesecure(), newzone_parse(), ns_checknames_get(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_controls_configure(), ns_listenlist_fromconfig(), ns_log_configure(), ns_lwdmanager_create(), ns_lwresd_configure(), ns_statschannels_configure(), on_disable_list(), parse_config(), portset_fromconf(), rndckey_exists(), and validate_masters().

void cfg_print ( const cfg_obj_t obj,
void(*)(void *closure, const char *text, int textlen)  f,
void *  closure 
)

Definition at line 192 of file parser.c.

References cfg_printx().

void cfg_printx ( const cfg_obj_t obj,
unsigned int  flags,
void(*)(void *closure, const char *text, int textlen)  f,
void *  closure 
)

Definition at line 200 of file parser.c.

References cfg_printer::closure, cfg_printer::f, cfg_printer::flags, cfg_printer::indent, cfg_type::print, and cfg_obj::type.

Referenced by cfg_print(), main(), ns_server_showzone(), and nzf_append().

void cfg_print_grammar ( const cfg_type_t type,
void(*)(void *closure, const char *text, int textlen)  f,
void *  closure 
)

Print a summary of the grammar of the configuration type 'type'.

Definition at line 2639 of file parser.c.

References cfg_doc_obj(), cfg_printer::closure, cfg_printer::f, cfg_printer::flags, and cfg_printer::indent.

isc_boolean_t cfg_obj_istype ( const cfg_obj_t obj,
const cfg_type_t type 
)

Return true iff 'obj' is of type 'type'.

Definition at line 2586 of file parser.c.

References ISC_TF, and cfg_obj::type.

Referenced by cfg_acl_fromconfig2(), and count_acl_elements().

void cfg_obj_attach ( cfg_obj_t src,
cfg_obj_t **  dest 
)

Reference a configuration object.

Definition at line 2613 of file parser.c.

References isc_refcount_increment, cfg_obj::references, and REQUIRE.

Referenced by cfg_parser_mapadd(), do_addzone(), and setup_newzones().

void cfg_obj_destroy ( cfg_parser_t pctx,
cfg_obj_t **  obj 
)

Delete a reference to a configuration object; destroy the object if there are no more references.

Require:

Definition at line 2594 of file parser.c.

References cfg_rep::free, isc_mem_put, isc_refcount_decrement, isc_refcount_destroy, cfg_parser::mctx, cfg_obj::references, cfg_type::rep, REQUIRE, and cfg_obj::type.

Referenced by cfg_parse_mapbody(), delete_zoneconf(), free_listelt(), get_rndckey(), load_configuration(), main(), map_symtabitem_destroy(), newzone_cfgctx_destroy(), newzone_parse(), ns_server_changezone(), parse_port(), parse_portrange(), read_confkey(), read_sessionkey(), and shutdown_server().

void cfg_obj_log ( const cfg_obj_t obj,
isc_log_t lctx,
int  level,
const char *  fmt,
  ... 
)

Referenced by add_initial_keys(), add_listener(), bind9_check_controls(), bind9_check_controlskeys(), bind9_check_key(), bind9_check_logging(), bind9_check_namedconf(), category_fromconf(), cfg_acl_fromconfig2(), channel_fromconf(), check_dns64(), check_dscp(), check_dual_stack(), check_filteraaaa(), check_forward(), check_keylist(), check_nonzero(), check_options(), check_orderent(), check_recursionacls(), check_servers(), check_trusted_key(), check_update_policy(), check_viewconf(), check_zoneconf(), configure_alternates(), configure_forward(), configure_rpz_name(), configure_rpz_name2(), configure_rpz_zone(), configure_session_key(), configure_staticstub_serveraddrs(), configure_staticstub_servernames(), configure_view(), configure_view_nametable(), configure_zone(), configure_zone_ssutable(), convert_keyname(), convert_named_acl(), directory_callback(), disable_algorithms(), disable_ds_digests(), disabled_algorithms(), disabled_ds_digests(), dstkey_fromconfig(), fileexist(), get_rndckey(), get_view_querysource_dispatch(), mustbesecure(), nameexist(), ns_config_getclass(), ns_config_getdscp(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_config_getport(), ns_config_gettype(), ns_listenelt_fromconfig(), ns_statschannels_configure(), ns_zone_configure(), register_keys(), update_listener(), and validate_masters().

void const char* cfg_obj_file ( const cfg_obj_t obj  ) 

Log a message concerning configuration object 'obj' to the logging channel of 'pctx', at log level 'level'. The message will be prefixed with the file name(s) and line number where 'obj' was defined.

Return the file that defined this object.

Definition at line 2514 of file parser.c.

References cfg_obj::file.

Referenced by bind9_check_namedconf(), check_forward(), check_keylist(), check_servers(), fileexist(), and nameexist().

unsigned int cfg_obj_line ( const cfg_obj_t obj  ) 

Return the line in file where this object was defined.

Definition at line 2519 of file parser.c.

References cfg_obj::line.

Referenced by bind9_check_namedconf(), check_forward(), check_keylist(), check_servers(), fileexist(), and nameexist().


Generated on Tue Apr 28 17:41:19 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha