jabberd2  2.3.3
Data Structures | Functions
config.c File Reference
#include "util.h"
#include "expat.h"

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 More...
 
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 More...
 
int config_load_with_id (config_t c, const char *file, const char *id)
 turn an xml file into a config hash More...
 
config_elem_t config_get (config_t c, const char *key)
 get the config element for this key More...
 
const char * config_get_one (config_t c, const char *key, int num)
 get config value n for this key More...
 
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 More...
 
int config_count (config_t c, const char *key)
 how many values for this key? More...
 
char * config_get_attr (config_t c, const char *key, int num, const char *attr)
 get an attr for this value More...
 
static void _config_reaper (const char *key, int keylen, void *val, void *arg)
 cleanup helper More...
 
char * config_expand (config_t c, const char *value)
 
void config_free (config_t c)
 cleanup More...
 

Function Documentation

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 _sm_signal_hup(), and JABBER_MAIN().

static void _config_startElement ( void *  arg,
const char *  name,
const char **  atts 
)
static

Definition at line 42 of file config.c.

References build_data::depth, build_data::nad, nad_append_attr(), and nad_append_elem().

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 build_data::depth, build_data::nad, and nad_append_cdata().

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(), config_st::hash, pstrdup(), and xhash_pool().

Referenced by config_expand(), and config_load_with_id().

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 _sm_signal_hup(), and JABBER_MAIN().

int config_load_with_id ( config_t  c,
const char *  file,
const char *  id 
)
config_elem_t config_get ( config_t  c,
const char *  key 
)
const char* config_get_one ( config_t  c,
const char *  key,
int  num 
)
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 config_st::hash, config_elem_st::nvalues, and xhash_get().

Referenced by _s2s_config_expand().

char* config_get_attr ( config_t  c,
const char *  key,
int  num,
const char *  attr 
)
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::attrs, and config_elem_st::values.

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 _config_reaper(), config_st::hash, config_st::nad, nad_free(), xhash_free(), and xhash_walk().

Referenced by _sm_signal_hup(), and JABBER_MAIN().