registrar/sip_msg.c File Reference

SIP registrar module - SIP message related functions. More...

#include "../../parser/hf.h"
#include "../../dprint.h"
#include "../../parser/parse_expires.h"
#include "../../ut.h"
#include "../../qvalue.h"
#include "reg_mod.h"
#include "regtime.h"
#include "rerrno.h"
#include "sip_msg.h"

Include dependency graph for registrar/sip_msg.c:

Go to the source code of this file.

Functions

void calc_contact_expires (struct sip_msg *_m, param_t *_ep, int *_e)
 Calculate absolute expires value per contact as follows: 1) If the contact has expires value, use the value. If it is not zero, add actual time to it 2) If the contact has no expires parameter, use expires header field in the same way 3) If the message contained no expires header field, use the default value.
int calc_contact_q (param_t *_q, qvalue_t *_r)
 Calculate contact q value as follows: 1) If q parameter exists, use it 2) If the parameter doesn't exist, use the default value.
int check_contacts (struct sip_msg *_m, int *_s)
 Check if the originating REGISTER message was formed correctly The whole message must be parsed before calling the function _s indicates whether the contact was star.
static int get_expires_hf (struct sip_msg *_m)
 Return value of Expires header field if the HF exists converted to absolute time, if the HF doesn't exist, returns default value;.
contact_tget_first_contact (struct sip_msg *_m)
 Get the first contact in message.
contact_tget_next_contact (contact_t *_c)
 Get next contact in message.
int parse_message (struct sip_msg *_m)
 Parse the whole message and bodies of all header fields that will be needed by registrar.

Variables

static struct hdr_fieldact_contact


Detailed Description

SIP registrar module - SIP message related functions.

Definition in file registrar/sip_msg.c.


Function Documentation

void calc_contact_expires ( struct sip_msg _m,
param_t _ep,
int *  _e 
)

Calculate absolute expires value per contact as follows: 1) If the contact has expires value, use the value. If it is not zero, add actual time to it 2) If the contact has no expires parameter, use expires header field in the same way 3) If the message contained no expires header field, use the default value.

Definition at line 234 of file registrar/sip_msg.c.

References act_time, param::body, default_expires, get_expires_hf(), _str::len, max_expires, min_expires, and str2int().

Referenced by insert_contacts(), test_max_contacts(), and update_contacts().

int calc_contact_q ( param_t _q,
qvalue_t _r 
)

Calculate contact q value as follows: 1) If q parameter exists, use it 2) If the parameter doesn't exist, use the default value.

Calculate contact q value as follows: 1) If q parameter exist, use it 2) If the parameter doesn't exist, use default value.

Definition at line 261 of file registrar/sip_msg.c.

References param::body, default_q, _str::len, LM_ERR, R_INV_Q, rerrno, _str::s, and str2q().

Referenced by pack_ci().

int check_contacts ( struct sip_msg _m,
int *  _s 
)

Check if the originating REGISTER message was formed correctly The whole message must be parsed before calling the function _s indicates whether the contact was star.

Definition at line 131 of file registrar/sip_msg.c.

References sip_msg::contact, CONTACT_MAX_SIZE, get_expires_hf(), HDR_CONTACT_T, param::len, _str::len, contact::next, hdr_field::next, hdr_field::parsed, R_CONTACT_LEN, R_STAR_CONT, R_STAR_EXP, contact::received, RECEIVED_MAX_SIZE, rerrno, hdr_field::type, and contact::uri.

Referenced by save().

static int get_expires_hf ( struct sip_msg _m  )  [inline, static]

Return value of Expires header field if the HF exists converted to absolute time, if the HF doesn't exist, returns default value;.

Definition at line 53 of file registrar/sip_msg.c.

References act_time, default_expires, sip_msg::expires, hdr_field::parsed, exp_body::val, and exp_body::valid.

Referenced by calc_contact_expires(), and check_contacts().

contact_t* get_first_contact ( struct sip_msg _m  ) 

Get the first contact in message.

Definition at line 194 of file registrar/sip_msg.c.

References sip_msg::contact, and hdr_field::parsed.

Referenced by save().

contact_t* get_next_contact ( contact_t _c  ) 

int parse_message ( struct sip_msg _m  ) 

Parse the whole message and bodies of all header fields that will be needed by registrar.

Definition at line 74 of file registrar/sip_msg.c.

References sip_msg::callid, sip_msg::contact, sip_msg::cseq, sip_msg::expires, HDR_CONTACT_T, HDR_EOH_F, LM_ERR, hdr_field::next, parse_contact(), parse_expires(), parse_headers(), hdr_field::parsed, R_CID_MISS, R_CS_MISS, R_PARSE, R_PARSE_CONT, R_PARSE_EXP, R_TO_MISS, rerrno, sip_msg::to, and hdr_field::type.

Referenced by save().


Variable Documentation

struct hdr_field* act_contact [static]

Definition at line 44 of file registrar/sip_msg.c.


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