Data Structures | Functions

cr_data.h File Reference

Contains the functions to manage routing data. More...

#include <sys/types.h>
#include "../../locking.h"
#include "../../flags.h"
#include "cr_map.h"
Include dependency graph for cr_data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

Functions


Detailed Description

Definition in file cr_data.h.


Function Documentation

int add_carrier_data ( struct route_data_t rd,
struct carrier_data_t carrier_data 
)
Parameters:
rd route data to be searched
carrier_data the carrier data struct to be inserted
Returns:
0 on success, -1 on failure

adds a carrier_data struct for given carrier

Parameters:
rd route data to be searched
carrier_data the carrier data struct to be inserted
Returns:
0 on success, -1 on failure

Definition at line 143 of file cr_data.c.

References route_data_t::carrier_num, route_data_t::carriers, and route_data_t::first_empty_carrier.

Referenced by load_config(), and load_route_data_db().

Here is the caller graph for this function:

int add_failure_route ( struct route_data_t rd,
int  carrier_id,
int  domain_id,
const str scan_prefix,
const str host,
const str reply_code,
flag_t  flags,
flag_t  mask,
int  next_domain_id,
const str comment 
)

scan_prefix, host, reply_code and flags identifies the number for which the information is and the next_domain parameter defines where to continue routing in case of a match.

Parameters:
rd the route data to which the route shall be added
carrier_id the carrier id of the route to be added
domain_id the routing domain id of the new route
scan_prefix the number prefix
host the hostname last tried
reply_code the reply code
flags user defined flags
mask for user defined flags
next_domain_id continue routing with this domain id
comment a comment for the failure route rule
Returns:
0 on success, -1 on error in which case it LOGs a message.

Definition at line 496 of file cr_data.c.

References add_failure_route_to_tree(), domain_data_t::failure_tree, get_carrier_data(), get_domain_data_or_add(), _str::len, and _str::s.

Referenced by load_route_data_db().

Here is the call graph for this function:

Here is the caller graph for this function:

int add_route ( struct route_data_t rd,
int  carrier_id,
int  domain_id,
const str scan_prefix,
flag_t  flags,
flag_t  mask,
int  max_targets,
double  prob,
const str rewrite_hostpart,
int  strip,
const str rewrite_local_prefix,
const str rewrite_local_suffix,
int  status,
int  hash_index,
int  backup,
int *  backed_up,
const str comment 
)

scan_prefix identifies the number for which the information is and the rewrite_* parameters define what to do in case of a match. prob gives the probability with which this rule applies if there are more than one for a given prefix.

Parameters:
rd the route data to which the route shall be added
carrier_id the carrier id of the route to be added
domain_id the routing domain id of the new route
scan_prefix the number prefix
flags user defined flags
mask mask for user defined flags
max_targets the number of targets
prob the weight of the rule
strip the number of digits to be stripped off userpart before prepending prefix
rewrite_hostpart the rewrite_host of the rule
rewrite_local_prefix the rewrite prefix
rewrite_local_suffix the rewrite suffix
status the status of the rule
hash_index the hash index of the rule
backup indicates if the route is backed up by another. only useful if status==0, if set, it is the hash value of another rule
backed_up an -1-termintated array of hash indices of the route for which this route is backup
comment a comment for the route rule
Returns:
0 on success, -1 on error in which case it LOGs a message.

scan_prefix identifies the number for which the information is and the rewrite_* parameters define what to do in case of a match. prob gives the probability with which this rule applies if there are more than one for a given prefix.

Parameters:
rd the route data to which the route shall be added
carrier_id the carrier id of the route to be added
domain_id the routing domain id of the new route
scan_prefix the number prefix
flags user defined flags
mask mask for user defined flags
max_targets the number of targets
prob the weight of the rule
rewrite_hostpart the rewrite_host of the rule
strip the number of digits to be stripped off userpart before prepending prefix
rewrite_local_prefix the rewrite prefix
rewrite_local_suffix the rewrite suffix
status the status of the rule
hash_index the hash index of the rule
backup indicates if the route is backed up by another. only useful if status==0, if set, it is the hash value of another rule
backed_up an -1-termintated array of hash indices of the route for which this route is backup
comment a comment for the route rule
Returns:
0 on success, -1 on error in which case it LOGs a message.

Definition at line 451 of file cr_data.c.

References add_route_to_tree(), get_carrier_data(), get_domain_data_or_add(), _str::len, _str::s, and domain_data_t::tree.

Referenced by load_config(), load_route_data_db(), and update_route_data().

Here is the call graph for this function:

Here is the caller graph for this function:

void clear_route_data ( struct route_data_t data  ) 
Parameters:
data route data to be cleared

Definition at line 104 of file cr_data.c.

References route_data_t::carrier_map, route_data_t::carrier_num, route_data_t::carriers, destroy_carrier_data(), route_data_t::domain_map, route_data_t::domain_num, name_map_t::name, and _str::s.

Referenced by destroy_route_data(), reload_route_data(), and update_route_data().

Here is the call graph for this function:

Here is the caller graph for this function:

struct carrier_data_t* get_carrier_data ( struct route_data_t rd,
int  carrier_id 
) [read]
Note:
The carrier array must be sorted!
Parameters:
rd route data to be searched
carrier_id the id of the desired carrier
Returns:
a pointer to the desired carrier data, NULL if not found.

Definition at line 289 of file cr_data.c.

References route_data_t::carrier_num, route_data_t::carriers, compare_carrier_data(), and carrier_data_t::id.

Referenced by add_failure_route(), add_route(), cr_do_route(), and cr_load_next_domain().

Here is the call graph for this function:

Here is the caller graph for this function:

struct route_data_t* get_data ( void   )  [read]
Returns:
pointer to the global routing data on success, NULL on failure

Definition at line 248 of file cr_data.c.

References route_data_t::lock, and route_data_t::proc_cnt.

Referenced by carrier_name_2_id(), cr_do_route(), cr_load_next_domain(), destroy_route_data(), domain_name_2_id(), and dump_fifo().

Here is the caller graph for this function:

int init_route_data ( void   ) 
Returns:
0 on success, -1 on failure

Definition at line 71 of file cr_data.c.

Referenced by mod_init().

Here is the caller graph for this function:

void release_data ( struct route_data_t data  ) 
Parameters:
data data to be released

Definition at line 273 of file cr_data.c.

References route_data_t::lock, and route_data_t::proc_cnt.

Referenced by carrier_name_2_id(), cr_do_route(), cr_load_next_domain(), domain_name_2_id(), and dump_fifo().

Here is the caller graph for this function:

int reload_route_data ( void   ) 

The old_data is removed when it is not locked anymore.

Returns:
0 on success, -1 on failure

Definition at line 167 of file cr_data.c.

References route_data_t::carrier_num, route_data_t::carriers, clear_route_data(), compare_carrier_data(), compare_domain_data(), carrier_data_t::domain_num, carrier_data_t::domains, load_config(), load_route_data_db(), route_data_t::proc_cnt, and rule_fixup().

Referenced by mod_init(), reload_fifo(), and update_route_data().

Here is the call graph for this function:

Here is the caller graph for this function:

int rule_fixup ( struct route_data_t rd  ) 
Parameters:
rd route data to be fixed
Returns:
0 on success, -1 on failure

Definition at line 650 of file cr_data.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, rule_fixup_recursor(), _str::s, and domain_data_t::tree.

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: