#include <isc/lang.h>
#include <isccc/types.h>
Go to the source code of this file.
Keys are C strings. A type may be specified when looking up, defining, or undefining. A type value of 0 means "match any type"; any other value will only match the given type.
It's possible that a client will attempt to define a <key, type, value> tuple when a tuple with the given key and type already exists in the table. What to do in this case is specified by the client. Possible policies are:
The symbol table library does not make a copy the key field, so the caller must ensure that any key it passes to isccc_symtab_define() will not change until it calls isccc_symtab_undefine() or isccc_symtab_destroy().
A user-specified action will be called (if provided) when a symbol is undefined. It can be used to free memory associated with keys and/or values.
Definition in file symtab.h.
typedef union isccc_symvalue isccc_symvalue_t |
typedef void(* isccc_symtabundefaction_t)(char *key, unsigned int type, isccc_symvalue_t value, void *userarg) |
typedef isc_boolean_t(* isccc_symtabforeachaction_t)(char *key, unsigned int type, isccc_symvalue_t value, void *userarg) |
enum isccc_symexists_t |
ISC_LANG_BEGINDECLS isc_result_t isccc_symtab_create | ( | unsigned int | size, | |
isccc_symtabundefaction_t | undefine_action, | |||
void * | undefine_arg, | |||
isc_boolean_t | case_sensitive, | |||
isccc_symtab_t ** | symtabp | |||
) |
Definition at line 71 of file symtab.c.
References free(), ISC_LIST_INIT, ISC_R_NOMEMORY, ISC_R_SUCCESS, REQUIRE, symtab, and SYMTAB_MAGIC.
Referenced by isccc_cc_createsymtab().
void isccc_symtab_destroy | ( | isccc_symtab_t ** | symtabp | ) |
Definition at line 114 of file symtab.c.
References free(), free_elt(), ISC_LIST_HEAD, ISC_LIST_NEXT, REQUIRE, symtab, and VALID_SYMTAB.
Referenced by ns_controls_destroy().
isc_result_t isccc_symtab_lookup | ( | isccc_symtab_t * | symtab, | |
const char * | key, | |||
unsigned int | type, | |||
isccc_symvalue_t * | value | |||
) |
Definition at line 195 of file symtab.c.
References FIND, ISC_R_NOTFOUND, ISC_R_SUCCESS, REQUIRE, VALID_SYMTAB, and elt::value.
isc_result_t isccc_symtab_define | ( | isccc_symtab_t * | symtab, | |
char * | key, | |||
unsigned int | type, | |||
isccc_symvalue_t | value, | |||
isccc_symexists_t | exists_policy | |||
) |
Definition at line 216 of file symtab.c.
References FIND, INSIST, ISC_LINK_INIT, ISC_LIST_PREPEND, ISC_LIST_UNLINK, ISC_R_EXISTS, ISC_R_NOMEMORY, ISC_R_SUCCESS, isccc_symexists_add, isccc_symexists_reject, isccc_symexists_replace, elt::key, REQUIRE, elt::type, VALID_SYMTAB, and elt::value.
Referenced by isccc_cc_checkdup().
isc_result_t isccc_symtab_undefine | ( | isccc_symtab_t * | symtab, | |
const char * | key, | |||
unsigned int | type | |||
) |
Definition at line 257 of file symtab.c.
References FIND, free_elt(), ISC_R_NOTFOUND, ISC_R_SUCCESS, REQUIRE, and VALID_SYMTAB.
void isccc_symtab_foreach | ( | isccc_symtab_t * | symtab, | |
isccc_symtabforeachaction_t | action, | |||
void * | arg | |||
) |
Definition at line 275 of file symtab.c.
References free_elt(), ISC_LIST_HEAD, ISC_LIST_NEXT, elt::key, REQUIRE, elt::type, VALID_SYMTAB, and elt::value.
Referenced by isccc_cc_cleansymtab().