#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libxml/parser.h>
#include "../../trim.h"
#include "../../ut.h"
#include "../../globals.h"
#include "../../str.h"
#include "../../db/db.h"
#include "../../db/db_val.h"
#include "../../socket_info.h"
#include "../tm/tm_load.h"
#include "../pua/hash.h"
#include "presentity.h"
#include "presence.h"
#include "notify.h"
#include "utils_func.h"

Go to the source code of this file.
Defines | |
| #define | ALLOC_SIZE 3000 |
| #define | MAX_FORWARD 70 |
Functions | |
| int | add_waiting_watchers (watcher_t *watchers, str pres_uri, str event) |
| int | add_watcher_list (subs_t *s, watcher_t *watchers) |
| dlg_t * | build_dlg_t (subs_t *subs) |
| str * | build_empty_bla_body (str pres_uri) |
| int | build_str_hdr (subs_t *subs, int is_body, str *hdr) |
| str * | create_winfo_xml (watcher_t *watchers, char *version, str resource, str event, int STATE_FLAG) |
| void | free_cbparam (c_back_param *cb_param) |
| int | free_tm_dlg (dlg_t *td) |
| void | free_watcher_list (watcher_t *watchers) |
| str * | get_p_notify_body (str pres_uri, pres_ev_t *event, str *etag, str *contact) |
| char * | get_status_str (int status_flag) |
| int | get_subs_db (str *pres_uri, pres_ev_t *event, str *sender, subs_t **s_array, int *n) |
| subs_t * | get_subs_dialog (str *pres_uri, pres_ev_t *event, str *sender) |
| str * | get_wi_notify_body (subs_t *subs, subs_t *watcher_subs) |
| int | get_wi_subs_db (subs_t *subs, watcher_t *watchers) |
| int | notify (subs_t *subs, subs_t *watcher_subs, str *n_body, int force_null_body) |
| void | p_tm_callback (struct cell *t, int type, struct tmcb_params *ps) |
| void | printf_subs (subs_t *subs) |
| int | publ_notify (presentity_t *p, str pres_uri, str *body, str *offline_etag, str *rules_doc) |
| int | query_db_notify (str *pres_uri, pres_ev_t *event, subs_t *watcher_subs) |
| int | send_notify_request (subs_t *subs, subs_t *watcher_subs, str *n_body, int force_null_body) |
| c_back_param * | shm_dup_cbparam (subs_t *) |
| int | update_in_list (subs_t *s, subs_t *s_array, int new_rec_no, int n) |
| int | watcher_found_in_list (watcher_t *watchers, str wuri) |
Variables | |
| str | str_body_col = str_init("body") |
| str | str_callid_col = str_init("callid") |
| str | str_contact_col = str_init("contact") |
| str | str_domain_col = str_init("domain") |
| str | str_etag_col = str_init("etag") |
| str | str_event_col = str_init("event") |
| str | str_event_id_col = str_init("event_id") |
| str | str_expires_col = str_init("expires") |
| str | str_from_tag_col = str_init("from_tag") |
| str | str_id_col = str_init("id") |
| str | str_inserted_time_col = str_init("inserted_time") |
| str | str_local_contact_col = str_init("local_contact") |
| str | str_local_cseq_col = str_init("local_cseq") |
| str | str_presentity_uri_col = str_init("presentity_uri") |
| str | str_reason_col = str_init("reason") |
| str | str_received_time_col = str_init("received_time") |
| str | str_record_route_col = str_init("record_route") |
| str | str_remote_cseq_col = str_init("remote_cseq") |
| str | str_sender_col = str_init("sender") |
| str | str_socket_info_col = str_init("socket_info") |
| str | str_status_col = str_init("status") |
| str | str_to_domain_col = str_init("to_domain") |
| str | str_to_tag_col = str_init("to_tag") |
| str | str_to_user_col = str_init("to_user") |
| str | str_username_col = str_init("username") |
| str | str_version_col = str_init("version") |
| str | str_watcher_domain_col = str_init("watcher_domain") |
| str | str_watcher_username_col = str_init("watcher_username") |
Definition in file presence/notify.c.
| #define ALLOC_SIZE 3000 |
Definition at line 54 of file presence/notify.c.
| #define MAX_FORWARD 70 |
Definition at line 55 of file presence/notify.c.
Referenced by build_str_hdr(), publ_build_hdr(), rls_notify_extra_hdr(), and subs_build_hdr().
Definition at line 1876 of file presence/notify.c.
References DB_INT, DB_STR, ERR_MEM, watcher::event, db_func::free_result, watcher::id, db_val_t::int_val, _str::len, LM_DBG, LM_ERR, db_res::n, watcher::next, db_val_t::nul, NULL, pa_db, pa_dbf, PENDING_STATUS, pkg_free, pkg_malloc, PKG_MEM_STR, db_func::query, ROW_VALUES, db_res::rows, _str::s, watcher::status, db_val_t::str_val, db_val_t::string_val, to64frombits(), db_val_t::type, uandd_to_uri(), watcher::uri, db_func::use_table, db_val_t::val, WAITING_STATUS, watcher_found_in_list(), and watchers_table.
Referenced by get_wi_notify_body().
Definition at line 473 of file presence/notify.c.
References subscription::callid, subscription::from_domain, subscription::from_user, watcher::id, _str::len, LM_ERR, watcher::next, NULL, pkg_free, pkg_malloc, _str::s, subscription::status, watcher::status, uandd_to_uri(), and watcher::uri.
Referenced by get_wi_notify_body(), and get_wi_subs_db().
Definition at line 908 of file presence/notify.c.
References dlg_id::call_id, subscription::callid, subscription::contact, DLG_CONFIRMED, ERR_MEM, free_tm_dlg(), subscription::from_domain, subscription::from_tag, subscription::from_user, grep_sock_info(), sip_uri::host, dlg::id, dlg_seq::is_set, _str::len, LM_DBG, LM_ERR, dlg::loc_seq, dlg_id::loc_tag, dlg::loc_uri, subscription::local_cseq, NULL, parse_phostport(), parse_rr_body(), pkg_malloc, PKG_MEM_STR, port, sip_uri::proto, subscription::record_route, dlg_id::rem_tag, dlg::rem_target, dlg::rem_uri, dlg::route_set, _str::s, dlg::send_sock, subscription::sockinfo_str, dlg::state, subscription::to_domain, subscription::to_tag, subscription::to_user, uandd_to_uri(), and dlg_seq::value.
Definition at line 514 of file presence/notify.c.
References _str::len, len, LM_ERR, NULL, pkg_free, pkg_malloc, and _str::s.
Referenced by get_p_notify_body().
Definition at line 124 of file presence/notify.c.
References pres_ev::content_type, CRLF, CRLF_LEN, subscription::event, subscription::event_id, subscription::expires, get_status_str(), int2str(), _str::len, LM_DBG, LM_ERR, subscription::local_contact, MAX_FORWARD, pres_ev::name, NULL, pkg_malloc, subscription::reason, _str::s, subscription::sockinfo_str, subscription::status, and TERMINATED_STATUS.
Referenced by send_notify_request().
| str * create_winfo_xml | ( | watcher_t * | watchers, | |
| char * | version, | |||
| str | resource, | |||
| str | event, | |||
| int | STATE_FLAG | |||
| ) |
Definition at line 1745 of file presence/notify.c.
References ERR_MEM, FULL_STATE_FLAG, get_status_str(), watcher::id, _str::len, LM_ERR, watcher::next, NULL, pkg_free, pkg_malloc, PKG_MEM_STR, _str::s, watcher::status, and watcher::uri.
Referenced by get_wi_notify_body().
| void free_cbparam | ( | c_back_param * | cb_param | ) |
Definition at line 1707 of file presence/notify.c.
References NULL, and shm_free.
Referenced by p_tm_callback(), and send_notify_request().
| int free_tm_dlg | ( | dlg_t * | td | ) |
Definition at line 892 of file presence/notify.c.
References free_rr(), dlg::loc_uri, pkg_free, dlg::rem_uri, dlg::route_set, and _str::s.
| void free_watcher_list | ( | watcher_t * | watchers | ) |
Definition at line 458 of file presence/notify.c.
References watcher::id, watcher::next, NULL, pkg_free, _str::s, and watcher::uri.
Referenced by get_wi_notify_body().
Definition at line 609 of file presence/notify.c.
References pres_ev::agg_nbody, build_empty_bla_body(), core_hash(), DB_STR, ERR_MEM, EVENT_DIALOG_SLA, pres_ev::evp, expires_col, fallback2db, db_func::free_result, sip_uri::host, _str::len, len, LM_DBG, LM_ERR, db_res::n, pres_ev::name, db_val_t::nul, NULL, pa_db, pa_dbf, parse_uri(), event::parsed, phtable_size, pkg_free, pkg_malloc, PKG_MEM_STR, presentity_table, db_func::query, ROW_VALUES, db_res::rows, _str::s, search_phtable(), str_init, db_val_t::str_val, db_val_t::string_val, db_val_t::type, db_func::use_table, sip_uri::user, and db_val_t::val.
Referenced by publ_notify(), query_db_notify(), and send_notify_request().
| char* get_status_str | ( | int | status_flag | ) |
Definition at line 96 of file presence/notify.c.
References ACTIVE_STATUS, NULL, PENDING_STATUS, TERMINATED_STATUS, and WAITING_STATUS.
Referenced by build_str_hdr(), create_winfo_xml(), handle_subscribe(), pres_update_status(), and printf_subs().
Definition at line 986 of file presence/notify.c.
References ACTIVE_STATUS, active_watchers_table, subscription::callid, callid_col, subscription::contact, contact_col, cseq_col, DB_INT, DB_STR, subscription::event, subscription::event_id, subscription::expires, expires_col, db_func::free_result, subscription::from_domain, subscription::from_tag, subscription::from_user, db_val_t::int_val, _str::len, LM_DBG, LM_ERR, subscription::local_contact, subscription::local_cseq, mem_copy_subs(), db_res::n, pres_ev::name, subscription::next, db_val_t::nul, NULL, OP_EQ, OP_NEQ, pa_db, pa_dbf, PKG_MEM_TYPE, subscription::pres_uri, printf_subs(), db_func::query, reason_col, subscription::record_route, ROW_VALUES, db_res::rows, _str::s, s, subscription::sockinfo_str, subscription::status, db_val_t::str_val, 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_subs_dialog().
Definition at line 1212 of file presence/notify.c.
References ACTIVE_STATUS, subscription::contact, core_hash(), subscription::db_flag, subs_entry::entries, subscription::event, subscription::expires, fallback2db, free_subs_list(), get_subs_db(), _str::len, LM_DBG, LM_ERR, lock, mem_copy_subs(), pres_ev::name, subscription::next, NO_UPDATEDB_FLAG, NULL, PKG_MEM_TYPE, subscription::pres_uri, printf_subs(), subscription::reason, _str::s, s, shtable_size, subscription::status, subs_htable, update_in_list(), and UPDATEDB_FLAG.
Referenced by publ_notify(), and query_db_notify().
Definition at line 348 of file presence/notify.c.
References add_waiting_watchers(), add_watcher_list(), core_hash(), create_winfo_xml(), subscription::db_flag, subs_entry::entries, ERR_MEM, subscription::event, subscription::expires, fallback2db, free_watcher_list(), FULL_STATE_FLAG, get_wi_subs_db(), INSERTDB_FLAG, int2str(), _str::len, len, LM_DBG, LM_ERR, lock, pres_ev::name, subscription::next, NULL, PARTIAL_STATE_FLAG, pkg_free, pkg_malloc, PKG_MEM_STR, subscription::pres_uri, _str::s, s, shtable_size, subs_htable, subscription::version, and pres_ev::wipeer.
Referenced by send_notify_request().
Definition at line 256 of file presence/notify.c.
References active_watchers_table, add_watcher_list(), subscription::callid, callid_col, DB_STR, subscription::event, expires_col, db_func::free_result, subscription::from_domain, subscription::from_user, db_val_t::int_val, _str::len, LM_DBG, LM_ERR, db_res::n, pres_ev::name, db_val_t::nul, NULL, OP_EQ, pa_db, pa_dbf, subscription::pres_uri, db_func::query, ROW_VALUES, db_res::rows, _str::s, subscription::status, db_val_t::str_val, db_val_t::string_val, db_val_t::type, db_func::use_table, db_val_t::val, and pres_ev::wipeer.
Referenced by get_wi_notify_body().
Definition at line 1632 of file presence/notify.c.
References ACTIVE_STATUS, core_hash(), subscription::db_flag, subscription::event, subscription::expires, fallback2db, INSERTDB_FLAG, _str::len, LM_DBG, LM_ERR, LOCAL_TYPE, pres_ev::name, subscription::pres_uri, subscription::reason, _str::s, send_notify_request(), shtable_size, subscription::status, subs_htable, TERMINATED_STATUS, update_shtable(), and update_subs_db().
Referenced by publ_notify(), query_db_notify(), refresh_watcher(), update_subscription(), and update_watchers_status().
| void p_tm_callback | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | ps | |||
| ) |
Definition at line 1673 of file presence/notify.c.
References cb, tmcb_params::code, core_hash(), delete_db_subs(), delete_shtable(), wid_cback::ev_name, free_cbparam(), LM_DBG, NULL, tmcb_params::param, wid_cback::pres_uri, shtable_size, subs_htable, and wid_cback::to_tag.
Referenced by send_notify_request().
| void printf_subs | ( | subs_t * | subs | ) |
Definition at line 108 of file presence/notify.c.
References subscription::callid, subscription::contact, subscription::event, subscription::expires, subscription::from_domain, subscription::from_tag, subscription::from_user, get_status_str(), _str::len, LM_DBG, subscription::local_cseq, pres_ev::name, subscription::pres_uri, subscription::record_route, _str::s, subscription::status, subscription::to_domain, subscription::to_tag, and subscription::to_user.
Referenced by get_subs_db(), get_subs_dialog(), send_notify_request(), update_db_subs(), update_in_list(), update_pw_dialogs(), and update_subscription().
| int publ_notify | ( | presentity_t * | p, | |
| str | pres_uri, | |||
| str * | body, | |||
| str * | offline_etag, | |||
| str * | rules_doc | |||
| ) |
Definition at line 1302 of file presence/notify.c.
References pres_ev::agg_nbody, pres_ev::apply_auth_nbody, subscription::auth_rules_doc, pres_ev::aux_body_processing, pres_ev::aux_free_body, presentity::event, pres_ev::free_body, free_subs_list(), get_p_notify_body(), get_subs_dialog(), _str::len, LM_DBG, LM_ERR, pres_ev::name, notify(), NULL, pkg_free, PKG_MEM_TYPE, _str::s, s, and presentity::sender.
Referenced by msg_presentity_clean(), and update_presentity().
Definition at line 1368 of file presence/notify.c.
References pres_ev::agg_nbody, pres_ev::apply_auth_nbody, pres_ev::aux_body_processing, free_subs_list(), get_p_notify_body(), get_subs_dialog(), _str::len, LM_DBG, LM_ERR, pres_ev::name, notify(), NULL, pkg_free, PKG_MEM_TYPE, PUBL_TYPE, _str::s, s, pres_ev::type, and WINFO_TYPE.
Referenced by mi_refreshWatchers(), and update_subscription().
Definition at line 1439 of file presence/notify.c.
References ACTIVE_STATUS, pres_ev::agg_nbody, pres_ev::apply_auth_nbody, subscription::auth_rules_doc, build_dlg_t(), build_str_hdr(), subscription::contact, subscription::event, subscription::expires, pres_ev::free_body, free_cbparam(), free_tm_dlg(), get_p_notify_body(), get_wi_notify_body(), dlg::hooks, _str::len, LM_DBG, LM_ERR, LM_INFO, dlg::loc_uri, pres_ev::name, dlg_hooks::next_hop, NULL, p_tm_callback(), PENDING_STATUS, pkg_free, subscription::pres_uri, printf_subs(), subscription::reason, dlg::rem_uri, pres_ev::req_auth, _str::s, shm_dup_cbparam(), subscription::status, tm_binds::t_request_within, TERMINATED_STATUS, tmb, pres_ev::type, and WINFO_TYPE.
Referenced by handle_expired_subs(), and notify().
| c_back_param * shm_dup_cbparam | ( | subs_t * | subs | ) |
Definition at line 1713 of file presence/notify.c.
References wid_cback::ev_name, subscription::event, _str::len, LM_DBG, LM_ERR, pres_ev::name, NULL, wid_cback::pres_uri, subscription::pres_uri, _str::s, shm_malloc(), wid_cback::to_tag, and subscription::to_tag.
Referenced by send_notify_request().
Definition at line 1172 of file presence/notify.c.
References subscription::callid, subscription::expires, subscription::from_tag, _str::len, LM_ERR, subscription::local_cseq, subscription::next, NULL, printf_subs(), _str::s, subscription::status, subscription::to_tag, and subscription::version.
Referenced by get_subs_dialog().
Definition at line 1860 of file presence/notify.c.
References _str::len, watcher::next, _str::s, and watcher::uri.
Referenced by add_waiting_watchers().
| str str_body_col = str_init("body") |
Definition at line 70 of file presence/notify.c.
Referenced by get_sphere(), pres_htable_restore(), and update_presentity().
| str str_callid_col = str_init("callid") |
Definition at line 79 of file presence/notify.c.
Referenced by get_database_info(), restore_db_subs(), rls_notify_callback(), update_db_subs(), and update_subs_db().
| str str_contact_col = str_init("contact") |
Definition at line 83 of file presence/notify.c.
Referenced by restore_db_subs(), and update_db_subs().
| str str_domain_col = str_init("domain") |
Definition at line 69 of file presence/notify.c.
Referenced by get_resource_list(), get_sphere(), msg_presentity_clean(), pres_htable_restore(), update_presentity(), and xcapGetNewDoc().
| str str_etag_col = str_init("etag") |
Definition at line 76 of file presence/notify.c.
Referenced by get_resource_list(), msg_presentity_clean(), update_presentity(), and xcapGetNewDoc().
| str str_event_col = str_init("event") |
Definition at line 75 of file presence/notify.c.
Referenced by delete_db_subs(), get_database_info(), get_db_subs_auth(), get_sphere(), insert_db_subs_auth(), msg_presentity_clean(), pres_db_delete_status(), pres_htable_restore(), restore_db_subs(), update_db_subs(), update_presentity(), update_subs_db(), and update_watchers_status().
| str str_event_id_col = str_init("event_id") |
Definition at line 74 of file presence/notify.c.
Referenced by get_database_info(), restore_db_subs(), update_db_subs(), and update_subs_db().
| str str_expires_col = str_init("expires") |
Definition at line 84 of file presence/notify.c.
Referenced by msg_presentity_clean(), pres_htable_restore(), restore_db_subs(), rls_handle_notify(), rls_presentity_clean(), update_db_subs(), update_presentity(), and update_subs_db().
| str str_from_tag_col = str_init("from_tag") |
Definition at line 77 of file presence/notify.c.
Referenced by get_database_info(), restore_db_subs(), update_db_subs(), and update_subs_db().
| str str_id_col = str_init("id") |
| str str_inserted_time_col = str_init("inserted_time") |
Definition at line 91 of file presence/notify.c.
Referenced by insert_db_subs_auth(), and msg_watchers_clean().
| str str_local_contact_col = str_init("local_contact") |
Definition at line 88 of file presence/notify.c.
Referenced by restore_db_subs(), and update_db_subs().
| str str_local_cseq_col = str_init("local_cseq") |
Definition at line 80 of file presence/notify.c.
Referenced by get_database_info(), restore_db_subs(), update_db_subs(), and update_subs_db().
| str str_presentity_uri_col = str_init("presentity_uri") |
Definition at line 90 of file presence/notify.c.
Referenced by delete_db_subs(), get_database_info(), get_db_subs_auth(), insert_db_subs_auth(), pres_db_delete_status(), restore_db_subs(), update_db_subs(), update_subs_db(), and update_watchers_status().
| str str_reason_col = str_init("reason") |
Definition at line 86 of file presence/notify.c.
Referenced by get_database_info(), get_db_subs_auth(), insert_db_subs_auth(), pres_update_status(), restore_db_subs(), rls_handle_notify(), send_full_notify(), timer_send_notify(), update_db_subs(), update_subs_db(), and update_watchers_status().
| str str_received_time_col = str_init("received_time") |
| str str_record_route_col = str_init("record_route") |
Definition at line 82 of file presence/notify.c.
Referenced by get_database_info(), restore_db_subs(), and update_db_subs().
| str str_remote_cseq_col = str_init("remote_cseq") |
Definition at line 81 of file presence/notify.c.
Referenced by get_database_info(), restore_db_subs(), update_db_subs(), and update_subs_db().
| str str_sender_col = str_init("sender") |
| str str_socket_info_col = str_init("socket_info") |
Definition at line 87 of file presence/notify.c.
Referenced by restore_db_subs(), and update_db_subs().
| str str_status_col = str_init("status") |
Definition at line 85 of file presence/notify.c.
Referenced by get_database_info(), get_db_subs_auth(), insert_db_subs_auth(), msg_watchers_clean(), pres_update_status(), restore_db_subs(), update_db_subs(), update_subs_db(), and update_watchers_status().
| str str_to_domain_col = str_init("to_domain") |
Definition at line 71 of file presence/notify.c.
Referenced by get_database_info(), restore_db_subs(), and update_db_subs().
| str str_to_tag_col = str_init("to_tag") |
Definition at line 78 of file presence/notify.c.
Referenced by delete_db_subs(), get_database_info(), restore_db_subs(), rls_notify_callback(), update_db_subs(), and update_subs_db().
| str str_to_user_col = str_init("to_user") |
Definition at line 67 of file presence/notify.c.
Referenced by get_database_info(), restore_db_subs(), and update_db_subs().
| str str_username_col = str_init("username") |
Definition at line 68 of file presence/notify.c.
Referenced by get_resource_list(), get_sphere(), msg_presentity_clean(), pres_htable_restore(), update_presentity(), and xcapGetNewDoc().
| str str_version_col = str_init("version") |
Definition at line 89 of file presence/notify.c.
Referenced by get_database_info(), restore_db_subs(), update_db_subs(), and update_subs_db().
| str str_watcher_domain_col = str_init("watcher_domain") |
Definition at line 73 of file presence/notify.c.
Referenced by get_database_info(), get_db_subs_auth(), insert_db_subs_auth(), pres_db_delete_status(), pres_update_status(), restore_db_subs(), update_db_subs(), update_subs_db(), and update_watchers_status().
| str str_watcher_username_col = str_init("watcher_username") |
Definition at line 72 of file presence/notify.c.
Referenced by get_database_info(), get_db_subs_auth(), insert_db_subs_auth(), pres_db_delete_status(), pres_update_status(), restore_db_subs(), update_db_subs(), update_subs_db(), and update_watchers_status().
1.5.6