modules/tm/mi.c File Reference

TM :: MI functions. More...

#include <stdlib.h>
#include "../../parser/parse_from.h"
#include "mi.h"
#include "h_table.h"
#include "t_lookup.h"
#include "t_reply.h"
#include "t_cancel.h"
#include "dlg.h"
#include "callid.h"
#include "uac.h"

Include dependency graph for modules/tm/mi.c:

Go to the source code of this file.

Data Structures

struct  str_list

Defines

#define MI_ROUTE_PREFIX_LEN   (sizeof(MI_ROUTE_PREFIX_S)-1)
#define MI_ROUTE_PREFIX_S   "Route: "
#define MI_ROUTE_SEPARATOR_LEN   (sizeof(MI_ROUTE_SEPARATOR_S)-1)
#define MI_ROUTE_SEPARATOR_S   ", "
#define skip_hf(_hf)

Functions

static char * get_hfblock (str *uri, struct hdr_field *hf, int *l, struct socket_info **send_sock)
 Convert a header field block to char array.
static struct mi_rootmi_check_msg (struct sip_msg *msg, str *method, str *body, int *cseq, str *callid)
 Check if the request pushed via MI is correctly formed.
static void mi_print_routes (struct mi_node *node, dlg_t *dlg)
 Print routes.
static int mi_print_uris (struct mi_node *node, struct sip_msg *reply)
 Print URIs.
struct mi_rootmi_tm_cancel (struct mi_root *cmd_tree, void *param)
struct mi_rootmi_tm_hash (struct mi_root *cmd_tree, void *param)
struct mi_rootmi_tm_reply (struct mi_root *cmd_tree, void *param)
struct mi_rootmi_tm_uac_dlg (struct mi_root *cmd_tree, void *param)
static void mi_uac_dlg_hdl (struct cell *t, int type, struct tmcb_params *ps)
static struct str_listnew_str (char *s, int len, struct str_list **last, int *total)
 Allocate a new str on a str list.


Detailed Description

TM :: MI functions.

Definition in file modules/tm/mi.c.


Define Documentation

#define MI_ROUTE_PREFIX_LEN   (sizeof(MI_ROUTE_PREFIX_S)-1)

Referenced by mi_print_routes().

#define MI_ROUTE_PREFIX_S   "Route: "

Referenced by mi_print_routes().

#define MI_ROUTE_SEPARATOR_LEN   (sizeof(MI_ROUTE_SEPARATOR_S)-1)

Referenced by mi_print_routes().

#define MI_ROUTE_SEPARATOR_S   ", "

Referenced by mi_print_routes().

#define skip_hf ( _hf   ) 

Value:

(((_hf)->type == HDR_FROM_T)  || \
   ((_hf)->type == HDR_TO_T)     || \
   ((_hf)->type == HDR_CALLID_T) || \
   ((_hf)->type == HDR_CSEQ_T))
Which header fields should be skipped

Definition at line 55 of file modules/tm/mi.c.

Referenced by get_hfblock().


Function Documentation

static char* get_hfblock ( str uri,
struct hdr_field hf,
int *  l,
struct socket_info **  send_sock 
) [inline, static]

Convert a header field block to char array.

Convert a header field block to char array, allocated in pkg_mem.

Parameters:
uri SIP URI
hf header field
l 
send_sock socket information
Returns:
new allocated char array on success, zero otherwise

Definition at line 161 of file modules/tm/mi.c.

References _str::len, hdr_field::len, LM_DBG, LM_ERR, hdr_field::name, new_str(), hdr_field::next, str_list::next, pkg_free, pkg_malloc, PROTO_NONE, str_list::s, _str::s, skip_hf, SUBST_CHAR, and uri2sock().

Referenced by mi_tm_uac_dlg().

static struct mi_root* mi_check_msg ( struct sip_msg msg,
str method,
str body,
int *  cseq,
str callid 
) [static, read]

Check if the request pushed via MI is correctly formed.

Check if the request pushed via MI is correctly formed. Test if necessary SIP header fileds are included, could be parsed and the CSEQ is correct.

Parameters:
msg SIP message
method SIP method
body SIP body
cseq SIP CSEQ value
callid SIP callid, optional
Returns:
zero on success, or a mi_root with an error message included otherwise

Definition at line 77 of file modules/tm/mi.c.

References hdr_field::body, sip_msg::callid, sip_msg::content_length, sip_msg::content_type, sip_msg::cseq, sip_msg::from, get_cseq, init_mi_tree(), _str::len, cseq_body::method, cseq_body::number, parse_from_header(), _str::s, str2int(), and sip_msg::to.

Referenced by mi_tm_uac_dlg().

static void mi_print_routes ( struct mi_node node,
dlg_t dlg 
) [inline, static]

Print routes.

Print route to MI node, allocate temporary memory in pkg_mem.

Parameters:
node MI node
dlg route set

Definition at line 271 of file modules/tm/mi.c.

References add_mi_node_child(), dlg_hooks::first_route, dlg::hooks, dlg_hooks::last_route, _str::len, rr::len, len, LM_ERR, MI_DUP_VALUE, MI_ROUTE_PREFIX_LEN, MI_ROUTE_PREFIX_S, MI_ROUTE_SEPARATOR_LEN, MI_ROUTE_SEPARATOR_S, name_addr::name, rr::nameaddr, rr::next, NULL, pkg_free, pkg_malloc, _str::s, and s.

Referenced by mi_print_uris().

static int mi_print_uris ( struct mi_node node,
struct sip_msg reply 
) [inline, static]

Print URIs.

Print URIs to MI node, allocate temporary memory in shm_mem.

Parameters:
node MI node
reply SIP reply
Returns:
zero on success, -1 on errors

Definition at line 335 of file modules/tm/mi.c.

References add_mi_node_child(), DLG_CONFIRMED, dlg_response_uac(), empty, free_dlg(), dlg::hooks, _str::len, LM_ERR, MI_DUP_VALUE, mi_print_routes(), dlg_hooks::next_hop, dlg_hooks::request_uri, _str::s, shm_malloc(), and dlg::state.

Referenced by mi_uac_dlg_hdl().

struct mi_root* mi_tm_cancel ( struct mi_root cmd_tree,
void *  param 
) [read]

struct mi_root* mi_tm_hash ( struct mi_root cmd_tree,
void *  param 
) [read]

struct mi_root* mi_tm_reply ( struct mi_root cmd_tree,
void *  param 
) [read]

struct mi_root* mi_tm_uac_dlg ( struct mi_root cmd_tree,
void *  param 
) [read]

static void mi_uac_dlg_hdl ( struct cell t,
int  type,
struct tmcb_params ps 
) [static]

static struct str_list* new_str ( char *  s,
int  len,
struct str_list **  last,
int *  total 
) [static, read]

Allocate a new str on a str list.

Allocate a new str in pkg_mem and attach it to a str list. Update the total number of list elements.

Parameters:
s char array
len length of the char array
last last list element
total total number of list elements
Returns:
pointer to the new list element

Definition at line 131 of file modules/tm/mi.c.

References LM_ERR, and pkg_malloc.

Referenced by get_hfblock().


Generated on Wed May 23 20:00:40 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6