save.c File Reference

SIP registrar module - Process REGISTER request and send reply. More...

#include "../../str.h"
#include "../../socket_info.h"
#include "../../parser/parse_allow.h"
#include "../../parser/parse_methods.h"
#include "../../parser/msg_parser.h"
#include "../../parser/parse_uri.h"
#include "../../dprint.h"
#include "../../trim.h"
#include "../../ut.h"
#include "../../qvalue.h"
#include "../../dset.h"
#include "../../mod_fix.h"
#include "../../cmpapi.h"
#include "../usrloc/usrloc.h"
#include "common.h"
#include "sip_msg.h"
#include "rerrno.h"
#include "reply.h"
#include "reg_mod.h"
#include "regtime.h"
#include "path.h"
#include "save.h"

Include dependency graph for save.c:

Go to the source code of this file.

Defines

#define is_cflag_set(_name)   (((unsigned int)(unsigned long)_cflags)&(_name))
 Process REGISTER request and save it's contacts.

Functions

static int add_contacts (struct sip_msg *_m, contact_t *_c, udomain_t *_d, str *_a, int _mode)
 This function will process request that contained some contact header fields.
static struct socket_infoget_sock_hdr (struct sip_msg *msg)
static int insert_contacts (struct sip_msg *_m, contact_t *_c, udomain_t *_d, str *_a)
 Message contained some contacts, but record with same address of record was not found so we have to create a new record and insert all contacts from the message that have expires > 0.
static int no_contacts (udomain_t *_d, str *_a)
 Process request that contained no contact header field, it means that we have to send back a response containing a list of all existing bindings for the given username (in To HF).
static ucontact_info_tpack_ci (struct sip_msg *_m, contact_t *_c, unsigned int _e, unsigned int _f)
 Fills the common part (for all contacts) of the info structure.
int save (struct sip_msg *_m, char *_d, char *_cflags)
 Process REGISTER request and save it's contacts.
static int star (udomain_t *_d, str *_a)
 Process request that contained a star, in that case, we will remove all bindings with the given username from the usrloc and return 200 OK response.
static int test_max_contacts (struct sip_msg *_m, urecord_t *_r, contact_t *_c, ucontact_info_t *ci)
int unregister (struct sip_msg *_m, char *_d, char *_uri)
static int update_contacts (struct sip_msg *_m, urecord_t *_r, contact_t *_c, int _mode)
 Message contained some contacts and appropriate record was found, so we have to walk through all contacts and do the following: 1) If contact in usrloc doesn't exists and expires > 0, insert new contact 2) If contact in usrloc exists and expires > 0, update the contact 3) If contact in usrloc exists and expires == 0, delete contact.

Variables

static int mem_only = 0


Detailed Description

SIP registrar module - Process REGISTER request and send reply.

Definition in file save.c.


Define Documentation

#define is_cflag_set ( _name   )     (((unsigned int)(unsigned long)_cflags)&(_name))

Process REGISTER request and save it's contacts.

Definition at line 720 of file save.c.

Referenced by save().


Function Documentation

static int add_contacts ( struct sip_msg _m,
contact_t _c,
udomain_t _d,
str _a,
int  _mode 
) [inline, static]

This function will process request that contained some contact header fields.

Definition at line 682 of file save.c.

References build_contact(), urecord::contacts, usrloc_api::get_urecord, insert_contacts(), LM_ERR, usrloc_api::lock_udomain, R_UL_GET_R, usrloc_api::release_urecord, rerrno, ul, usrloc_api::unlock_udomain, and update_contacts().

Referenced by save().

static struct socket_info* get_sock_hdr ( struct sip_msg msg  )  [static, read]

static int insert_contacts ( struct sip_msg _m,
contact_t _c,
udomain_t _d,
str _a 
) [inline, static]

static int no_contacts ( udomain_t _d,
str _a 
) [inline, static]

Process request that contained no contact header field, it means that we have to send back a response containing a list of all existing bindings for the given username (in To HF).

Definition at line 176 of file save.c.

References build_contact(), urecord::contacts, usrloc_api::get_urecord, LM_ERR, usrloc_api::lock_udomain, R_UL_GET_R, usrloc_api::release_urecord, rerrno, ul, and usrloc_api::unlock_udomain.

Referenced by save().

static ucontact_info_t* pack_ci ( struct sip_msg _m,
contact_t _c,
unsigned int  _e,
unsigned int  _f 
) [inline, static]

int save ( struct sip_msg _m,
char *  _d,
char *  _cflags 
)

static int star ( udomain_t _d,
str _a 
) [inline, static]

Process request that contained a star, in that case, we will remove all bindings with the given username from the usrloc and return 200 OK response.

Definition at line 81 of file save.c.

References build_contact(), urecord::contacts, usrloc_api::delete_urecord, FL_MEM, ucontact::flags, usrloc_api::get_urecord, LM_ERR, usrloc_api::lock_udomain, mem_only, ucontact::next, NULL, R_UL_DEL_R, usrloc_api::release_urecord, rerrno, ul, and usrloc_api::unlock_udomain.

Referenced by save(), and unregister().

static int test_max_contacts ( struct sip_msg _m,
urecord_t _r,
contact_t _c,
ucontact_info_t ci 
) [static]

int unregister ( struct sip_msg _m,
char *  _d,
char *  _uri 
)

Definition at line 773 of file save.c.

References extract_aor(), fixup_get_svalue(), _str::len, LM_ERR, _str::s, and star().

static int update_contacts ( struct sip_msg _m,
urecord_t _r,
contact_t _c,
int  _mode 
) [inline, static]

Message contained some contacts and appropriate record was found, so we have to walk through all contacts and do the following: 1) If contact in usrloc doesn't exists and expires > 0, insert new contact 2) If contact in usrloc exists and expires > 0, update the contact 3) If contact in usrloc exists and expires == 0, delete contact.

Definition at line 525 of file save.c.

References act_time, urecord::aor, calc_contact_expires(), ucontact_info::callid, urecord::contacts, ucontact_info::cseq, usrloc_api::delete_ucontact, contact::expires, FL_MEM, ucontact::flags, sip_msg::flags, force_tcp_conn_lifetime(), get_next_contact(), usrloc_api::get_ucontact, usrloc_api::insert_ucontact, _str::len, LM_ERR, LM_WARN, max_contacts, mem_only, ucontact::next, pack_ci(), parse_uri(), sip_uri::proto, receive_info::proto, PROTO_TCP, PROTO_TLS, R_INV_CSEQ, R_UL_DEL_C, R_UL_INS_C, R_UL_UPD_C, sip_msg::rcv, rerrno, _str::s, tcp_persistent_flag, test_max_contacts(), ul, usrloc_api::update_ucontact, updated, and contact::uri.

Referenced by add_contacts().


Variable Documentation

int mem_only = 0 [static]

Definition at line 74 of file save.c.

Referenced by insert_contacts(), save(), star(), and update_contacts().


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