re_group.c File Reference

Group membership module

More...

#include <sys/types.h>
#include <regex.h>
#include "../../str.h"
#include "../../mem/mem.h"
#include "../../route_struct.h"
#include "group_mod.h"
#include "re_group.h"
#include "group.h"

Include dependency graph for re_group.c:

Go to the source code of this file.

Data Structures

struct  re_grp

Functions

static int add_re (const char *re, int gid)
 Create a group regexp and add it to the list.
int get_user_group (struct sip_msg *req, char *user, char *avp)
 Get the user group and compare to the regexp list.
int load_re (str *table)
 Load regular expression rules from a database.

Variables

static struct re_grpre_list = 0


Detailed Description

Group membership module

Definition in file re_group.c.


Function Documentation

static int add_re ( const char *  re,
int  gid 
) [static]

Create a group regexp and add it to the list.

Parameters:
re regular expression string
gid group ID
Returns:
0 on success, -1 on failure

Definition at line 61 of file re_group.c.

References re_grp::gid, LM_DBG, LM_ERR, int_str::n, re_grp::next, pkg_free, pkg_malloc, and re_grp::re.

Referenced by load_re().

int get_user_group ( struct sip_msg req,
char *  user,
char *  avp 
)

Get the user group and compare to the regexp list.

Parameters:
req SIP message
user user string
avp AVP value
Returns:
number of all matches (positive), -1 on errors or when not found

Definition at line 154 of file re_group.c.

References domain, EQ_T, _pv_value::flags, get_username_domain(), re_grp::gid, _str::len, LM_DBG, LM_ERR, MAX_URI_SIZE, multiple_gid, int_str::n, re_grp::next, NULL, PV_TYPE_INT, PV_VAL_INT, _pv_spec::pvp, re_grp::re, _pv_value::ri, _str::s, and _pv_spec::setf.

int load_re ( str table  ) 

Load regular expression rules from a database.

Parameters:
table DB table
Returns:
0 on success, -1 on failure

Definition at line 96 of file re_group.c.

References add_re(), DB_INT, DB_STRING, db_func::free_result, group_dbf, group_dbh, db_val_t::int_val, LM_DBG, LM_ERR, db_val_t::nul, NULL, db_func::query, re_exp_column, re_gid_column, RES_ROW_N, db_res::rows, _str::s, db_val_t::string_val, db_val_t::type, db_func::use_table, db_val_t::val, and db_row::values.

Referenced by mod_init().


Variable Documentation

struct re_grp* re_list = 0 [static]

global regexp list

Definition at line 52 of file re_group.c.


Generated on Thu May 24 10:00:42 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6