reply.c File Reference

SIP registrar module - Send a reply. More...

#include <stdio.h>
#include "../../ut.h"
#include "../../parser/msg_parser.h"
#include "../../parser/parse_supported.h"
#include "../../data_lump_rpl.h"
#include "../usrloc/usrloc.h"
#include "rerrno.h"
#include "reg_mod.h"
#include "regtime.h"
#include "reply.h"

Include dependency graph for reply.c:

Go to the source code of this file.

Defines

#define CONTACT_BEGIN   "Contact: "
#define CONTACT_BEGIN_LEN   (sizeof(CONTACT_BEGIN) - 1)
#define CONTACT_SEP   ", "
#define CONTACT_SEP_LEN   (sizeof(CONTACT_SEP) - 1)
#define E_INFO   "P-Registrar-Error: "
#define E_INFO_LEN   (sizeof(E_INFO) - 1)
#define EI_R_AOR_LEN   "Address Of Record too long"
#define EI_R_AOR_PARSE   "Error while parsing AOR"
#define EI_R_CALLID_LEN   "Callid too long"
#define EI_R_CID_MISS   "Call-ID header not found"
#define EI_R_CONTACT_LEN   "Contact/received too long"
#define EI_R_CS_MISS   "CSeq header not found"
#define EI_R_FINE   "No problem"
#define EI_R_INV_CSEQ   "Invalid CSeq number"
#define EI_R_INV_EXP   "Invalid expires param in contact"
#define EI_R_INV_Q   "Invalid q param in contact"
#define EI_R_OOO   "Out of order request"
#define EI_R_PARSE   "Message parse error"
#define EI_R_PARSE_CONT   "Contact parse error"
#define EI_R_PARSE_EXP   "Expires parse error"
#define EI_R_PARSE_PATH   "Path parse error"
#define EI_R_PATH_UNSUP   "No support for found Path indicated"
#define EI_R_RETRANS   "Retransmission"
#define EI_R_STAR_CONT   "* used in contact and more than 1 contact"
#define EI_R_STAR_EXP   "* used in contact and expires is not zero"
#define EI_R_TO_MISS   "To header not found"
#define EI_R_TO_USER   "No username in To URI"
#define EI_R_TOO_MANY   "Too many registered contacts"
#define EI_R_UL_DEL_C   "usrloc_contact_delete failed"
#define EI_R_UL_DEL_R   "usrloc_record_delete failed"
#define EI_R_UL_GET_R   "usrloc_record_get failed"
#define EI_R_UL_INS_C   "usrloc_contact_insert failed"
#define EI_R_UL_INS_R   "usrloc_record_insert failed"
#define EI_R_UL_NEW_R   "usrloc_record_new failed"
#define EI_R_UL_UPD_C   "usrloc_contact_update failed"
#define EI_R_UNESCAPE   "Error while unescaping username"
#define EXPIRES_PARAM   ";expires="
#define EXPIRES_PARAM_LEN   (sizeof(EXPIRES_PARAM) - 1)
#define MAX_CONTACT_BUFFER   1024
#define MSG_200   "OK"
#define MSG_400   "Bad Request"
#define MSG_420   "Bad Extension"
#define MSG_500   "Server Internal Error"
#define MSG_503   "Service Unavailable"
#define PATH   "Path: "
#define PATH_LEN   (sizeof(PATH) - 1)
#define Q_PARAM   ";q="
#define Q_PARAM_LEN   (sizeof(Q_PARAM) - 1)
#define RETRY_AFTER   "Retry-After: "
#define RETRY_AFTER_LEN   (sizeof(RETRY_AFTER) - 1)
#define UNSUPPORTED   "Unsupported: "
#define UNSUPPORTED_LEN   (sizeof(UNSUPPORTED) - 1)

Functions

static int add_path (struct sip_msg *_m, str *_p)
static int add_retry_after (struct sip_msg *_m)
static int add_unsupported (struct sip_msg *_m, str *_p)
int build_contact (ucontact_t *c)
 Allocate a memory buffer and print Contact header fields into it.
static unsigned int calc_buf_len (ucontact_t *c)
 Calculate the length of buffer needed to print contacts.
void free_contact_buf (void)
 Release contact buffer if any.
int send_reply (struct sip_msg *_m)
 Send a reply.

Variables

