jabberd2
2.2.16
|
Go to the source code of this file.
Data Structures | |
struct | build_data |
parse a buffer into a nad More... | |
Functions | |
config_t | config_new (void) |
new config structure | |
static void | _config_startElement (void *arg, const char *name, const char **atts) |
static void | _config_endElement (void *arg, const char *name) |
static void | _config_charData (void *arg, const char *str, int len) |
static char * | _config_expandx (config_t c, const char *value, int l) |
int | config_load (config_t c, const char *file) |
turn an xml file into a config hash | |
int | config_load_with_id (config_t c, const char *file, const char *id) |
turn an xml file into a config hash | |
config_elem_t | config_get (config_t c, const char *key) |
get the config element for this key | |
const char * | config_get_one (config_t c, const char *key, int num) |
get config value n for this key | |
const char * | config_get_one_default (config_t c, const char *key, int num, const char *default_value) |
get config value n for this key, returns default_value if not found | |
int | config_count (config_t c, const char *key) |
how many values for this key? | |
char * | config_get_attr (config_t c, const char *key, int num, const char *attr) |
get an attr for this value | |
static void | _config_reaper (const char *key, int keylen, void *val, void *arg) |
cleanup helper | |
char * | config_expand (config_t c, const char *value) |
void | config_free (config_t c) |
cleanup |
config_t config_new | ( | void | ) |
new config structure
Definition at line 25 of file config.c.
References config_st::hash, and xhash_new().
Referenced by JABBER_MAIN(), and _sm_signal_hup().
static void _config_startElement | ( | void * | arg, |
const char * | name, | ||
const char ** | atts | ||
) | [static] |
Definition at line 42 of file config.c.
References nad_append_elem(), build_data::nad, build_data::depth, and nad_append_attr().
Referenced by config_load_with_id().
static void _config_endElement | ( | void * | arg, |
const char * | name | ||
) | [static] |
Definition at line 57 of file config.c.
References build_data::depth.
Referenced by config_load_with_id().
static void _config_charData | ( | void * | arg, |
const char * | str, | ||
int | len | ||
) | [static] |
Definition at line 64 of file config.c.
References nad_append_cdata(), build_data::nad, and build_data::depth.
Referenced by config_load_with_id().
static char * _config_expandx | ( | config_t | c, |
const char * | value, | ||
int | l | ||
) | [static] |
Definition at line 338 of file config.c.
References config_get_one(), pstrdup(), xhash_pool(), and config_st::hash.
Referenced by config_load_with_id(), and config_expand().
int config_load | ( | config_t | c, |
const char * | file | ||
) |
turn an xml file into a config hash
Definition at line 74 of file config.c.
References config_load_with_id().
Referenced by JABBER_MAIN(), and _sm_signal_hup().
int config_load_with_id | ( | config_t | c, |
const char * | file, | ||
const char * | id | ||
) |
turn an xml file into a config hash
Definition at line 80 of file config.c.
References build_data::p, build_data::nad, nad_new(), build_data::depth, _config_startElement(), _config_endElement(), _config_charData(), nad_free(), pmalloco(), xhash_pool(), config_st::hash, xhash_put(), pstrdup(), config_elem_st::values, config_elem_st::nvalues, nad_elem_st::depth, nad_elem_st::iname, nad_elem_st::lname, xhash_get(), NAD_CDATA_L, _config_expandx(), NAD_CDATA, config_elem_st::attrs, pmalloc(), pstrdupx(), NAD_ANAME, NAD_ANAME_L, NAD_AVAL, NAD_AVAL_L, nad_elem_st::attr, and config_st::nad.
Referenced by JABBER_MAIN(), and config_load().
config_elem_t config_get | ( | config_t | c, |
const char * | key | ||
) |
get the config element for this key
Definition at line 271 of file config.c.
References xhash_get(), and config_st::hash.
Referenced by _c2s_config_expand(), _c2s_hosts_expand(), _c2s_sx_sasl_callback(), JABBER_MAIN(), _router_config_expand(), _sm_config_expand(), _sm_hosts_expand(), _s2s_config_expand(), _s2s_hosts_expand(), module_init(), _help_disco_extend(), and sess_start().
const char* config_get_one | ( | config_t | c, |
const char * | key, | ||
int | num | ||
) |
get config value n for this key
Definition at line 277 of file config.c.
References xhash_get(), config_st::hash, config_elem_st::nvalues, and config_elem_st::values.
Referenced by authreg_init(), _c2s_pidfile(), _c2s_config_expand(), _router_pidfile(), _router_config_expand(), _sm_pidfile(), _sm_config_expand(), _s2s_pidfile(), _s2s_config_expand(), filter_load(), user_table_load(), mm_new(), module_init(), config_get_one_default(), and _config_expandx().
const char* config_get_one_default | ( | config_t | c, |
const char * | key, | ||
int | num, | ||
const char * | default_value | ||
) |
get config value n for this key, returns default_value if not found
Definition at line 291 of file config.c.
References config_get_one().
int config_count | ( | config_t | c, |
const char * | key | ||
) |
how many values for this key?
Definition at line 303 of file config.c.
References xhash_get(), config_st::hash, and config_elem_st::nvalues.
Referenced by _s2s_config_expand().
char* config_get_attr | ( | config_t | c, |
const char * | key, | ||
int | num, | ||
const char * | attr | ||
) |
get an attr for this value
Definition at line 314 of file config.c.
References xhash_get(), config_st::hash, config_elem_st::nvalues, config_elem_st::attrs, and j_attr().
Referenced by _c2s_config_expand(), _router_config_expand(), _sm_config_expand(), and _s2s_config_expand().
static void _config_reaper | ( | const char * | key, |
int | keylen, | ||
void * | val, | ||
void * | arg | ||
) | [static] |
cleanup helper
Definition at line 325 of file config.c.
References config_elem_st::values, and config_elem_st::attrs.
Referenced by config_free().
char* config_expand | ( | config_t | c, |
const char * | value | ||
) |
Definition at line 333 of file config.c.
References _config_expandx().
void config_free | ( | config_t | c | ) |
cleanup
Replaces $(some.value) with config_get_one(c, "some.value", 0)
Definition at line 410 of file config.c.
References xhash_walk(), config_st::hash, _config_reaper(), xhash_free(), nad_free(), and config_st::nad.
Referenced by JABBER_MAIN(), and _sm_signal_hup().