#include <stdio.h>#include <string.h>#include <stdlib.h>#include <sys/types.h>#include <sys/ipc.h>#include <unistd.h>#include <fcntl.h>#include <time.h>#include "../../sr_module.h"#include "../../dprint.h"#include "../../ut.h"#include "../../timer.h"#include "../../mem/shm_mem.h"#include "../../db/db.h"#include "../../parser/parse_from.h"#include "../../parser/parse_content.h"#include "../../parser/contact/parse_contact.h"#include "../../parser/parse_allow.h"#include "../../parser/parse_methods.h"#include "../../resolve.h"#include "../../usr_avp.h"#include "../../mod_fix.h"#include "../tm/tm_load.h"#include "ms_msg_list.h"#include "msfuncs.h"

Go to the source code of this file.
Defines | |
| #define | MAX_DEL_KEYS 1 |
| #define | MS_BUF1_SIZE 1024 |
| #define | NR_KEYS 10 |
| #define | S_TABLE_VERSION 5 |
| #define | SET_STR_VAL(_str, _res, _r, _c) |
Functions | |
| int | check_message_support (struct sip_msg *msg) |
| static int | child_init (int) |
| void | destroy (void) |
| void | m_clean_silo (unsigned int ticks, void *) |
| static int | m_dump (struct sip_msg *, char *, char *) |
| void | m_send_ontimer (unsigned int ticks, void *) |
| static int | m_store (struct sip_msg *, char *, char *) |
| static void | m_tm_callback (struct cell *t, int type, struct tmcb_params *ps) |
| static int | mod_init (void) |
| int | ms_reset_stime (int mid) |
Variables | |
| static cmd_export_t | cmds [] |
| static db_con_t * | db_con = NULL |
| struct module_exports | exports |
| msg_list | ml = NULL |
| int | ms_add_date = 1 |
| int | ms_check_time = 60 |
| int | ms_clean_period = 10 |
| char * | ms_contact = NULL |
| void ** | ms_contact_sp = NULL |
| char * | ms_content_type = NULL |
| void ** | ms_content_type_sp = NULL |
| static str | ms_db_table = str_init("silo") |
| static str | ms_db_url = str_init(DEFAULT_DB_URL) |
| int | ms_expire_time = 259200 |
| char * | ms_from = NULL |
| void ** | ms_from_sp = NULL |
| int | ms_max_messages = 0 |
| char * | ms_offline_message = NULL |
| void ** | ms_offline_message_sp = NULL |
| str | ms_outbound_proxy = {NULL, 0} |
| str | ms_reminder = {NULL, 0} |
| int | ms_send_time = 0 |
| int_str | ms_snd_time_avp_name |
| static str | ms_snd_time_avp_param = {NULL, 0} |
| unsigned short | ms_snd_time_avp_type |
| int | ms_use_contact = 1 |
| str | msg_type = str_init("MESSAGE") |
| static db_func_t | msilo_dbf |
| static param_export_t | params [] |
| static str | sc_body = str_init("body") |
| static str | sc_ctype = str_init("ctype") |
| static str | sc_exp_time = str_init("exp_time") |
| static str | sc_from = str_init("src_addr") |
| static str | sc_inc_time = str_init("inc_time") |
| static str | sc_mid = str_init("id") |
| static str | sc_snd_time = str_init("snd_time") |
| static str | sc_to = str_init("dst_addr") |
| static str | sc_uri_host = str_init("domain") |
| static str | sc_uri_user = str_init("username") |
| struct tm_binds | tmb |
| #define MAX_DEL_KEYS 1 |
| #define MS_BUF1_SIZE 1024 |
Referenced by m_store().
| #define NR_KEYS 10 |
Definition at line 73 of file msilo.c.
Referenced by m_store(), pdt_mi_add(), sip_trace(), trace_onreply_in(), trace_onreply_out(), trace_onreq_out(), and trace_sl_onreply_out().
| #define S_TABLE_VERSION 5 |
| #define SET_STR_VAL | ( | _str, | |||
| _res, | |||||
| _r, | |||||
| _c | ) |
| int check_message_support | ( | struct sip_msg * | msg | ) |
Definition at line 1355 of file msilo.c.
References param::body, sip_msg::contact, contact_iterator(), get_allow_methods, HDR_EOH_F, LM_DBG, LM_ERR, METHOD_MESSAGE, contact::methods, parse_allow(), parse_contact(), parse_headers(), parse_methods(), and hdr_field::parsed.
Referenced by m_dump().
| static int child_init | ( | int | rank | ) | [static] |
Initialize children
Definition at line 417 of file msilo.c.
References db_func::init, LM_CRIT, LM_DBG, LM_ERR, and db_func::use_table.
| void destroy | ( | void | ) |
destroy function
| void m_clean_silo | ( | unsigned int | ticks, | |
| void * | param | |||
| ) |
Definition at line 1058 of file msilo.c.
References DB_INT, db_func::delete, db_val_t::int_val, LM_DBG, LM_ERR, MAX_DEL_KEYS, ms_check_time, ms_clean_period, MS_MSG_DONE, MS_MSG_ERRO, MS_MSG_TSND, ms_reset_stime(), msg_list_check(), msg_list_el_free_all(), msg_list_reset(), db_val_t::nul, NULL, OP_LEQ, db_val_t::type, update_stat, and db_val_t::val.
Referenced by mod_init().
| static int m_dump | ( | struct sip_msg * | msg, | |
| char * | owner, | |||
| char * | str2 | |||
| ) | [static] |
dump message
check if has expires=0 (REGISTER)
sending using TM function: t_uac
Free the result because we don't need it anymore
Definition at line 829 of file msilo.c.
References hdr_field::body, check_message_support(), DB_INT, DB_STR, to_body::error, sip_msg::expires, fixup_get_svalue(), db_func::free_result, HDR_EXPIRES_F, HDR_TO_F, sip_uri::host, db_val_t::int_val, _str::len, LM_DBG, LM_ERR, m_build_body(), m_build_headers(), m_tm_callback(), MS_MSG_ERRO, msg_list_check_msg(), msg_list_set_flag(), db_val_t::nul, NULL, OP_EQ, parse_headers(), parse_to(), parse_uri(), hdr_field::parsed, db_func::query, RES_ROW_N, RES_ROWS, _str::s, SET_STR_VAL, db_val_t::str_val, tm_binds::t_request, tmb, sip_msg::to, db_val_t::type, to_body::uri, db_func::use_table, sip_uri::user, and db_val_t::val.
| void m_send_ontimer | ( | unsigned int | ticks, | |
| void * | param | |||
| ) |
sending using TM function: t_uac
Free the result because we don't need it anymore
Definition at line 1175 of file msilo.c.
References DB_INT, db_func::free_result, db_val_t::int_val, _str::len, LM_DBG, LM_ERR, LM_WARN, m_build_body(), m_build_headers(), m_tm_callback(), MS_MSG_ERRO, MS_MSG_TSND, msg_list_check_msg(), msg_list_set_flag(), db_val_t::nul, NULL, OP_LEQ, OP_NEQ, db_func::query, RES_ROW_N, RES_ROWS, _str::s, SET_STR_VAL, tm_binds::t_request, tmb, db_val_t::type, db_func::use_table, and db_val_t::val.
Referenced by mod_init().
| static int m_store | ( | struct sip_msg * | msg, | |
| char * | owner, | |||
| char * | s2 | |||
| ) | [static] |
store message mode = "0" -- look for outgoing URI starting with new_uri = "1" -- look for outgoing URI starting with r-uri = "2" -- look for outgoing URI only at to header
check the content-type value
Definition at line 450 of file msilo.c.
References db_val_t::blob_val, hdr_field::body, sip_msg::contact, sip_msg::content_length, sip_msg::content_type, CT_TYPE, DB_BLOB, DB_INT, DB_STR, to_body::error, sip_msg::expires, sip_msg::first_line, fixup_get_svalue(), db_func::free_result, sip_msg::from, get_body(), get_content_length, sip_uri::host, db_func::insert, db_val_t::int_val, is_avp_str_val, _str::len, LM_DBG, LM_ERR, LM_WARN, m_extract_content_type(), MS_BUF1_SIZE, ms_contact, ms_contact_sp, ms_content_type_sp, ms_expire_time, ms_extract_time(), ms_from, ms_from_sp, ms_max_messages, ms_offline_message, ms_offline_message_sp, ms_snd_time_avp_type, ms_use_contact, int_str::n, sip_msg::new_uri, NR_KEYS, db_val_t::nul, NULL, parse_contact(), parse_content_type_hdr(), parse_from_header(), parse_to(), parse_uri(), hdr_field::parsed, db_func::query, msg_start::request, RES_ROW_N, int_str::s, _str::s, search_first_avp(), db_val_t::str_val, SUBTYPE_CPIM, SUBTYPE_PLAIN, tm_binds::t_request, tmb, sip_msg::to, _content_type::type, db_val_t::type, TYPE_MESSAGE, TYPE_TEXT, msg_start::u, update_stat, to_body::uri, db_func::use_table, sip_uri::user, and db_val_t::val.
| void m_tm_callback | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | ps | |||
| ) | [static] |
TM callback function
TM callback function - delete message from database if was sent OK
Definition at line 1146 of file msilo.c.
References tmcb_params::code, LM_DBG, LM_ERR, MS_MSG_DONE, MS_MSG_ERRO, msg_list_set_flag(), NULL, and tmcb_params::param.
Referenced by m_dump(), and m_send_ontimer().
| static int mod_init | ( | void | ) | [static] |
module functions
init module function
Definition at line 255 of file msilo.c.
References db_func::close, db_bind_mod(), DB_CAP_ALL, DB_CAPABILITY, db_check_table_version(), fixup_spve_null(), db_func::init, _str::len, LM_DBG, LM_ERR, load_tm_api(), m_clean_silo(), m_send_ontimer(), ms_check_time, ms_contact, ms_contact_sp, ms_content_type, ms_content_type_sp, ms_from, ms_from_sp, ms_offline_message, ms_offline_message_sp, ms_send_time, ms_snd_time_avp_type, msg_list_init(), NULL, pkg_malloc, pv_get_avp_name(), pv_parse_spec(), _pv_spec::pvp, PVT_AVP, register_timer(), _str::s, S_TABLE_VERSION, tmb, and _pv_spec::type.
| int ms_reset_stime | ( | int | mid | ) |
Definition at line 1313 of file msilo.c.
References DB_INT, db_val_t::int_val, LM_DBG, LM_ERR, db_val_t::nul, OP_EQ, db_val_t::type, db_func::update, db_func::use_table, and db_val_t::val.
Referenced by m_clean_silo().
cmd_export_t cmds[] [static] |
| struct module_exports exports |
precessed msg list - used for dumping the messages
Definition at line 118 of file msilo.c.
Referenced by msg_list_init().
| int ms_add_date = 1 |
| int ms_check_time = 60 |
| int ms_clean_period = 10 |
| char* ms_contact = NULL |
| void** ms_contact_sp = NULL |
| char* ms_content_type = NULL |
| void** ms_content_type_sp = NULL |
str ms_db_table = str_init("silo") [static] |
| int ms_expire_time = 259200 |
| char* ms_from = NULL |
| void** ms_from_sp = NULL |
| int ms_max_messages = 0 |
| char* ms_offline_message = NULL |
| void** ms_offline_message_sp = NULL |
| str ms_outbound_proxy = {NULL, 0} |
| str ms_reminder = {NULL, 0} |
| int ms_send_time = 0 |
str ms_snd_time_avp_param = {NULL, 0} [static] |
| unsigned short ms_snd_time_avp_type |
| int ms_use_contact = 1 |
Definition at line 151 of file msilo.c.
Referenced by purple_send_sip_msg(), send_sip_msg_request(), xj_send_sip_msg(), and xmpp_send_sip_msg().
param_export_t params[] [static] |
str sc_exp_time = str_init("exp_time") [static] |
str sc_inc_time = str_init("inc_time") [static] |
str sc_snd_time = str_init("snd_time") [static] |
str sc_uri_host = str_init("domain") [static] |
str sc_uri_user = str_init("username") [static] |
1.5.6