int codes []
struct {
   char *   buf
   int   buf_len
   int   data_len
contact
 Buffer for Contact header field.
str error_info []


Detailed Description

SIP registrar module - Send a reply.

Definition in file reply.c.


Define Documentation

#define CONTACT_BEGIN   "Contact: "

Definition at line 55 of file reply.c.

Referenced by build_contact().

#define CONTACT_BEGIN_LEN   (sizeof(CONTACT_BEGIN) - 1)

Definition at line 56 of file reply.c.

Referenced by build_contact(), and calc_buf_len().

#define CONTACT_SEP   ", "

Definition at line 64 of file reply.c.

Referenced by build_contact().

#define CONTACT_SEP_LEN   (sizeof(CONTACT_SEP) - 1)

Definition at line 65 of file reply.c.

Referenced by build_contact(), and calc_buf_len().

#define E_INFO   "P-Registrar-Error: "

Definition at line 52 of file reply.c.

Referenced by send_reply().

#define E_INFO_LEN   (sizeof(E_INFO) - 1)

Definition at line 53 of file reply.c.

Referenced by send_reply().

#define EI_R_AOR_LEN   "Address Of Record too long"

Definition at line 213 of file reply.c.

#define EI_R_AOR_PARSE   "Error while parsing AOR"

Definition at line 214 of file reply.c.

#define EI_R_CALLID_LEN   "Callid too long"

Definition at line 230 of file reply.c.

#define EI_R_CID_MISS   "Call-ID header not found"

Definition at line 219 of file reply.c.

#define EI_R_CONTACT_LEN   "Contact/received too long"

Definition at line 229 of file reply.c.

#define EI_R_CS_MISS   "CSeq header not found"

Definition at line 220 of file reply.c.

#define EI_R_FINE   "No problem"

Definition at line 203 of file reply.c.

#define EI_R_INV_CSEQ   "Invalid CSeq number"

Definition at line 207 of file reply.c.

#define EI_R_INV_EXP   "Invalid expires param in contact"

Definition at line 215 of file reply.c.

#define EI_R_INV_Q   "Invalid q param in contact"

Definition at line 216 of file reply.c.

#define EI_R_OOO   "Out of order request"

Definition at line 225 of file reply.c.

#define EI_R_PARSE   "Message parse error"

Definition at line 217 of file reply.c.

#define EI_R_PARSE_CONT   "Contact parse error"

Definition at line 222 of file reply.c.

#define EI_R_PARSE_EXP   "Expires parse error"

Definition at line 221 of file reply.c.

#define EI_R_PARSE_PATH   "Path parse error"

Definition at line 231 of file reply.c.

#define EI_R_PATH_UNSUP   "No support for found Path indicated"

Definition at line 232 of file reply.c.

#define EI_R_RETRANS   "Retransmission"

Definition at line 226 of file reply.c.

#define EI_R_STAR_CONT   "* used in contact and more than 1 contact"

Definition at line 224 of file reply.c.

#define EI_R_STAR_EXP   "* used in contact and expires is not zero"

Definition at line 223 of file reply.c.

#define EI_R_TO_MISS   "To header not found"

Definition at line 218 of file reply.c.

#define EI_R_TO_USER   "No username in To URI"

Definition at line 212 of file reply.c.

#define EI_R_TOO_MANY   "Too many registered contacts"

Definition at line 228 of file reply.c.

#define EI_R_UL_DEL_C   "usrloc_contact_delete failed"

Definition at line 210 of file reply.c.

#define EI_R_UL_DEL_R   "usrloc_record_delete failed"

Definition at line 204 of file reply.c.

#define EI_R_UL_GET_R   "usrloc_record_get failed"

Definition at line 205 of file reply.c.

#define EI_R_UL_INS_C   "usrloc_contact_insert failed"

Definition at line 208 of file reply.c.

#define EI_R_UL_INS_R   "usrloc_record_insert failed"

Definition at line 209 of file reply.c.

#define EI_R_UL_NEW_R   "usrloc_record_new failed"

Definition at line 206 of file reply.c.

#define EI_R_UL_UPD_C   "usrloc_contact_update failed"

Definition at line 211 of file reply.c.

#define EI_R_UNESCAPE   "Error while unescaping username"

Definition at line 227 of file reply.c.

#define EXPIRES_PARAM   ";expires="

Definition at line 61 of file reply.c.

Referenced by build_contact().

#define EXPIRES_PARAM_LEN   (sizeof(EXPIRES_PARAM) - 1)

Definition at line 62 of file reply.c.

Referenced by build_contact(), and calc_buf_len().

#define MAX_CONTACT_BUFFER   1024

Definition at line 50 of file reply.c.

#define MSG_200   "OK"

Definition at line 197 of file reply.c.

Referenced by send_reply().

#define MSG_400   "Bad Request"

Definition at line 198 of file reply.c.

Referenced by send_reply().

#define MSG_420   "Bad Extension"

Definition at line 199 of file reply.c.

Referenced by send_reply().

#define MSG_500   "Server Internal Error"

Definition at line 200 of file reply.c.

Referenced by send_reply().

#define MSG_503   "Service Unavailable"

Definition at line 201 of file reply.c.

Referenced by send_reply().

#define PATH   "Path: "

Definition at line 325 of file reply.c.

Referenced by add_path().

#define PATH_LEN   (sizeof(PATH) - 1)

Definition at line 326 of file reply.c.

Referenced by add_path().

#define Q_PARAM   ";q="

Definition at line 58 of file reply.c.

#define Q_PARAM_LEN   (sizeof(Q_PARAM) - 1)

Definition at line 59 of file reply.c.

#define RETRY_AFTER   "Retry-After: "

Definition at line 303 of file reply.c.

Referenced by add_retry_after().

#define RETRY_AFTER_LEN   (sizeof(RETRY_AFTER) - 1)

Definition at line 304 of file reply.c.

Referenced by add_retry_after().

#define UNSUPPORTED   "Unsupported: "

Definition at line 345 of file reply.c.

Referenced by add_unsupported().

#define UNSUPPORTED_LEN   (sizeof(UNSUPPORTED) - 1)

Definition at line 346 of file reply.c.

Referenced by add_unsupported().


Function Documentation

static int add_path ( struct sip_msg _m,
str _p 
) [static]

static int add_retry_after ( struct sip_msg _m  )  [static]

static int add_unsupported ( struct sip_msg _m,
str _p 
) [static]

int build_contact ( ucontact_t c  ) 

static unsigned int calc_buf_len ( ucontact_t c  )  [inline, static]

Calculate the length of buffer needed to print contacts.

Definition at line 82 of file reply.c.

References act_time, ucontact::c, CONTACT_BEGIN_LEN, CONTACT_SEP_LEN, CRLF_LEN, EXPIRES_PARAM_LEN, INT2STR_MAX_LEN, _str::len, len, len_q(), ucontact::next, ucontact::q, Q_PARAM_LEN, rcv_param, ucontact::received, _str::s, and VALID_CONTACT.

Referenced by build_contact().

void free_contact_buf ( void   ) 

Release contact buffer if any.

Definition at line 440 of file reply.c.

References pkg_free.

Referenced by mod_destroy().

int send_reply ( struct sip_msg _m  ) 


Variable Documentation

char* buf

Definition at line 72 of file reply.c.

Referenced by _reply(), AAAPrintMessage(), add_dlg_rr_param(), add_event(), add_maxfwd_header(), add_path(), add_retry_after(), add_unsupported(), alter_mediaip(), alter_mediaport(), alter_rtcp(), ap_cvt(), bdb_is_database(), bdblib_log(), bla_handle_notify(), build_path_vector(), build_pidf(), build_req_buf_from_sip_req(), build_res_buf_from_sip_req(), build_res_buf_from_sip_res(), build_sipping(), build_uac_req(), clen_builder(), conf_show(), constr_multipart_body(), create_rcv_uri(), db_key(), db_oracle_new_connection(), dbt_is_database(), dbt_load_file(), decode_from(), decode_mail_url(), decode_uri_sip_xmpp(), decode_uri_xmpp_sip(), do_replace_body_f(), encode_from(), encode_uri_sip_xmpp(), encode_uri_xmpp_sip(), encodeCPL(), event_parser(), fix_nated_contact_f(), fix_nated_sdp_f(), FixContact(), forward_request(), generate_string(), get_name(), get_node_selector(), handle_publish(), id_builder(), insert_element(), mi_parse_tree(), mi_write_tree(), net_printf(), net_read_static(), nh_timer(), pres_process_body(), print_stats_info(), print_uac_request(), publ_build_hdr(), publ_send200ok(), put_command(), pv_printf_s(), q2str(), received_builder(), relay_reply(), replace_all_f(), replace_element(), replace_from(), resource_subscriptions(), rewrite_uri(), rport_builder(), send_as_sms(), send_http_get(), send_reply(), send_rtpp_command(), set_body_f(), set_rpl_body_f(), sl_send_reply_helper(), socket2str(), stream_node_callback(), subs_build_hdr(), t_uac_cancel(), timer_send_notify(), tlsops_alt(), tlsops_bits(), tlsops_cert_version(), tlsops_cipher(), tlsops_comp(), tlsops_desc(), tlsops_sn(), tlsops_validity(), tlsops_version(), update_filter(), use_media_proxy(), verify_callback(), warning_builder(), xj_send_sip_msg(), xmpp_component_child_process(), xmpp_send_sip_msg(), xmpp_server_child_process(), xode_from_file(), xr_build_response(), and xr_build_response_array().

int buf_len

int codes[]

Definition at line 268 of file reply.c.

struct { ... } contact [static]

Buffer for Contact header field.

int data_len

Definition at line 74 of file reply.c.

Definition at line 234 of file reply.c.


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