group.c File Reference

Group membership module

More...

#include <string.h>
#include "../../dprint.h"
#include "../../db/db.h"
#include "../../ut.h"
#include "../../parser/digest/digest.h"
#include "../../parser/hf.h"
#include "../../parser/parse_from.h"
#include "../../parser/parse_uri.h"
#include "group.h"
#include "group_mod.h"

Include dependency graph for group.c:

Go to the source code of this file.

Functions

int get_username_domain (struct sip_msg *msg, group_check_p gcp, str *username, str *domain)
 Extract the username and domain from the SIP message.
int group_db_bind (const str *db_url)
 Bind the DB connection.
void group_db_close (void)
 Close the DB connection.
int group_db_init (const str *db_url)
 Initialize the DB connection.
int is_user_in (struct sip_msg *_msg, char *_hf, char *_grp)
 Check if username in specified header field is in a table.


Detailed Description

Group membership module

Definition in file group.c.


Function Documentation

int get_username_domain ( struct sip_msg msg,
group_check_p  gcp,
str username,
str domain 
)

Extract the username and domain from the SIP message.

Set the username and domain depending on the value of the SIP message and the group check structure.

Parameters:
msg SIP message
gcp group check structure
username stored username
domain stored domain
Returns:
0 on success, -1 on failure

Definition at line 59 of file group.c.

References sip_msg::authorization, auth_body::digest, _pv_value::flags, get_authorized_cred(), GET_REALM, sip_uri::host, _group_check::id, _str::len, LM_ERR, NULL, parse_from_uri(), parse_sip_msg_uri(), parse_to_uri(), parse_uri(), hdr_field::parsed, sip_msg::parsed_uri, sip_msg::proxy_auth, pv_get_spec_value(), PV_VAL_NULL, _pv_value::rs, _str::s, _group_check::sp, username::user, sip_uri::user, and dig_cred::username.

Referenced by get_user_group(), and is_user_in().

int group_db_bind ( const str db_url  ) 

Bind the DB connection.

Parameters:
db_url database URL
Returns:
0 on success, -1 on failure

Definition at line 220 of file group.c.

References db_bind_mod(), DB_CAP_QUERY, DB_CAPABILITY, group_dbf, and LM_ERR.

Referenced by mod_init().

void group_db_close ( void   ) 

Close the DB connection.

Definition at line 239 of file group.c.

References db_func::close, group_dbf, and group_dbh.

Referenced by destroy(), and mod_init().

int group_db_init ( const str db_url  ) 

Initialize the DB connection.

Parameters:
db_url database URL
Returns:
0 on success, -1 on failure

Definition at line 198 of file group.c.

References group_dbf, group_dbh, db_func::init, LM_CRIT, and LM_ERR.

Referenced by child_init(), and mod_init().

int is_user_in ( struct sip_msg _msg,
char *  _hf,
char *  _grp 
)

Check if username in specified header field is in a table.

Parameters:
_msg SIP message
_hf Header field
_grp checked table
Returns:
1 on success, negative on failure

Definition at line 140 of file group.c.

References DB_STR, domain_column, db_func::free_result, get_username_domain(), group_column, group_dbf, group_dbh, len, LM_DBG, LM_ERR, NULL, db_func::query, RES_ROW_N, s, table, use_domain, db_func::use_table, user_column, VAL_NULL, VAL_STR, VAL_TYPE, vals, and ZSW.


Generated on Wed May 23 06:01:03 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6