Functions | Variables

cr_fifo.c File Reference

Functions for modifying routing data via fifo commands. More...

#include <ctype.h>
#include <stdlib.h>
#include "../../mem/mem.h"
#include "../../mem/shm_mem.h"
#include "../../str.h"
#include "../../ut.h"
#include "cr_fifo.h"
#include "carrierroute.h"
#include "cr_config.h"
#include "cr_carrier.h"
#include "cr_domain.h"
#include "cr_rule.h"
Include dependency graph for cr_fifo.c:

Go to the source code of this file.

Functions

Variables


Detailed Description

Definition in file cr_fifo.c.


Function Documentation

struct mi_root* activate_host ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree the MI command tree
param the parameter
Returns:
code 200 on success, code 400 or 500 on failure

Definition at line 273 of file cr_fifo.c.

References fifo_opt::cmd, get_fifo_opts(), opt_settings, print_fifo_err(), fifo_opt::status, and update_route_data().

Here is the call graph for this function:

struct mi_root* add_host ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree the MI command tree
param the parameter
Returns:
code 200 on success, code 400 or 500 on failure

Definition at line 317 of file cr_fifo.c.

References fifo_opt::cmd, get_fifo_opts(), opt_settings, print_fifo_err(), fifo_opt::status, and update_route_data().

Here is the call graph for this function:

struct mi_root* deactivate_host ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree the MI command tree
param the parameter
Returns:
code 200 on success, code 400 or 500 on failure

Definition at line 229 of file cr_fifo.c.

References fifo_opt::cmd, get_fifo_opts(), opt_settings, print_fifo_err(), fifo_opt::status, and update_route_data().

Here is the call graph for this function:

struct mi_root* delete_host ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree the MI command tree
param the parameter
Returns:
code 200 on success, code 400 or 500 on failure

Definition at line 357 of file cr_fifo.c.

References fifo_opt::cmd, get_fifo_opts(), opt_settings, print_fifo_err(), and update_route_data().

Here is the call graph for this function:

struct mi_root* dump_fifo ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree the MI command tree
param the parameter
Returns:
code 200 on success, code 400 or 500 on failure

Definition at line 125 of file cr_fifo.c.

References route_data_t::carrier_num, route_data_t::carriers, carrier_data_t::domain_num, carrier_data_t::domains, dump_tree_recursor(), get_data(), domain_data_t::id, carrier_data_t::id, _str::len, domain_data_t::name, carrier_data_t::name, release_data(), _str::s, and domain_data_t::tree.

Here is the call graph for this function:

static int dump_tree_recursor ( struct mi_node *  msg,
struct dtrie_node_t node,
char *  prefix 
) [static]
Parameters:
msg MI node that is used to append the informations
node pointer to the routing tree node
prefix carries the current scan prefix
Returns:
0 for success, negative result for error

Definition at line 400 of file cr_fifo.c.

References route_rule::backed_up, route_rule::backup, dtrie_node_t::child, route_rule::comment, dtrie_node_t::data, route_flags::dice_max, route_rule::host, _str::len, route_rule::local_prefix, route_rule::local_suffix, route_rule::next, route_flags::next, route_rule::prob, route_flags::rule_list, _str::s, route_rule::status, and route_rule::strip.

Referenced by dump_fifo().

Here is the caller graph for this function:

static int get_fifo_opts ( str buf,
fifo_opt_t opts,
unsigned int  opt_set[] 
) [static]
Parameters:
buf the command line argument
opts fifo options
opt_set set of the options
Returns:
0 on success, -1 on failure
See also:
dump_fifo()

Definition at line 469 of file cr_fifo.c.

References fifo_opt::domain, fifo_opt::hash_index, fifo_opt::host, _str::len, fifo_opt::new_host, OPT_PREFIX_CHR, fifo_opt::prefix, fifo_opt::prob, fifo_opt::rewrite_prefix, fifo_opt::rewrite_suffix, _str::s, str_strcasecmp(), and fifo_opt::strip.

Referenced by activate_host(), add_host(), deactivate_host(), delete_host(), and replace_host().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mi_root * print_fifo_err ( void   )  [static, read]
Todo:
this is currently not evaluated for errors during update_route_data

Definition at line 946 of file cr_fifo.c.

References print_replace_help().

Referenced by activate_host(), add_host(), deactivate_host(), delete_host(), and replace_host().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mi_root* reload_fifo ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree the MI command tree
param the parameter
Returns:
code 200 on success, code 500 on failure

Definition at line 104 of file cr_fifo.c.

References reload_route_data().

Here is the call graph for this function:

struct mi_root* replace_host ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree the MI command tree
param the parameter
Returns:
code 200 on success, code 400 or 500 on failure

Definition at line 185 of file cr_fifo.c.

References fifo_opt::cmd, get_fifo_opts(), opt_settings, print_fifo_err(), fifo_opt::status, and update_route_data().

Here is the call graph for this function:

static int update_route_data ( fifo_opt_t opts  )  [static]

Afterwards, the global routing data is reloaded.

Parameters:
opts pointer to the option structure which contains data to be modified or to be added
Returns:
0 on success, -1 on failure

Definition at line 612 of file cr_fifo.c.

References add_route(), route_data_t::carrier_num, route_data_t::carriers, clear_route_data(), fifo_opt::cmd, fifo_opt::domain, route_data_t::domain_map, carrier_data_t::domain_num, route_data_t::domain_num, carrier_data_t::domains, fifo_opt::hash_index, fifo_opt::host, _str::len, load_config(), map_name2id(), domain_data_t::name, fifo_opt::prefix, fifo_opt::prob, reload_route_data(), fifo_opt::rewrite_prefix, fifo_opt::rewrite_suffix, rule_fixup(), _str::s, save_config(), fifo_opt::status, fifo_opt::strip, domain_data_t::tree, and update_route_data_recursor().

Referenced by activate_host(), add_host(), deactivate_host(), delete_host(), and replace_host().

Here is the call graph for this function:

Here is the caller graph for this function:

static int update_route_data_recursor ( struct dtrie_node_t node,
str act_domain,
fifo_opt_t opts 
) [static]
Parameters:
node points to the current routing tree node
act_domain routing domain which is currently searched
opts points to the fifo command option structure
See also:
update_route_data()
Returns:
0 on success, -1 on failure

Definition at line 738 of file cr_fifo.c.

References route_rule::backed_up, route_rule::backup, dtrie_node_t::child, fifo_opt::cmd, dtrie_node_t::data, destroy_route_rule(), fifo_opt::domain, hash(), route_rule::host, fifo_opt::host, _str::len, route_flags::max_targets, fifo_opt::new_host, route_rule::next, route_rule::prefix, fifo_opt::prefix, route_rule::prob, fifo_opt::prob, route_flags::rule_list, route_flags::rule_num, _str::s, fifo_opt::status, and route_rule::status.

Referenced by update_route_data().

Here is the call graph for this function:

Here is the caller graph for this function: