Enumerations | Functions | Variables

conf.c File Reference

SIP-router utils ::Module: utils. More...

#include "conf.h"
#include "../../mem/mem.h"
#include "../../mem/shm_mem.h"
#include "../../sr_module.h"
#include "../../proxy.h"
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
Include dependency graph for conf.c:

Go to the source code of this file.

Enumerations

Functions

Variables


Detailed Description

Definition in file conf.c.


Function Documentation

int conf_init ( int  max_id  ) 
Parameters:
max_id number of configuration statements
Returns:
0 on success, -1 on failure

Definition at line 548 of file conf.c.

struct proxy_l* conf_needs_forward ( struct sip_msg msg,
int  id 
) [read]
Parameters:
msg the SIP message to be forwarded
id use configuration with this ID when checking
Returns:
pointer to proxy structure of destination if forwarding is needed, NULL otherwise

Definition at line 517 of file conf.c.

References filter_methods_contains_request(), sip_msg::first_line, and sfilter_mask.

Referenced by utils_forward().

Here is the call graph for this function:

Here is the caller graph for this function:

int conf_parse_filter ( char *  settings  ) 
Parameters:
settings The configuration string in the following form:

 *              <id>=<filter>[:<filter>]...[,<id>=<filter>[:<filter>]...]...
Returns:
1 on success, -1 otherwise

Definition at line 405 of file conf.c.

References conf_str2id(), remove_spaces(), and update_filter().

Referenced by forward_fifo_filter().

Here is the call graph for this function:

Here is the caller graph for this function:

int conf_parse_proxy ( char *  settings  ) 
Parameters:
settings,: The configuration string in the following form:

 *              <id>=<host>:<port>[,<id>=<host>:<port>]...
Returns:
: 1 on success, -1 otherwise

Definition at line 450 of file conf.c.

References conf_str2id(), remove_spaces(), and update_proxy().

Referenced by forward_fifo_proxy().

Here is the call graph for this function:

Here is the caller graph for this function:

int conf_parse_switch ( char *  settings  ) 
Parameters:
settings the configuration string in the following form:

 *              <id>=<switch>[,<id>=<switch>]...
Returns:
1 on success, -1 otherwise

Definition at line 303 of file conf.c.

References conf_str2id(), remove_spaces(), and update_switch().

Referenced by forward_fifo_switch().

Here is the call graph for this function:

Here is the caller graph for this function:

int conf_show ( struct mi_root *  rpl_tree  ) 
Parameters:
rpl_tree FIFO root
Returns:
0 on success, -1 on failure

Definition at line 345 of file conf.c.

References sfilter_mask, and sfilter_str.

Referenced by forward_fifo_list().

Here is the caller graph for this function:

int conf_str2id ( char *  id_str  ) 
Todo:
check if we can use the functions from ut.h params: id_str: ID as string to be converted to int. returns: >=0 on success -1 otherwise

Definition at line 124 of file conf.c.

References conf_str2int().

Referenced by conf_parse_filter(), conf_parse_proxy(), and conf_parse_switch().

Here is the call graph for this function:

Here is the caller graph for this function:

static int conf_str2int ( char *  s  )  [static]
Todo:
check if we can use the functions from ut.h params: s: The string to be converted to int. returns: >=0 on success -1 otherwise

Definition at line 99 of file conf.c.

Referenced by conf_str2id(), and update_proxy().

Here is the caller graph for this function:

static int filter_methods_contains_request ( int  id,
char *  method,
int  method_len 
) [static]
Parameters:
id use configuration with this ID when checking
method method string to be searched for
method_len length of method string
Returns:
1 if method is found in filter_methods, 0 otherwise

Definition at line 495 of file conf.c.

Referenced by conf_needs_forward().

Here is the caller graph for this function:

static void remove_spaces ( char *  s  )  [static]
Todo:
check if we can use the functions from ut.h Removes white spaces and new lines from s, the contents of s are modified.
Parameters:
s the string.

Definition at line 79 of file conf.c.

Referenced by conf_parse_filter(), conf_parse_proxy(), and conf_parse_switch().

Here is the caller graph for this function:

static int update_filter ( int  id,
char *  flist 
) [static]

Updates filter configuration. If filter_methods is not NULL, memory is freed. If filter methods are found, memory for the string is allocated, otherwise filter_methods is set to NULL.

Parameters:
id update the configuration with this ID.
flist a list of filter names.
Returns:
0 on success, -1 otherwise

Definition at line 173 of file conf.c.

References sfilter_mask, and sfilter_str.

Referenced by conf_parse_filter().

Here is the caller graph for this function:

static int update_proxy ( int  id,
char *  host_str,
char *  port_str 
) [static]
Parameters:
id update the configuration with this ID.
host_str the destination host.
port_str the port number as string.
Returns:
0 on success, -1 otherwise

Definition at line 243 of file conf.c.

References conf_str2int(), _str::len, and _str::s.

Referenced by conf_parse_proxy().

Here is the call graph for this function:

Here is the caller graph for this function:

static int update_switch ( int  id,
char *  param_str 
) [static]
Parameters:
id Update the configuration with this ID.
param_str can be either "off" or "on".
Returns:
0 on success, -1 otherwise

Definition at line 143 of file conf.c.

Referenced by conf_parse_switch().

Here is the caller graph for this function: