#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include "../../sr_module.h"#include "../../dprint.h"#include "../../ut.h"#include "../../ip_addr.h"#include "../../mem/mem.h"#include "../../mem/shm_mem.h"#include "../../mi/mi.h"#include "../../db/db.h"#include "../../parser/parse_content.h"#include "../../parser/parse_from.h"#include "../../pvar.h"#include "../tm/tm_load.h"#include "../sl/sl_cb.h"#include "../../str.h"

Go to the source code of this file.
Defines | |
| #define | NR_KEYS 10 |
| #define | trace_is_off(_msg) |
Functions | |
| static int | child_init (int rank) |
| static void | destroy (void) |
| static int | mod_init (void) |
| Initialize siptrace module. | |
| static int | sip_trace (struct sip_msg *, char *, char *) |
| static struct mi_root * | sip_trace_mi (struct mi_root *cmd_tree, void *param) |
| MI Sip_trace command. | |
| static int | siptrace_copy_proto (int proto, char *buf) |
| static str * | siptrace_get_table (void) |
| static void | trace_onreply_in (struct cell *t, int type, struct tmcb_params *ps) |
| static void | trace_onreply_out (struct cell *t, int type, struct tmcb_params *ps) |
| static void | trace_onreq_in (struct cell *t, int type, struct tmcb_params *ps) |
| static void | trace_onreq_out (struct cell *t, int type, struct tmcb_params *ps) |
| static int | trace_send_duplicate (char *buf, int len) |
| static void | trace_sl_ack_in (unsigned int types, struct sip_msg *req, struct sl_cb_param *sl_param) |
| static void | trace_sl_onreply_out (unsigned int types, struct sip_msg *req, struct sl_cb_param *sl_param) |
Variables | |
| static str | callid_column = str_init("callid") |
| static cmd_export_t | cmds [] |
| Exported functions. | |
| static str | date_column = str_init("time_stamp") |
| db_con_t * | db_con = NULL |
| db_func_t | db_funcs |
| static str | db_url = str_init(DEFAULT_RODB_URL) |
| static str | direction_column = str_init("direction") |
| struct sip_uri * | dup_uri = 0 |
| str | dup_uri_str = {0, 0} |
| struct module_exports | exports |
| module exports | |
| static str | fromip_column = str_init("fromip") |
| static str | fromtag_column = str_init("fromtag") |
| static str | method_column = str_init("method") |
| static mi_export_t | mi_cmds [] |
| MI commands. | |
| static str | msg_column = str_init("msg") |
| static param_export_t | params [] |
| Exported parameters. | |
| register_slcb_t | register_slcb_f = NULL |
| static str | siptrace_table = str_init("sip_trace") |
| static str | status_column = str_init("status") |
| MODULE_VERSION struct tm_binds | tmb |
| static str | toip_column = str_init("toip") |
| int | trace_flag = -1 |
| static str | trace_local_ip = {NULL, 0} |
| int | trace_on = 0 |
| int * | trace_on_flag = NULL |
| static int_str | trace_table_avp |
| static str | trace_table_avp_str = {NULL, 0} |
| static unsigned short | trace_table_avp_type = 0 |
| static int_str | traced_user_avp |
| static str | traced_user_avp_str = {NULL, 0} |
| static unsigned short | traced_user_avp_type = 0 |
| static str | traced_user_column = str_init("traced_user") |
Definition in file siptrace.c.
| #define NR_KEYS 10 |
Definition at line 85 of file siptrace.c.
| #define trace_is_off | ( | _msg | ) |
Value:
(trace_on_flag==NULL || *trace_on_flag==0 || \ ((_msg)->flags&trace_flag)==0)
Definition at line 521 of file siptrace.c.
Referenced by trace_onreply_in(), trace_onreply_out(), trace_onreq_in(), trace_onreq_out(), and trace_sl_onreply_out().
| static int child_init | ( | int | rank | ) | [static] |
| static void destroy | ( | void | ) | [static] |
| static int mod_init | ( | void | ) | [static] |
Initialize siptrace module.
Definition at line 189 of file siptrace.c.
References db_bind_mod(), DB_CAP_INSERT, DB_CAPABILITY, find_export(), flag_idx2mask(), _str::len, LM_ERR, load_tm_api(), int_str::n, NULL, parse_uri(), pkg_malloc, pv_get_avp_name(), pv_parse_spec(), _pv_spec::pvp, PVT_AVP, register_slcb_f, tm_binds::register_tmcb, _str::s, shm_malloc(), SLCB_ACK_IN, SLCB_REPLY_OUT, tmb, TMCB_REQUEST_IN, trace_flag, trace_on, trace_on_flag, trace_onreq_in(), trace_sl_ack_in(), trace_sl_onreply_out(), trace_table_avp_type, traced_user_avp_type, and _pv_spec::type.
| static int sip_trace | ( | struct sip_msg * | msg, | |
| char * | s1, | |||
| char * | s2 | |||
| ) | [static] |
Definition at line 362 of file siptrace.c.
References db_val_t::blob_val, hdr_field::body, sip_msg::buf, sip_msg::callid, DB_BLOB, DB_DATETIME, DB_STR, DB_STRING, receive_info::dst_ip, receive_info::dst_port, sip_msg::first_line, sip_msg::from, get_from, HDR_CALLID_F, db_func::insert, int2str(), ip_addr2a(), IP_ADDR_MAX_STR_SIZE, sip_msg::len, _str::len, LM_DBG, LM_ERR, int_str::n, NR_KEYS, db_val_t::nul, NULL, parse_from_header(), parse_headers(), receive_info::proto, sip_msg::rcv, msg_start::reply, msg_start::request, int_str::s, _str::s, search_first_avp(), search_next_avp(), SIP_REPLY, SIP_REQUEST, siptrace_copy_proto(), siptrace_get_table(), receive_info::src_ip, receive_info::src_port, db_val_t::str_val, db_val_t::string_val, db_val_t::time_val, trace_on_flag, trace_send_duplicate(), traced_user_avp_type, msg_start::type, db_val_t::type, msg_start::u, update_stat, db_func::use_table, and db_val_t::val.
Referenced by trace_sl_ack_in().
MI Sip_trace command.
MI command format: name: sip_trace attribute: name=none, value=[on|off]
Definition at line 1332 of file siptrace.c.
References add_mi_node_child(), init_mi_tree(), mi_node::kids, _str::len, MI_BAD_PARM, MI_INTERNAL_ERR, MI_OK, MI_SSTR, mi_root::node, NULL, _str::s, trace_on_flag, and mi_node::value.
| static int siptrace_copy_proto | ( | int | proto, | |
| char * | buf | |||
| ) | [inline, static] |
Definition at line 328 of file siptrace.c.
References PROTO_SCTP, PROTO_TCP, and PROTO_TLS.
Referenced by sip_trace(), trace_onreply_in(), trace_onreply_out(), trace_onreq_out(), and trace_sl_onreply_out().
| static str* siptrace_get_table | ( | void | ) | [inline, static] |
Definition at line 344 of file siptrace.c.
References is_avp_str_val, _str::len, int_str::n, NULL, int_str::s, search_first_avp(), and trace_table_avp_type.
Referenced by sip_trace(), trace_onreply_in(), trace_onreply_out(), trace_onreq_out(), and trace_sl_onreply_out().
| static void trace_onreply_in | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | ps | |||
| ) | [static] |
Definition at line 768 of file siptrace.c.
References db_val_t::blob_val, hdr_field::body, sip_msg::buf, sip_msg::callid, tmcb_params::code, DB_BLOB, DB_DATETIME, DB_STR, DB_STRING, receive_info::dst_ip, receive_info::dst_port, sip_msg::from, get_from, HDR_CALLID_F, db_func::insert, int2str(), ip_addr2a(), IP_ADDR_MAX_STR_SIZE, _str::len, sip_msg::len, LM_DBG, LM_ERR, cell::method, int_str::n, NR_KEYS, db_val_t::nul, NULL, parse_from_header(), parse_headers(), receive_info::proto, sip_msg::rcv, tmcb_params::req, ua_server::request, tmcb_params::rpl, int_str::s, _str::s, search_first_avp(), search_next_avp(), siptrace_copy_proto(), siptrace_get_table(), receive_info::src_ip, receive_info::src_port, db_val_t::str_val, db_val_t::string_val, db_val_t::time_val, trace_is_off, trace_send_duplicate(), traced_user_avp_type, db_val_t::type, cell::uas, update_stat, db_func::use_table, and db_val_t::val.
Referenced by trace_onreq_in().
| static void trace_onreply_out | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | ps | |||
| ) | [static] |
Definition at line 939 of file siptrace.c.
References db_val_t::blob_val, hdr_field::body, sip_msg::buf, retr_buf::buffer, sip_msg::callid, tmcb_params::code, DB_BLOB, DB_DATETIME, DB_STR, DB_STRING, receive_info::dst_ip, receive_info::dst_port, tmcb_params::extra1, tmcb_params::extra2, FAKED_REPLY, sip_msg::from, get_from, HDR_CALLID_F, db_func::insert, int2str(), ip_addr2a(), IP_ADDR_MAX_STR_SIZE, sip_msg::len, _str::len, len, LM_DBG, LM_ERR, cell::method, int_str::n, NR_KEYS, db_val_t::nul, NULL, parse_from_header(), parse_headers(), dest_info::proto, receive_info::proto, sip_msg::rcv, tmcb_params::req, ua_server::request, ua_server::response, tmcb_params::rpl, int_str::s, _str::s, sbuf, search_first_avp(), search_next_avp(), siptrace_copy_proto(), siptrace_get_table(), db_val_t::str_val, db_val_t::string_val, su2ip_addr(), su_getport(), db_val_t::time_val, dest_info::to, trace_is_off, trace_send_duplicate(), traced_user_avp_type, db_val_t::type, cell::uas, update_stat, db_func::use_table, and db_val_t::val.
Referenced by trace_onreq_in().
| static void trace_onreq_in | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | ps | |||
| ) | [static] |
Definition at line 525 of file siptrace.c.
References sip_msg::from, get_from, HDR_CALLID_F, LM_DBG, LM_ERR, int_str::n, NULL, parse_from_header(), parse_headers(), tm_binds::register_tmcb, tmcb_params::req, search_first_avp(), tmb, TMCB_REQUEST_BUILT, TMCB_RESPONSE_IN, TMCB_RESPONSE_OUT, trace_is_off, trace_onreply_in(), trace_onreply_out(), trace_onreq_out(), and traced_user_avp_type.
Referenced by mod_init().
| static void trace_onreq_out | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | ps | |||
| ) | [static] |
Definition at line 577 of file siptrace.c.
References db_val_t::blob_val, hdr_field::body, sip_msg::callid, DB_BLOB, DB_DATETIME, DB_STR, DB_STRING, receive_info::dst_ip, receive_info::dst_port, tmcb_params::extra1, tmcb_params::extra2, sip_msg::from, get_from, HDR_CALLID_F, db_func::insert, int2str(), ip_addr2a(), IP_ADDR_MAX_STR_SIZE, _str::len, len, LM_DBG, LM_ERR, cell::method, int_str::n, NR_KEYS, db_val_t::nul, NULL, parse_from_header(), parse_headers(), dest_info::proto, receive_info::proto, sip_msg::rcv, tmcb_params::req, int_str::s, _str::s, sbuf, search_first_avp(), search_next_avp(), dest_info::send_sock, siptrace_copy_proto(), siptrace_get_table(), socket_info::sock_str, db_val_t::str_val, db_val_t::string_val, su2ip_addr(), su_getport(), db_val_t::time_val, dest_info::to, trace_is_off, trace_send_duplicate(), traced_user_avp_type, db_val_t::type, update_stat, db_func::use_table, and db_val_t::val.
Referenced by trace_onreq_in().
| static int trace_send_duplicate | ( | char * | buf, | |
| int | len | |||
| ) | [static] |
Definition at line 1371 of file siptrace.c.
References proxy_l::addr_idx, free_proxy(), get_next_su(), get_send_socket(), proxy_l::host, sip_uri::host, hostent2su(), LM_ERR, mk_proxy(), msg_send(), NULL, pkg_free, pkg_malloc, proxy_l::port, sip_uri::port_no, proxy_l::proto, PROTO_UDP, sockaddr_union::s, _str::s, and SIP_PORT.
Referenced by sip_trace(), trace_onreply_in(), trace_onreply_out(), trace_onreq_out(), and trace_sl_onreply_out().
| static void trace_sl_ack_in | ( | unsigned int | types, | |
| struct sip_msg * | req, | |||
| struct sl_cb_param * | sl_param | |||
| ) | [static] |
Definition at line 1144 of file siptrace.c.
References LM_DBG, and sip_trace().
Referenced by mod_init().
| static void trace_sl_onreply_out | ( | unsigned int | types, | |
| struct sip_msg * | req, | |||
| struct sl_cb_param * | sl_param | |||
| ) | [static] |
Definition at line 1150 of file siptrace.c.
References db_val_t::blob_val, hdr_field::body, sl_cb_param::buffer, sip_msg::callid, sl_cb_param::code, DB_BLOB, DB_DATETIME, DB_STR, DB_STRING, sl_cb_param::dst, receive_info::dst_ip, receive_info::dst_port, sip_msg::first_line, sip_msg::from, get_from, HDR_CALLID_F, db_func::insert, int2str(), ip_addr2a(), IP_ADDR_MAX_STR_SIZE, _str::len, len, LM_DBG, LM_ERR, int_str::n, NR_KEYS, db_val_t::nul, NULL, parse_from_header(), parse_headers(), receive_info::proto, sip_msg::rcv, msg_start::request, int_str::s, _str::s, search_first_avp(), search_next_avp(), siptrace_copy_proto(), siptrace_get_table(), db_val_t::str_val, db_val_t::string_val, su2ip_addr(), su_getport(), db_val_t::time_val, trace_is_off, trace_send_duplicate(), traced_user_avp_type, db_val_t::type, msg_start::u, update_stat, db_func::use_table, and db_val_t::val.
Referenced by mod_init().
str callid_column = str_init("callid") [static] |
Definition at line 75 of file siptrace.c.
cmd_export_t cmds[] [static] |
Initial value:
{
{"sip_trace", (cmd_function)sip_trace, 0, 0, 0,
REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
{0, 0, 0, 0, 0, 0}
}
Definition at line 113 of file siptrace.c.
str date_column = str_init("time_stamp") [static] |
Definition at line 74 of file siptrace.c.
database connection
Definition at line 105 of file siptrace.c.
Definition at line 72 of file siptrace.c.
str direction_column = str_init("direction") [static] |
Definition at line 83 of file siptrace.c.
Definition at line 91 of file siptrace.c.
| str dup_uri_str = {0, 0} |
Definition at line 90 of file siptrace.c.
| struct module_exports exports |
str fromip_column = str_init("fromip") [static] |
Definition at line 80 of file siptrace.c.
str fromtag_column = str_init("fromtag") [static] |
Definition at line 82 of file siptrace.c.
str method_column = str_init("method") [static] |
Definition at line 78 of file siptrace.c.
mi_export_t mi_cmds[] [static] |
Initial value:
{
{ "sip_trace", sip_trace_mi, 0, 0, 0 },
{ 0, 0, 0, 0, 0}
}
Definition at line 148 of file siptrace.c.
str msg_column = str_init("msg") [static] |
Definition at line 77 of file siptrace.c.
param_export_t params[] [static] |
| register_slcb_t register_slcb_f = NULL |
stateless callback registration
Definition at line 108 of file siptrace.c.
Referenced by mod_init().
str siptrace_table = str_init("sip_trace") [static] |
Definition at line 73 of file siptrace.c.
str status_column = str_init("status") [static] |
Definition at line 79 of file siptrace.c.
TM bind
Definition at line 53 of file siptrace.c.
str toip_column = str_init("toip") [static] |
Definition at line 81 of file siptrace.c.
| int trace_flag = -1 |
str trace_local_ip = {NULL, 0} [static] |
Definition at line 103 of file siptrace.c.
| int trace_on = 0 |
| int* trace_on_flag = NULL |
Definition at line 93 of file siptrace.c.
Referenced by mod_init(), sip_trace(), and sip_trace_mi().
int_str trace_table_avp [static] |
Definition at line 100 of file siptrace.c.
str trace_table_avp_str = {NULL, 0} [static] |
Definition at line 101 of file siptrace.c.
unsigned short trace_table_avp_type = 0 [static] |
int_str traced_user_avp [static] |
Definition at line 96 of file siptrace.c.
str traced_user_avp_str = {NULL, 0} [static] |
Definition at line 97 of file siptrace.c.
unsigned short traced_user_avp_type = 0 [static] |
Definition at line 95 of file siptrace.c.
Referenced by mod_init(), sip_trace(), trace_onreply_in(), trace_onreply_out(), trace_onreq_in(), trace_onreq_out(), and trace_sl_onreply_out().
str traced_user_column = str_init("traced_user") [static] |
Definition at line 76 of file siptrace.c.
1.5.6