More...
#include <confuse.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include "../../mem/shm_mem.h"
#include "../../mem/mem.h"
#include "../../ut.h"
#include "cr_config.h"
#include "carrierroute.h"
#include "cr_rule.h"
#include "cr_domain.h"
#include "cr_carrier.h"

Go to the source code of this file.
Functions | |
| static int | backup_config (void) |
| static void | conf_error (cfg_t *cfg, const char *fmt, va_list ap) |
| int | load_config (struct route_data_t *rd) |
| static cfg_t * | parse_config (void) |
| int | save_config (struct route_data_t *rd) |
| static int | save_route_data_recursor (struct dtrie_node_t *node, FILE *outfile) |
Definition in file cr_config.c.
| static int backup_config | ( | void | ) | [static] |
Definition at line 111 of file cr_config.c.
References config_file, LM_ERR, LM_INFO, LM_NOTICE, NULL, pkg_free, pkg_malloc, and PKG_MEM_ERROR.
Referenced by save_config().
| static void conf_error | ( | cfg_t * | cfg, | |
| const char * | fmt, | |||
| va_list | ap | |||
| ) | [static] |
reports errors during config file parsing using LOG macro
| cfg | points to the current config data structure | |
| fmt | a format string | |
| ap | format arguments |
Definition at line 52 of file cr_config.c.
References L_ERR, and LM_GEN1.
Referenced by parse_config().
| int load_config | ( | struct route_data_t * | rd | ) |
Loads the routing data from the config file given in global variable config_data and stores it in routing tree rd.
| rd | Pointer to the route data tree where the routing data shall be loaded into |
Definition at line 182 of file cr_config.c.
References add_carrier_data(), add_route(), route_data_t::carrier_map, route_data_t::carrier_num, route_data_t::carriers, compare_name_map(), CR_EMPTY_PREFIX, create_carrier_data(), default_tree, destroy_carrier_data(), domain, route_data_t::domain_map, route_data_t::domain_num, route_data_t::first_empty_carrier, name_map_t::id, _str::len, LM_ERR, LM_INFO, map_name2id(), name_map_t::name, NULL, parse_config(), pkg_free, pkg_malloc, PKG_MEM_ERROR, prefix, _str::s, shm_malloc(), SHM_MEM_ERROR, and str_strcasecmp().
Referenced by reload_route_data(), and update_route_data().
| static cfg_t* parse_config | ( | void | ) | [static] |
Parses the config file
Definition at line 63 of file cr_config.c.
References conf_error(), config_file, LM_ERR, and NULL.
Referenced by load_config().
| int save_config | ( | struct route_data_t * | rd | ) |
Stores the routing data rd in config_file
| rd | Pointer to the routing tree which shall be saved to file |
Definition at line 432 of file cr_config.c.
References backup_config(), route_data_t::carrier_num, route_data_t::carriers, config_file, carrier_data_t::domain_num, carrier_data_t::domains, _str::len, LM_ERR, domain_data_t::name, NULL, _str::s, save_route_data_recursor(), and domain_data_t::tree.
Referenced by update_route_data().
| static int save_route_data_recursor | ( | struct dtrie_node_t * | node, | |
| FILE * | outfile | |||
| ) | [static] |
Does the work for save_config, traverses the routing data tree and writes each rule to file.
| node | the current prefix tree node | |
| outfile | the filehandle to which the config data is written |
Definition at line 359 of file cr_config.c.
References route_rule::backed_up, route_rule::backup, route_rule::comment, cr_match_mode, route_rule_p_list::hash_index, route_rule::hash_index, route_rule::host, _str::len, route_rule::local_prefix, route_rule::local_suffix, route_flags::max_targets, route_rule::next, route_rule_p_list::next, route_rule::orig_prob, route_rule::prefix, route_flags::rule_list, _str::s, route_rule::status, str_init, and route_rule::strip.
Referenced by save_config().
1.5.6