Functions

cr_config.c File Reference

Functions for load and save routing data from a config file. More...

#include <confuse.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.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"
Include dependency graph for cr_config.c:

Go to the source code of this file.

Functions


Detailed Description

Definition in file cr_config.c.


Function Documentation

static void conf_error ( cfg_t *  cfg,
const char *  fmt,
va_list  ap 
) [static]
Parameters:
cfg points to the current config data structure
fmt a format string
ap format arguments

Definition at line 54 of file cr_config.c.

Referenced by parse_config().

Here is the caller graph for this function:

int load_config ( struct route_data_t rd  ) 
Parameters:
rd Pointer to the route data tree where the routing data shall be loaded into
Returns:
0 means ok, -1 means an error occured

Definition at line 202 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(), create_carrier_data(), destroy_carrier_data(), route_data_t::domain_map, route_data_t::domain_num, route_data_t::first_empty_carrier, name_map_t::id, _str::len, map_name2id(), name_map_t::name, parse_config(), prefix, _str::s, and str_strcasecmp().

Referenced by reload_route_data(), and update_route_data().

Here is the call graph for this function:

Here is the caller graph for this function:

static cfg_t* parse_config ( void   )  [static]
Returns:
a pointer to the configuration data structure, NULL on failure

Definition at line 74 of file cr_config.c.

References conf_error().

Referenced by load_config().

Here is the call graph for this function:

Here is the caller graph for this function:

int save_config ( struct route_data_t rd  ) 
Parameters:
rd Pointer to the routing tree which shall be saved to file
Returns:
0 means ok, -1 means an error occured

Definition at line 452 of file cr_config.c.

References route_data_t::carrier_num, route_data_t::carriers, carrier_data_t::domain_num, carrier_data_t::domains, _str::len, domain_data_t::name, _str::s, save_route_data_recursor(), and domain_data_t::tree.

Referenced by update_route_data().

Here is the call graph for this function:

Here is the caller graph for this function:

static int save_route_data_recursor ( struct dtrie_node_t node,
FILE *  outfile 
) [static]
Parameters:
node the current prefix tree node
outfile the filehandle to which the config data is written
Returns:
0 on success, -1 on failure

Definition at line 379 of file cr_config.c.

References route_rule::backed_up, route_rule::backup, dtrie_node_t::child, route_rule::comment, dtrie_node_t::data, 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::orig_prob, route_rule::prefix, route_flags::rule_list, _str::s, route_rule::status, and route_rule::strip.

Referenced by save_config().

Here is the caller graph for this function: