Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

msg_translator.h File Reference

#include "parser/msg_parser.h"
#include "ip_addr.h"

Go to the source code of this file.

Data Structures

struct  bookmark
struct  hostport

Defines

#define MY_HF_SEP   ": "
#define MY_HF_SEP_LEN   2
#define BRANCH_SEPARATOR   '.'
#define WARNING   "Warning: 392 "
#define WARNING_LEN   (sizeof(WARNING)-1)
#define WARNING_PHRASE   " \"Noisy feedback tells: "
#define WARNING_PHRASE_LEN   (sizeof(WARNING_PHRASE)-1)
#define set_hostport(hp, msg)

Functions

char * build_req_buf_from_sip_req (struct sip_msg *msg, unsigned int *returned_len, struct dest_info *send_info)
 builds a request in memory from another sip request.
char * build_res_buf_from_sip_res (struct sip_msg *msg, unsigned int *returned_len)
char * build_res_buf_from_sip_req (unsigned int code, char *text, str *new_tag, struct sip_msg *msg, unsigned int *returned_len, struct bookmark *bmark)
char * via_builder (unsigned int *len, struct dest_info *send_info, str *branch, str *extra_params, struct hostport *hp)
char * create_via_hf (unsigned int *len, struct sip_msg *msg, struct dest_info *send_info, str *branch)
int branch_builder (unsigned int hash_index, unsigned int label, char *char_v, int branch, char *branch_str, int *len)
char * id_builder (struct sip_msg *msg, unsigned int *id_len)
int received_test (struct sip_msg *msg)
char * build_only_headers (struct sip_msg *msg, int skip_first_line, unsigned int *returned_len, int *error, struct dest_info *send_info)
char * build_body (struct sip_msg *msg, unsigned int *returned_len, int *error, struct dest_info *send_info)
char * build_all (struct sip_msg *msg, int adjust_clen, unsigned int *returned_len, int *error, struct dest_info *send_info)
void fix_global_req_flags (str *gname, str *name)
 cfg framework fixup


Define Documentation

#define BRANCH_SEPARATOR   '.'
 

Definition at line 43 of file msg_translator.h.

Referenced by t_reply_matching().

#define MY_HF_SEP   ": "
 

Definition at line 40 of file msg_translator.h.

#define MY_HF_SEP_LEN   2
 

Definition at line 41 of file msg_translator.h.

#define set_hostport hp,
msg   ) 
 

Value:

do{ \
                if ((msg) && ((struct sip_msg*)(msg))->set_global_address.len) \
                        (hp)->host=&(((struct sip_msg*)(msg))->set_global_address); \
                else \
                        (hp)->host=&default_global_address; \
                if ((msg) && ((struct sip_msg*)(msg))->set_global_port.len) \
                        (hp)->port=&(((struct sip_msg*)(msg))->set_global_port); \
                else \
                        (hp)->port=&default_global_port; \
        }while(0)

Definition at line 66 of file msg_translator.h.

Referenced by assemble_via(), build_dlg_ack(), build_local(), and create_via_hf().

#define WARNING   "Warning: 392 "
 

Definition at line 44 of file msg_translator.h.

Referenced by warning_builder().

#define WARNING_LEN   (sizeof(WARNING)-1)
 

Definition at line 45 of file msg_translator.h.

Referenced by warning_builder().

#define WARNING_PHRASE   " \"Noisy feedback tells: "
 

Definition at line 46 of file msg_translator.h.

Referenced by warning_builder().

#define WARNING_PHRASE_LEN   (sizeof(WARNING_PHRASE)-1)
 

Definition at line 47 of file msg_translator.h.

Referenced by warning_builder().


Function Documentation

int branch_builder unsigned int  hash_index,
unsigned int  label,
char *  char_v,
int  branch,
char *  branch_str,
int len
 

Definition at line 2126 of file msg_translator.c.

References int2reverse_hex(), len, MAX_BRANCH_PARAM_LEN, MCOOKIE, MCOOKIE_LEN, MD5_LEN, and size.

Referenced by forward_request(), and t_calc_branch().

char* build_all struct sip_msg msg,
int  adjust_clen,
unsigned int returned_len,
int error,
struct dest_info send_info
 

Definition at line 2479 of file msg_translator.c.

References sip_msg::add_rm, adjust_clen(), sip_msg::body_lumps, sip_msg::buf, buf, L_ERR, sip_msg::len, len, LOG, lumps_len(), pkg_malloc, process_lumps(), and dest_info::proto.

char* build_body struct sip_msg msg,
unsigned int returned_len,
int error,
struct dest_info send_info
 

Definition at line 2428 of file msg_translator.c.

References sip_msg::body_lumps, sip_msg::buf, buf, get_body(), L_ERR, sip_msg::len, len, LOG, lumps_len(), pkg_malloc, and process_lumps().

Referenced by out_msgbody_proc().

char* build_only_headers struct sip_msg msg,
int  skip_first_line,
unsigned int returned_len,
int error,
struct dest_info send_info
 

Definition at line 2376 of file msg_translator.c.

References sip_msg::add_rm, sip_msg::buf, buf, sip_msg::headers, L_ERR, len, LOG, lumps_len(), hdr_field::name, pkg_malloc, process_lumps(), _str::s, and sip_msg::unparsed.

Referenced by out_contacthdr_proc().

char* build_req_buf_from_sip_req struct sip_msg msg,
unsigned int returned_len,
struct dest_info send_info
 

builds a request in memory from another sip request.

Side-effects: - it adds lumps to the msg which are _not_ cleaned. All the added lumps are HDR_VIA_T.

  • it might change send_info->proto and send_info->send_socket if proto fallback is enabled (see below).

