Functions

msg_translator.c File Reference

SIP-router core ::Module: SIP-router core. More...

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "comp_defs.h"
#include "msg_translator.h"
#include "globals.h"
#include "error.h"
#include "mem/mem.h"
#include "dprint.h"
#include "config.h"
#include "md5utils.h"
#include "data_lump.h"
#include "data_lump_rpl.h"
#include "ip_addr.h"
#include "resolve.h"
#include "ut.h"
#include "pt.h"
#include "cfg/cfg.h"
#include "parser/parse_to.h"
#include "forward.h"
Include dependency graph for msg_translator.c:

Go to the source code of this file.

Functions


Detailed Description

Definition in file msg_translator.c.


Function Documentation

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

Side-effects: - it adds lumps to the msg which are _not_ cleaned. The added lumps are HDR_VIA_T (almost always added), HDR_CONTENLENGTH_T and HDR_ROUTE_T (when a Route: header is added as a result of a non-null msg->path_vec).

  • 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
mode - flags for building the message, can be a combination of: * BUILD_NO_LOCAL_VIA - don't add a local via * BUILD_NO_VIA1_UPDATE - don't update first via (rport, received a.s.o) * BUILD_NO_PATH - don't add a Route: header with the msg->path_vec content. * BUILD_IN_SHM - build the result in shm memory
Returns:
pointer to the new request (pkg_malloc'ed or shm_malloc'ed, depending on the presence of the BUILD_IN_SHM flag, needs freeing when done) and sets returned_len or 0 on error.

Definition at line 1586 of file msg_translator.c.

References sip_msg::add_rm, sip_msg::add_to_branch_s, anchor_lump(), sip_msg::body_lumps, sip_msg::buf, sip_msg::first_line, FL_FORCE_RPORT, global_req_flags, HDR_ROUTE_T, HDR_VIA_T, sip_msg::headers, _str::len, sip_msg::len, sip_msg::msg_flags, hdr_field::name, sip_msg::new_uri, _str::s, and sip_msg::via1.

Here is the call graph for this function:

void fix_global_req_flags ( str gname,
str name 
)

cfg framework fixup

It should be called from the configuration framework.

Definition at line 164 of file msg_translator.c.

References global_req_flags.