cr_map.c File Reference

Contains the functions to map domain and carrier names to ids.

More...

#include <stdlib.h>
#include "cr_map.h"
#include "../../mem/shm_mem.h"
#include "../../ut.h"

Include dependency graph for cr_map.c:

Go to the source code of this file.

Functions

int compare_name_map (const void *v1, const void *v2)
strmap_id2name (struct name_map_t *map, int size, int id)
int map_name2id (struct name_map_t *map, int size, const str *name)


Detailed Description

Contains the functions to map domain and carrier names to ids.

Definition in file cr_map.c.


Function Documentation

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

Compares the IDs of two name_map_t structures.

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

Definition at line 85 of file cr_map.c.

Referenced by load_carrier_map(), load_config(), load_domain_map(), and map_id2name().

str* map_id2name ( struct name_map_t map,
int  size,
int  id 
)

Searches for the name of an ID

Parameters:
map the mapping list to search in
size the size of the list
id the id, we are looking for
Returns:
values: on succcess the name for this id, NULL on failure

Definition at line 69 of file cr_map.c.

References compare_name_map(), name_map_t::id, name_map_t::name, and NULL.

Referenced by get_domain_data_or_add().

int map_name2id ( struct name_map_t map,
int  size,
const str name 
)

Searches for the ID of a name

Parameters:
map the mapping list to search in
size the size of the list
name the name, we are looking for
Returns:
values: on succcess the id for this name, -1 on failure

Definition at line 46 of file cr_map.c.

References name_map_t::id, _str::len, and str_strcmp().

Referenced by carrier_name_2_id(), cr_gp2id(), domain_name_2_id(), load_config(), and update_route_data().


Generated on Mon May 21 18:00:38 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6