Uses also global_req_flags ( OR'ed with msg->msg_flags, see send_info below).

Parameters:
msg - sip message structure, complete with lumps
returned_len - result length (filled in)
send_info - dest_info structure (value/result), contains where the packet will be sent to (it's needed for building a correct via, fill RR lumps a.s.o.). If MTU based protocol fall-back is enabled (see flags below), send_info->proto might be updated with the new protocol. msg->msg_flags used:
  • FL_TCP_MTU_FB, FL_TLS_MTU_FB and FL_SCTP_MTU_FB - fallback to the corresp. proto if the built message > mtu and send_info->proto==PROTO_UDP. It will also update send_info->proto.
  • FL_FORCE_RPORT: add rport to via
Returns:
pointer to the new request (pkg_malloc'ed, needs freeing when done) and sets returned_len or 0 on error.

Definition at line 1512 of file msg_translator.c.

References sip_msg::add_rm, sip_msg::add_to_branch_len, sip_msg::add_to_branch_s, adjust_clen(), anchor_lump(), sip_msg::body_lumps, sip_msg::buf, buf, cfg_get, core_cfg, create_via_hf(), del_lump(), sip_msg::first_line, FL_MTU_FB_MASK, flags, get_send_socket(), via_body::hdr, HDR_VIA_T, via_body::host, insert_new_lump_after(), insert_new_lump_before(), L_ERR, _str::len, sip_msg::len, len, LOG, lumps_len(), sip_msg::msg_flags, sip_msg::new_uri, via_body::params, pkg_free, pkg_malloc, via_body::port, via_body::port_str, process_lumps(), dest_info::proto, PROTO_SCTP, PROTO_TCP, PROTO_TLS, PROTO_UDP, via_body::received, received_builder(), received_test(), msg_start::request, via_body::rport, rport_builder(), _str::s, dest_info::send_sock, ser_error, via_param::size, size, via_param::start, str, dest_info::to, msg_start::u, unlikely, msg_start::uri, sip_msg::via1, and via_len.

Referenced by forward_request(), and print_uac_request().

char* build_res_buf_from_sip_req unsigned int  code,
char *  text,
str new_tag,
struct sip_msg msg,
unsigned int returned_len,
struct bookmark bmark
 

Definition at line 1823 of file msg_translator.c.

References append_str, append_str_trans, hdr_field::body, buf, CONTENT_LENGTH, CONTENT_LENGTH_LEN, CRLF, CRLF_LEN, sip_msg::first_line, lump_rpl::flags, get_to, sip_msg::h_via1, HDR_CALLID_T, HDR_CSEQ_T, HDR_EOH_F, HDR_FROM_T, HDR_RECORDROUTE_T, HDR_TO_T, HDR_VIA_T, sip_msg::headers, int2str(), L_CRIT, L_ERR, L_WARN, hdr_field::len, len, _str::len, LOG, sip_msg::msg_flags, hdr_field::name, lump_rpl::next, hdr_field::next, parse_headers(), hdr_field::parsed, pkg_free, pkg_malloc, received_builder(), received_test(), sip_msg::reply_lump, msg_start::request, via_body::rport, rport_builder(), _str::s, SERVER_HDR, SERVER_HDR_LEN, via_param::size, via_param::start, str, lump_rpl::text, bookmark::to_tag_val, TOTAG_TOKEN, TOTAG_TOKEN_LEN, hdr_field::type, msg_start::u, msg_start::version, sip_msg::via1, and warning_builder().

Referenced by _reply(), relay_reply(), reply_aggregate_auth(), sl_send_reply(), and t_reply_with_body().

char* build_res_buf_from_sip_res struct sip_msg msg,
unsigned int returned_len
 

Definition at line 1753 of file msg_translator.c.

References sip_msg::add_rm, adjust_clen(), hdr_field::body, sip_msg::body_lumps, via_body::bsize, sip_msg::buf, buf, DBG, del_lump(), sip_msg::h_via1, HDR_VIA_T, L_ERR, hdr_field::len, sip_msg::len, len, LOG, lumps_len(), hdr_field::name, via_body::next, pkg_malloc, process_lumps(), via_body::proto, PROTO_UDP, _str::s, sip_msg::via1, sip_msg::via2, and via_len.

Referenced by forward_reply(), and relay_reply().

char* create_via_hf unsigned int len,
struct sip_msg msg,
struct dest_info send_info,
str branch
 

Definition at line 2312 of file msg_translator.c.

References DBG, id_builder(), L_ERR, len, _str::len, LOG, pkg_free, receive_info::proto, sip_msg::rcv, _str::s, set_hostport, str, and via_builder().

Referenced by build_req_buf_from_sip_req().

void fix_global_req_flags str gname,
str name
 

cfg framework fixup

It should be called from the configuration framework.

Definition at line 165 of file msg_translator.c.

References cfg_get, core_cfg, global_req_flags, PROTO_NONE, PROTO_SCTP, PROTO_TCP, PROTO_TLS, PROTO_UDP, and str.

char* id_builder struct sip_msg msg,
unsigned int id_len
 

Definition at line 407 of file msg_translator.c.

References buf, ID_PARAM, ID_PARAM_LEN, int2reverse_hex(), L_CRIT, L_ERR, len, LOG, pkg_malloc, receive_info::proto_reserved1, sip_msg::rcv, ser_error, and size.

Referenced by build_local(), and create_via_hf().

int received_test struct sip_msg msg  ) 
 

Definition at line 257 of file msg_translator.c.

References check_via_address(), via_body::host, via_body::port, sip_msg::rcv, via_body::received, received_dns, receive_info::src_ip, and sip_msg::via1.

Referenced by build_req_buf_from_sip_req(), build_res_buf_from_sip_req(), nat_uac_test_f(), and testSourceAddress().

char* via_builder unsigned int len,
struct dest_info send_info,
str branch,
str extra_params,
struct hostport hp
 

Definition at line 2180 of file msg_translator.c.

References socket_info::address, socket_info::address_str, ip_addr::af, COMP_PARAM, COMP_PARAM_LEN, CRLF, CRLF_LEN, hostport::host, L_CRIT, L_ERR, len, _str::len, LOG, MY_BRANCH, MY_BRANCH_LEN, MY_VIA, MY_VIA_LEN, pkg_malloc, hostport::port, socket_info::port_no, socket_info::port_no_str, dest_info::proto, _str::s, dest_info::send_sock, ser_error, str, and via_len.

Referenced by assemble_via(), build_dlg_ack(), build_local(), create_via(), create_via_hf(), http_xmlrpc2sip(), and sip_ping_builder().


Generated on Thu Jul 29 04:16:05 2010 for SIPExpressRouter by  doxygen 1.3.9.1