Data Structures | Functions

cr_domain.h File Reference

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

#include "../../str.h"
#include "../../flags.h"
#include "../../lib/trie/dtrie.h"
Include dependency graph for cr_domain.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_domain.h.


Function Documentation

int add_failure_route_to_tree ( struct dtrie_node_t failure_node,
const str scan_prefix,
const str full_prefix,
const str host,
const str reply_code,
const flag_t  flags,
const flag_t  mask,
const int  next_domain,
const str comment 
)

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

Parameters:
failure_node the root of the failure routing tree
scan_prefix the prefix for which to add the rule (must not contain non-digits)
full_prefix the whole scan prefix
host the hostname last tried
reply_code the reply code
flags user defined flags
mask mask for user defined flags
next_domain continue routing with this domain id
comment a comment for the route rule
Returns:
0 on success, -1 on failure
See also:
add_route()

Definition at line 200 of file cr_domain.c.

References add_failure_route_rule(), dtrie_contains(), dtrie_insert(), _str::len, and _str::s.

Referenced by add_failure_route().

Here is the call graph for this function:

Here is the caller graph for this function:

int add_route_to_tree ( struct dtrie_node_t node,
const str scan_prefix,
flag_t  flags,
flag_t  mask,
const str full_prefix,
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. 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:
node the root of the routing tree
scan_prefix the prefix for which to add the rule (must not contain non-digits)
flags user defined flags
mask mask for user defined flags
full_prefix the whole scan prefix
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 failure
See also:
add_route()

Definition at line 149 of file cr_domain.c.

References add_route_flags(), add_route_rule(), dtrie_contains(), dtrie_insert(), _str::len, and _str::s.

Referenced by add_route().

Here is the call graph for this function:

Here is the caller graph for this function:

int compare_domain_data ( const void *  v1,
const void *  v2 
)

A NULL pointer is always greater than any ID.

Returns:
-1 if v1 < v2, 0 if v1 == v2, 1 if v1 > v2

Definition at line 232 of file cr_domain.c.

References domain_data_t::id.

Referenced by get_domain_data(), get_domain_data_or_add(), and reload_route_data().

Here is the caller graph for this function:

struct domain_data_t* create_domain_data ( int  domain_id,
str domain_name 
) [read]
Parameters:
domain_id the id of the domain
domain_name the name of the domain
Returns:
a pointer to the newly allocated domain data or NULL on error, in which case it LOGs an error message.

Definition at line 81 of file cr_domain.c.

References dtrie_destroy(), dtrie_init(), domain_data_t::failure_tree, domain_data_t::id, domain_data_t::name, and domain_data_t::tree.

Referenced by get_domain_data_or_add().

Here is the call graph for this function:

Here is the caller graph for this function:

void destroy_domain_data ( struct domain_data_t domain_data  ) 
Parameters:
domain_data the to the structure to be destroyed.
domain_data the structure to be destroyed.

Definition at line 108 of file cr_domain.c.

References destroy_failure_route_rule_list(), destroy_route_flags_list(), dtrie_destroy(), domain_data_t::failure_tree, and domain_data_t::tree.

Referenced by destroy_carrier_data(), and get_domain_data_or_add().

Here is the call graph for this function:

Here is the caller graph for this function: