Functions

cr_carrier.c File Reference

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

#include <stdlib.h>
#include "../../mem/shm_mem.h"
#include "../../ut.h"
#include "cr_carrier.h"
#include "cr_domain.h"
#include "cr_map.h"
Include dependency graph for cr_carrier.c:

Go to the source code of this file.

Functions


Detailed Description

Definition in file cr_carrier.c.


Function Documentation

int add_domain_data ( struct carrier_data_t carrier_data,
struct domain_data_t domain_data,
int  index 
)

Other etries are moved one position up to make space for the new one.

Parameters:
carrier_data the carrier data struct where domain_data should be inserted
domain_data the domain data struct to be inserted
index the index where to insert the domain_data structure in the domain array
Returns:
0 on success, -1 on failure

Definition at line 99 of file cr_carrier.c.

References carrier_data_t::domain_num, carrier_data_t::domains, carrier_data_t::first_empty_domain, carrier_data_t::id, domain_data_t::id, _str::len, carrier_data_t::name, domain_data_t::name, and _str::s.

Referenced by get_domain_data_or_add().

Here is the caller graph for this function:

int compare_carrier_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 155 of file cr_carrier.c.

References carrier_data_t::id.

Referenced by get_carrier_data(), and reload_route_data().

Here is the caller graph for this function:

struct carrier_data_t* create_carrier_data ( int  carrier_id,
str carrier_name,
int  domains 
) [read]
Parameters:
carrier_id id of carrier
carrier_name pointer to the name of the carrier
domains number of domains for that carrier
Returns:
a pointer to the newly allocated carrier data or NULL on error, in which case it LOGs an error message.

Definition at line 48 of file cr_carrier.c.

References carrier_data_t::domain_num, carrier_data_t::domains, carrier_data_t::id, and carrier_data_t::name.

Referenced by load_config(), and load_route_data_db().

Here is the caller graph for this function:

void destroy_carrier_data ( struct carrier_data_t carrier_data  ) 
Parameters:
carrier_data the structure to be destroyed.

Definition at line 75 of file cr_carrier.c.

References destroy_domain_data(), carrier_data_t::domain_num, and carrier_data_t::domains.

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

Here is the call graph for this function:

Here is the caller graph for this function:

struct domain_data_t* get_domain_data ( struct carrier_data_t carrier_data,
int  domain_id 
) [read]
Note:
The domain array must be sorted!
Parameters:
carrier_data carrier data to be searched
domain_id the id of desired domain
Returns:
a pointer to the desired domain data, NULL if not found.

Definition at line 133 of file cr_carrier.c.

References compare_domain_data(), carrier_data_t::domain_num, carrier_data_t::domains, and domain_data_t::id.

Referenced by cr_do_route(), and cr_load_next_domain().

Here is the call graph for this function:

Here is the caller graph for this function: