#include "../../ut.h"
#include "../../usr_avp.h"
#include "../../data_lump_rpl.h"
#include "../../parser/parse_expires.h"
#include "../../parser/parse_event.h"
#include "../../parser/contact/parse_contact.h"
#include "presence.h"
#include "subscribe.h"
#include "utils_func.h"
#include "notify.h"
#include "../pua/hash.h"

Go to the source code of this file.
Functions | |
| int | delete_db_subs (str pres_uri, str ev_stored_name, str to_tag) |
| int | extract_sdialog_info (subs_t *subs, struct sip_msg *msg, int mexp, int *to_tag_gen, str scontact) |
| int | get_database_info (struct sip_msg *msg, subs_t *subs, int *error_ret, str *reply_str) |
| int | get_db_subs_auth (subs_t *subs, int *found) |
| int | get_stored_info (struct sip_msg *msg, subs_t *subs, int *error_ret, str *reply_str) |
| int | handle_expired_subs (subs_t *s) |
| int | handle_subscribe (struct sip_msg *msg, char *str1, char *str2) |
| int | insert_db_subs_auth (subs_t *subs) |
| void | msg_watchers_clean (unsigned int ticks, void *param) |
| int | refresh_watcher (str *pres_uri, str *watcher_uri, str *event, int status, str *reason) |
| int | restore_db_subs (void) |
| int | send_2XX_reply (struct sip_msg *msg, int reply_code, int lexpire, str *local_contact) |
| void | timer_db_update (unsigned int ticks, void *param) |
| void | update_db_subs (db_con_t *db, db_func_t dbf, shtable_t hash_table, int htable_size, int no_lock, handle_expired_func_t handle_expired_func) |
| int | update_subs_db (subs_t *subs, int type) |
| int | update_subscription (struct sip_msg *msg, subs_t *subs, int to_tag_gen, int *sent_reply) |
Variables | |
| static str | pu_400_rpl = str_init("Bad request") |
| static str | pu_481_rpl = str_init("Subscription does not exist") |
| static str | pu_489_rpl = str_init("Bad Event") |
| static str | pu_500_rpl = str_init("Server Internal Error") |
| static str | su_200_rpl = str_init("OK") |
Definition in file presence/subscribe.c.
Definition at line 139 of file presence/subscribe.c.
References active_watchers_table, DB_STR, db_func::delete, LM_ERR, db_val_t::nul, pa_db, pa_dbf, str_event_col, str_presentity_uri_col, str_to_tag_col, db_val_t::str_val, db_val_t::type, db_func::use_table, and db_val_t::val.
Referenced by p_tm_callback(), and update_subscription().
| int extract_sdialog_info | ( | subs_t * | subs, | |
| struct sip_msg * | msg, | |||
| int | mexp, | |||
| int * | to_tag_gen, | |||
| str | scontact | |||
| ) |
Definition at line 753 of file presence/subscribe.c.
References receive_info::bind_address, hdr_field::body, subscription::callid, sip_msg::callid, subscription::contact, sip_msg::contact, contact_body::contacts, sip_msg::cseq, pres_ev::default_expires, to_body::error, subscription::event, EVENT_DIALOG_SLA, pres_ev::evp, subscription::expires, sip_msg::expires, sip_msg::from, subscription::from_domain, subscription::from_tag, subscription::from_user, get_cseq, get_local_contact(), sl_binds::get_reply_totag, sip_uri::host, _str::len, LM_DBG, LM_ERR, subscription::local_contact, NULL, parse_contact(), parse_expires(), parse_from_header(), parse_to(), parse_uri(), event::parsed, hdr_field::parsed, to_body::parsed_uri, subscription::pres_uri, print_rr_body(), sip_msg::rcv, subscription::record_route, sip_msg::record_route, subscription::remote_cseq, _str::s, slb, socket_info::sock_str, subscription::sockinfo_str, str2int(), to_body::tag_value, sip_msg::to, TO, subscription::to_domain, subscription::to_tag, subscription::to_user, uandd_to_uri(), contact::uri, to_body::uri, sip_uri::user, and subscription::version.
Referenced by bind_presence(), and handle_subscribe().
Definition at line 1117 of file presence/subscribe.c.
References active_watchers_table, subscription::callid, DB_STR, ERR_MEM, to_body::error, subscription::event, EVENT_DIALOG_SLA, subscription::event_id, pres_ev::evp, db_func::free_result, subscription::from_domain, subscription::from_tag, subscription::from_user, db_val_t::int_val, _str::len, LM_ERR, subscription::local_cseq, db_res::n, pres_ev::name, db_val_t::nul, NULL, pa_db, pa_dbf, event::parsed, pkg_free, pkg_malloc, PKG_MEM_STR, subscription::pres_uri, db_func::query, subscription::reason, reason_col, subscription::record_route, record_route(), subscription::remote_cseq, ROW_VALUES, db_res::rows, _str::s, subscription::status, str_callid_col, str_event_col, str_event_id_col, str_from_tag_col, str_local_cseq_col, str_presentity_uri_col, str_reason_col, str_record_route_col, str_remote_cseq_col, str_status_col, str_to_domain_col, str_to_tag_col, str_to_user_col, db_val_t::str_val, str_version_col, str_watcher_domain_col, str_watcher_username_col, db_val_t::string_val, subscription::to_domain, subscription::to_tag, subscription::to_user, db_val_t::type, db_func::use_table, db_val_t::val, and subscription::version.
Referenced by get_stored_info().
| int get_db_subs_auth | ( | subs_t * | subs, | |
| int * | found | |||
| ) |
Definition at line 1888 of file presence/subscribe.c.
References DB_STR, ERR_MEM, subscription::event, db_func::free_result, subscription::from_domain, subscription::from_user, db_val_t::int_val, _str::len, LM_ERR, db_res::n, pres_ev::name, db_val_t::nul, NULL, pa_db, pa_dbf, pkg_malloc, PKG_MEM_STR, subscription::pres_uri, db_func::query, subscription::reason, ROW_VALUES, db_res::rows, _str::s, subscription::status, str_event_col, str_presentity_uri_col, str_reason_col, str_status_col, db_val_t::str_val, str_watcher_domain_col, str_watcher_username_col, db_val_t::string_val, db_val_t::type, db_func::use_table, db_val_t::val, and watchers_table.
Referenced by handle_subscribe().
Definition at line 983 of file presence/subscribe.c.
References subscription::callid, core_hash(), ERR_MEM, to_body::error, subscription::event, EVENT_DIALOG_SLA, pres_ev::evp, fallback2db, subscription::from_tag, get_database_info(), _str::len, LM_DBG, LM_ERR, subscription::local_cseq, lock, pres_ev::name, NULL, event::parsed, pkg_free, pkg_malloc, PKG_MEM_STR, subscription::pres_uri, subscription::reason, subscription::record_route, subscription::remote_cseq, _str::s, s, search_shtable(), shtable_size, subscription::status, subs_htable, subscription::to_domain, subscription::to_tag, subscription::to_user, uandd_to_uri(), and subscription::version.
Referenced by handle_subscribe().
| int handle_expired_subs | ( | subs_t * | s | ) |
Definition at line 1303 of file presence/subscribe.c.
References subscription::expires, _str::len, LM_ERR, NULL, subscription::reason, _str::s, send_notify_request(), subscription::status, and TERMINATED_STATUS.
Referenced by timer_db_update().
| int handle_subscribe | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) |
Definition at line 504 of file presence/subscribe.c.
References ACTIVE_STATUS, subscription::auth_rules_doc, BAD_EVENT_CODE, param::body, hdr_field::body, counter, subscription::event, sip_msg::event, EVENT_DIALOG_SLA, subscription::event_id, EVENT_OTHER, extract_sdialog_info(), pres_ev::get_auth_status, get_db_subs_auth(), pres_ev::get_rules_doc, get_status_str(), get_stored_info(), HDR_EOH_F, sip_uri::host, insert_db_subs_auth(), _str::len, LM_DBG, LM_ERR, subscription::local_contact, max_expires, param::name, param::next, NULL, event::params, parse_event(), parse_headers(), parse_sip_msg_uri(), parse_uri(), event::parsed, hdr_field::parsed, sip_msg::parsed_uri, PENDING_STATUS, pkg_free, subscription::pres_uri, subscription::reason, subscription::record_route, _str::s, search_event(), send_error_reply(), server_address, subscription::status, event::text, uandd_to_uri(), update_subscription(), and sip_uri::user.
| int insert_db_subs_auth | ( | subs_t * | subs | ) |
Definition at line 1978 of file presence/subscribe.c.
References DB_INT, DB_STR, subscription::event, subscription::from_domain, subscription::from_user, db_func::insert, db_val_t::int_val, _str::len, LM_ERR, pres_ev::name, db_val_t::nul, NULL, pa_db, pa_dbf, subscription::pres_uri, subscription::reason, _str::s, subscription::status, str_event_col, str_inserted_time_col, str_presentity_uri_col, str_reason_col, str_status_col, db_val_t::str_val, str_watcher_domain_col, str_watcher_username_col, db_val_t::type, db_func::use_table, db_val_t::val, and watchers_table.
Referenced by handle_subscribe().
| void msg_watchers_clean | ( | unsigned int | ticks, | |
| void * | param | |||
| ) |
Definition at line 455 of file presence/subscribe.c.
References DB_INT, db_func::delete, db_func::free_result, db_val_t::int_val, LM_DBG, LM_ERR, db_res::n, db_val_t::nul, NULL, OP_EQ, OP_LT, pa_db, pa_dbf, PENDING_STATUS, db_func::query, str_id_col, str_inserted_time_col, str_status_col, db_val_t::type, db_func::use_table, db_val_t::val, and watchers_table.
Referenced by mi_cleanup(), and mod_init().
Definition at line 1823 of file presence/subscribe.c.
References contains_event(), core_hash(), domain, subs_entry::entries, subscription::event, subscription::from_domain, subscription::from_user, sip_uri::host, _str::len, LM_ERR, lock, mem_copy_subs(), subscription::next, notify(), NULL, parse_uri(), pkg_free, PKG_MEM_TYPE, subscription::pres_uri, subscription::reason, _str::s, s, shtable_size, subscription::status, subs_htable, sip_uri::user, and user.
| int restore_db_subs | ( | void | ) |
Definition at line 1618 of file presence/subscribe.c.
References active_watchers_table, subscription::callid, callid_col, subscription::contact, contact_col, contains_event(), core_hash(), db_func::delete, ERR_MEM, to_body::error, subscription::event, subscription::event_id, evlist::events, EvList, subscription::expires, expires_col, free_event_params(), db_func::free_result, subscription::from_domain, subscription::from_tag, subscription::from_user, insert_shtable(), db_val_t::int_val, _str::len, LM_DBG, LM_ERR, LM_INFO, subscription::local_contact, subscription::local_cseq, db_res::n, pres_ev::name, NULL, pa_db, pa_dbf, event::params, PKG_MEM_TYPE, subscription::pres_uri, db_func::query, subscription::reason, reason_col, subscription::record_route, subscription::remote_cseq, ROW_VALUES, db_res::rows, _str::s, s, shm_copy_event(), shm_malloc(), SHM_MEM_STR, shtable_size, subscription::sockinfo_str, subscription::status, str_callid_col, str_contact_col, str_event_col, str_event_id_col, str_expires_col, str_from_tag_col, str_local_contact_col, str_local_cseq_col, str_presentity_uri_col, str_reason_col, str_record_route_col, str_remote_cseq_col, str_socket_info_col, str_status_col, str_to_domain_col, str_to_tag_col, str_to_user_col, str_version_col, str_watcher_domain_col, str_watcher_username_col, db_val_t::string_val, subs_htable, subscription::to_domain, subscription::to_tag, subscription::to_user, db_func::use_table, db_val_t::val, and subscription::version.
Referenced by mod_init().
Definition at line 61 of file presence/subscribe.c.
References add_lump_rpl(), CRLF, CRLF_LEN, ERR_MEM, int2str(), _str::len, LM_ERR, LUMP_RPL_HDR, NULL, pkg_free, pkg_malloc, PKG_MEM_STR, receive_info::proto, PROTO_SCTP, PROTO_TCP, PROTO_TLS, sip_msg::rcv, _str::s, sl_binds::send_reply, and slb.
Referenced by update_subscription().
| void timer_db_update | ( | unsigned int | ticks, | |
| void * | param | |||
| ) |
Definition at line 1322 of file presence/subscribe.c.
References active_watchers_table, handle_expired_subs(), LM_ERR, NULL, pa_db, pa_dbf, shtable_size, subs_htable, update_db_subs(), and db_func::use_table.
Referenced by mod_init().
| void update_db_subs | ( | db_con_t * | db, | |
| db_func_t | dbf, | |||
| shtable_t | hash_table, | |||
| int | htable_size, | |||
| int | no_lock, | |||
| handle_expired_func_t | handle_expired_func | |||
| ) |
Definition at line 1340 of file presence/subscribe.c.
References subscription::callid, callid_col, subscription::contact, contact_col, subscription::db_flag, DB_INT, DB_STR, db_func::delete, subs_entry::entries, subscription::event, subscription::event_id, subscription::expires, expires_col, subscription::from_domain, subscription::from_tag, subscription::from_user, db_func::insert, INSERTDB_FLAG, db_val_t::int_val, LM_DBG, LM_ERR, subscription::local_contact, subscription::local_cseq, lock, pres_ev::name, subscription::next, NO_UPDATEDB_FLAG, db_val_t::nul, NULL, OP_LT, subscription::pres_uri, printf_subs(), subscription::reason, reason_col, subscription::record_route, subscription::remote_cseq, _str::s, s, shm_free, subscription::sockinfo_str, subscription::status, str_callid_col, str_contact_col, str_event_col, str_event_id_col, str_expires_col, str_from_tag_col, str_local_contact_col, str_local_cseq_col, str_presentity_uri_col, str_reason_col, str_record_route_col, str_remote_cseq_col, str_socket_info_col, str_status_col, str_to_domain_col, str_to_tag_col, str_to_user_col, db_val_t::str_val, str_version_col, str_watcher_domain_col, str_watcher_username_col, subscription::to_domain, subscription::to_tag, subscription::to_user, db_val_t::type, db_func::update, UPDATEDB_FLAG, db_val_t::val, and subscription::version.
Referenced by bind_presence(), and timer_db_update().
| int update_subs_db | ( | subs_t * | subs, | |
| int | type | |||
| ) |
Definition at line 179 of file presence/subscribe.c.
References active_watchers_table, subscription::callid, DB_INT, DB_STR, subscription::event, subscription::event_id, subscription::expires, subscription::from_domain, subscription::from_tag, subscription::from_user, db_val_t::int_val, LM_ERR, subscription::local_cseq, pres_ev::name, db_val_t::nul, NULL, pa_db, pa_dbf, subscription::pres_uri, subscription::reason, subscription::remote_cseq, REMOTE_TYPE, _str::s, subscription::status, str_callid_col, str_event_col, str_event_id_col, str_expires_col, str_from_tag_col, str_local_cseq_col, str_presentity_uri_col, str_reason_col, str_remote_cseq_col, str_status_col, str_to_tag_col, db_val_t::str_val, str_version_col, str_watcher_domain_col, str_watcher_username_col, subscription::to_tag, db_val_t::type, db_func::update, db_func::use_table, db_val_t::val, and subscription::version.
Referenced by notify(), and update_subscription().
Definition at line 292 of file presence/subscribe.c.
References core_hash(), delete_db_subs(), delete_shtable(), subscription::event, subscription::expires, fallback2db, insert_shtable(), LM_DBG, LM_ERR, subscription::local_contact, subscription::local_cseq, pres_ev::name, notify(), NULL, subscription::pres_uri, printf_subs(), PUBL_TYPE, query_db_notify(), REMOTE_TYPE, send_2XX_reply(), subscription::send_on_cback, shtable_size, subs_htable, subscription::to_tag, pres_ev::type, update_shtable(), update_subs_db(), and pres_ev::wipeer.
Referenced by handle_subscribe().
str pu_400_rpl = str_init("Bad request") [static] |
Definition at line 56 of file presence/subscribe.c.
str pu_481_rpl = str_init("Subscription does not exist") [static] |
Definition at line 55 of file presence/subscribe.c.
str pu_489_rpl = str_init("Bad Event") [static] |
Definition at line 58 of file presence/subscribe.c.
str pu_500_rpl = str_init("Server Internal Error") [static] |
Definition at line 57 of file presence/subscribe.c.
str su_200_rpl = str_init("OK") [static] |
Definition at line 54 of file presence/subscribe.c.
1.5.6