#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"

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_info * | get_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_t * | pack_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 |
Definition in file save.c.
| #define is_cflag_set | ( | _name | ) | (((unsigned int)(unsigned long)_cflags)&(_name)) |
| 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] |
Definition at line 124 of file save.c.
References hdr_field::body, cmp_hdrname_str(), grep_sock_info(), HDR_EOH_F, sip_msg::headers, _str::len, LM_DBG, LM_ERR, hdr_field::name, hdr_field::next, parse_headers(), parse_phostport(), port, port_no, _str::s, sock, sock_hdr_name, and trim_len.
Referenced by pack_ci().
| static int insert_contacts | ( | struct sip_msg * | _m, | |
| contact_t * | _c, | |||
| udomain_t * | _d, | |||
| str * | _a | |||
| ) | [inline, static] |
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.
Definition at line 359 of file save.c.
References act_time, build_contact(), calc_contact_expires(), ucontact_info::callid, urecord::contacts, ucontact_info::cseq, usrloc_api::delete_urecord, contact::expires, sip_msg::expires, sip_msg::flags, force_tcp_conn_lifetime(), get_next_contact(), usrloc_api::get_ucontact, usrloc_api::insert_ucontact, usrloc_api::insert_urecord, _str::len, LM_ERR, LM_INFO, LM_WARN, max_contacts, mem_only, pack_ci(), parse_uri(), sip_uri::proto, receive_info::proto, PROTO_TCP, PROTO_TLS, R_TOO_MANY, R_UL_INS_C, R_UL_NEW_R, R_UL_UPD_C, sip_msg::rcv, usrloc_api::release_urecord, rerrno, _str::s, tcp_persistent_flag, ul, usrloc_api::update_ucontact, and contact::uri.
Referenced by add_contacts().
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] |
Fills the common part (for all contacts) of the info structure.
Definition at line 203 of file save.c.
References act_time, ALL_METHODS, receive_info::bind_address, param::body, hdr_field::body, build_path_vector(), calc_contact_q(), ucontact_info::callid, sip_msg::callid, CALLID_MAX_SIZE, ucontact_info::cflags, ucontact_info::cseq, ucontact_info::expires, ucontact_info::flags, sip_msg::flags, get_allow_methods, get_cseq, get_sock_hdr(), getb0flags(), HDR_USERAGENT_F, ucontact_info::last_modified, _str::len, LM_ERR, ucontact_info::methods, contact::methods, int_str::n, usrloc_api::nat_flag, parse_allow(), parse_headers(), parse_methods(), ucontact_info::path, path_enabled, ucontact_info::q, contact::q, R_CALLID_LEN, R_CONTACT_LEN, R_INV_CSEQ, R_INV_Q, R_PARSE, R_PARSE_PATH, sip_msg::rcv, rcv_avp_name, rcv_avp_type, contact::received, ucontact_info::received, RECEIVED_MAX_SIZE, rerrno, int_str::s, _str::s, search_first_avp(), set_path_vector(), ucontact_info::sock, sock_flag, str2int(), str_init, trim_trailing(), UA_MAX_SIZE, ul, ucontact_info::user_agent, and sip_msg::user_agent.
Referenced by insert_contacts(), and update_contacts().
| int save | ( | struct sip_msg * | _m, | |
| char * | _d, | |||
| char * | _cflags | |||
| ) |
Process REGISTER request and save it's contacts.
Definition at line 721 of file save.c.
References accepted_registrations, add_contacts(), check_contacts(), extract_aor(), FL_MEM, FL_NONE, get_act_time(), get_first_contact(), get_to, is_cflag_set, LM_ERR, mem_only, mode, no_contacts(), parse_message(), R_FINE, REG_SAVE_MEM_FL, REG_SAVE_NORPL_FL, REG_SAVE_REPL_FL, rejected_registrations, REQUEST_ROUTE, rerrno, route_type, send_reply(), star(), and update_stat.
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] |
Definition at line 465 of file save.c.
References act_time, urecord::aor, calc_contact_expires(), ucontact_info::callid, urecord::contacts, ucontact_info::cseq, contact::expires, get_next_contact(), usrloc_api::get_ucontact, _str::len, LM_DBG, LM_ERR, LM_INFO, max_contacts, ucontact::next, R_INV_CSEQ, R_TOO_MANY, rerrno, _str::s, ul, contact::uri, and VALID_CONTACT.
Referenced by update_contacts().
| 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().
int mem_only = 0 [static] |
Definition at line 74 of file save.c.
Referenced by insert_contacts(), save(), star(), and update_contacts().
1.5.6