#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 "../../db/db.h"
#include "../../sr_module.h"
#include "../../dprint.h"
#include "../../error.h"
#include "../../ut.h"
#include "../../parser/parse_to.h"
#include "../../parser/parse_uri.h"
#include "../../parser/parse_content.h"
#include "../../parser/parse_from.h"
#include "../../mem/mem.h"
#include "../../mem/shm_mem.h"
#include "../../usr_avp.h"
#include "../tm/tm_load.h"
#include "../sl/sl_api.h"
#include "../../pt.h"
#include "../../mi/mi.h"
#include "../pua/hash.h"
#include "publish.h"
#include "subscribe.h"
#include "event_list.h"
#include "bind_presence.h"
#include "notify.h"

Go to the source code of this file.
Defines | |
| #define | ACTWATCH_TABLE_VERSION 9 |
| #define | P_TABLE_VERSION 3 |
| #define | S_TABLE_VERSION 3 |
Functions | |
| static int | child_init (int) |
| static void | destroy (void) |
| static int | fixup_presence (void **param, int param_no) |
| static int | fixup_subscribe (void **param, int param_no) |
| static int | mi_child_init (void) |
| static struct mi_root * | mi_cleanup (struct mi_root *cmd, void *param) |
| static struct mi_root * | mi_refreshWatchers (struct mi_root *cmd, void *param) |
| mi cmd: refreshWatchers <presentity_uri> <event> <refresh_type> // can be: = 0 -> watchers autentification type or != 0 -> publish type // * | |
| static int | mod_init (void) |
| int | pres_db_delete_status (subs_t *s) |
| int | pres_update_status (subs_t subs, str reason, db_key_t *query_cols, db_val_t *query_vals, int n_query_cols, subs_t **subs_array) |
| int | stored_pres_info (struct sip_msg *msg, char *pres_uri, char *s) |
| static int | update_pw_dialogs (subs_t *subs, unsigned int hash_code, subs_t **subs_array) |
| int | update_watchers_status (str pres_uri, pres_ev_t *ev, str *rules_doc) |
Variables | |
| str | active_watchers_table = str_init("active_watchers") |
| static int | clean_period = 100 |
| static cmd_export_t | cmds [] |
| int | counter = 0 |
| static int | db_update_period = 100 |
| str | db_url = {0, 0} |
| evlist_t * | EvList = NULL |
| int | expires_offset = 0 |
| struct module_exports | exports |
| int | fallback2db = 0 |
| int | library_mode = 0 |
| char * | log_buf = NULL |
| int | max_expires = 3600 |
| static mi_export_t | mi_cmds [] |
| db_con_t * | pa_db = NULL |
| db_func_t | pa_dbf |
| static param_export_t | params [] |
| int | phtable_size = 9 |
| int | pid = 0 |
| char | prefix = 'a' |
| phtable_t * | pres_htable |
| str | presentity_table = str_init("presentity") |
| str | server_address = {0, 0} |
| int | shtable_size = 9 |
| struct sl_binds | slb |
| int | sphere_enable = 0 |
| int | startup_time = 0 |
| shtable_t | subs_htable = NULL |
| struct tm_binds | tmb |
| char * | to_tag_pref = "10" |
| str | watchers_table = str_init("watchers") |
Definition in file presence.c.
| #define ACTWATCH_TABLE_VERSION 9 |
| #define P_TABLE_VERSION 3 |
| #define S_TABLE_VERSION 3 |
Definition at line 79 of file presence.c.
| static int child_init | ( | int | rank | ) | [static] |
Initialize children
Definition at line 341 of file presence.c.
References db_func::init, library_mode, LM_CRIT, LM_DBG, LM_ERR, my_pid(), pid, and db_func::use_table.
| static void destroy | ( | void | ) | [static] |
| static int fixup_presence | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 444 of file presence.c.
References E_UNSPEC, _str::len, library_mode, LM_ERR, pv_parse_format(), _str::s, and s.
| static int fixup_subscribe | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
| static int mi_child_init | ( | void | ) | [static] |
Definition at line 384 of file presence.c.
References db_func::init, library_mode, LM_CRIT, LM_DBG, LM_ERR, and db_func::use_table.
Definition at line 615 of file presence.c.
References init_mi_tree(), LM_DBG, MI_OK_LEN, MI_OK_S, msg_presentity_clean(), and msg_watchers_clean().
mi cmd: refreshWatchers <presentity_uri> <event> <refresh_type> // can be: = 0 -> watchers autentification type or != 0 -> publish type // *
Definition at line 494 of file presence.c.
References contains_event(), sip_uri::host, init_mi_tree(), mi_node::kids, _str::len, LM_DBG, LM_ERR, mi_node::next, mi_root::node, NULL, parse_uri(), pkg_free, query_db_notify(), s, _str::s, str2int(), update_watchers_status(), sip_uri::user, and mi_node::value.
| static int mod_init | ( | void | ) | [static] |
module functions
init module function
Definition at line 187 of file presence.c.
References ACTWATCH_TABLE_VERSION, clean_period, db_func::close, db_bind_mod(), DB_CAP_ALL, DB_CAPABILITY, db_check_table_version(), db_update_period, expires_offset, db_func::init, init_evlist(), _str::len, library_mode, LM_DBG, LM_ERR, load_sl_api(), load_tm_api(), max_expires, msg_presentity_clean(), msg_watchers_clean(), new_phtable(), new_shtable(), NULL, P_TABLE_VERSION, phtable_size, pres_htable_restore(), register_timer(), restore_db_subs(), _str::s, S_TABLE_VERSION, shtable_size, slb, startup_time, timer_db_update(), tmb, to_tag_pref, and ZSW.
| int pres_db_delete_status | ( | subs_t * | s | ) |
Definition at line 703 of file presence.c.
References DB_STR, db_func::delete, subscription::event, subscription::from_domain, subscription::from_user, LM_ERR, pres_ev::name, db_val_t::nul, subscription::pres_uri, str_event_col, str_presentity_uri_col, db_val_t::str_val, str_watcher_domain_col, str_watcher_username_col, db_val_t::type, db_func::use_table, and db_val_t::val.
Referenced by update_watchers_status().
| int pres_update_status | ( | subs_t | subs, | |
| str | reason, | |||
| db_key_t * | query_cols, | |||
| db_val_t * | query_vals, | |||
| int | n_query_cols, | |||
| subs_t ** | subs_array | |||
| ) |
Definition at line 625 of file presence.c.
References subscription::db_flag, DB_INT, DB_STR, subscription::event, subscription::from_domain, subscription::from_user, pres_ev::get_auth_status, get_status_str(), db_val_t::int_val, _str::len, LM_DBG, LM_ERR, db_val_t::nul, NULL, subscription::pres_uri, subscription::reason, _str::s, subscription::status, 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::update, update_pw_dialogs(), db_func::use_table, and db_val_t::val.
Referenced by update_watchers_status().
| int stored_pres_info | ( | struct sip_msg * | msg, | |
| char * | pres_uri, | |||
| char * | s | |||
| ) |
| static int update_pw_dialogs | ( | subs_t * | subs, | |
| unsigned int | hash_code, | |||
| subs_t ** | subs_array | |||
| ) | [static] |
Definition at line 1013 of file presence.c.
References subscription::contact, subscription::db_flag, subs_entry::entries, subscription::event, subscription::expires, subscription::from_domain, subscription::from_user, _str::len, LM_DBG, LM_ERR, lock, mem_copy_subs(), subscription::next, NULL, PKG_MEM_TYPE, subscription::pres_uri, printf_subs(), subscription::reason, _str::s, s, shm_free, subscription::status, TERMINATED_STATUS, and UPDATEDB_FLAG.
Referenced by pres_update_status().
Definition at line 748 of file presence.c.
References subscription::auth_rules_doc, contains_event(), pres_ev::content_type, core_hash(), subscription::db_flag, DB_STR, subscription::event, db_func::free_result, free_subs_list(), subscription::from_domain, subscription::from_user, db_val_t::int_val, _str::len, LM_DBG, LM_ERR, db_res::n, pres_ev::name, notify(), db_val_t::nul, NULL, pkg_free, pkg_malloc, PKG_MEM_TYPE, pres_db_delete_status(), pres_update_status(), subscription::pres_uri, db_func::query, subscription::reason, mi_root::reason, reason_col, ROW_VALUES, db_res::rows, _str::s, s, shtable_size, sphere_enable, 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, TERMINATED_STATUS, db_val_t::type, db_func::use_table, and db_val_t::val.
Referenced by bind_presence(), mi_refreshWatchers(), and update_phtable().
| str active_watchers_table = str_init("active_watchers") |
Definition at line 91 of file presence.c.
Referenced by delete_db_subs(), get_database_info(), get_subs_db(), get_wi_subs_db(), restore_db_subs(), timer_db_update(), and update_subs_db().
int clean_period = 100 [static] |
cmd_export_t cmds[] [static] |
Definition at line 135 of file presence.c.
| int counter = 0 |
Definition at line 120 of file presence.c.
Referenced by generate_ETag(), handle_publish(), handle_subscribe(), MD5File(), mod_init(), and modem_process().
int db_update_period = 100 [static] |
Definition at line 85 of file presence.c.
Definition at line 124 of file presence.c.
Definition at line 96 of file presence.c.
Referenced by add_event(), destroy_evlist(), get_event_list(), restore_db_subs(), search_event(), and send_error_reply().
| int expires_offset = 0 |
| struct module_exports exports |
module exports
Definition at line 169 of file presence.c.
| int fallback2db = 0 |
Definition at line 129 of file presence.c.
Referenced by get_p_notify_body(), get_sphere(), get_stored_info(), get_subs_dialog(), get_wi_notify_body(), notify(), and update_subscription().
| int library_mode = 0 |
Definition at line 94 of file presence.c.
Referenced by child_init(), fixup_presence(), fixup_subscribe(), mi_child_init(), and mod_init().
| char* log_buf = NULL |
| int max_expires = 3600 |
Definition at line 126 of file presence.c.
Referenced by calc_contact_expires(), child_init(), handle_publish(), handle_subscribe(), and mod_init().
mi_export_t mi_cmds[] [static] |
Initial value:
{
{ "refreshWatchers", mi_refreshWatchers, 0, 0, mi_child_init},
{ "cleanup", mi_cleanup, 0, 0, mi_child_init},
{ 0, 0, 0, 0, 0}
}
Definition at line 162 of file presence.c.
Definition at line 88 of file presence.c.
Referenced by add_waiting_watchers(), delete_db_subs(), find_accounts(), find_sip_user(), find_users(), get_database_info(), get_db_subs_auth(), get_p_notify_body(), get_sphere(), get_subs_db(), get_wi_subs_db(), insert_db_subs_auth(), msg_presentity_clean(), msg_watchers_clean(), pres_htable_restore(), restore_db_subs(), timer_db_update(), update_presentity(), and update_subs_db().
Definition at line 89 of file presence.c.
Referenced by add_waiting_watchers(), delete_db_subs(), get_database_info(), get_db_subs_auth(), get_p_notify_body(), get_sphere(), get_subs_db(), get_wi_subs_db(), insert_db_subs_auth(), msg_presentity_clean(), msg_watchers_clean(), pres_htable_restore(), restore_db_subs(), timer_db_update(), update_presentity(), and update_subs_db().
param_export_t params[] [static] |
Definition at line 144 of file presence.c.
| int phtable_size = 9 |
Definition at line 132 of file presence.c.
Referenced by delete_phtable(), destroy_phtable(), get_p_notify_body(), get_sphere(), insert_phtable(), mod_init(), new_phtable(), and update_phtable().
| int pid = 0 |
Definition at line 121 of file presence.c.
Referenced by child_init(), daemonize(), flat_get_connection(), generate_ETag(), handle_sigs(), internal_fork(), kill_all_children(), main_loop(), mi_ps(), seas_child_init(), send_mail(), sigchld(), spawn_action_dispatcher(), start_stats_server(), start_timer_processes(), stop_stats_server(), and xmlrpc_sigchld().
| char prefix = 'a' |
pstn prefix
Definition at line 122 of file presence.c.
Definition at line 133 of file presence.c.
| str presentity_table = str_init("presentity") |
Definition at line 90 of file presence.c.
Referenced by get_p_notify_body(), get_sphere(), msg_presentity_clean(), pres_htable_restore(), and update_presentity().
| str server_address = {0, 0} |
Definition at line 95 of file presence.c.
Referenced by bla_cb(), handle_subscribe(), request_winfo(), and rls_handle_subscribe().
| int shtable_size = 9 |
Definition at line 127 of file presence.c.
Referenced by get_stored_info(), get_subs_dialog(), get_wi_notify_body(), mod_init(), notify(), p_tm_callback(), refresh_watcher(), restore_db_subs(), timer_db_update(), update_subscription(), and update_watchers_status().
SL binds
Definition at line 104 of file presence.c.
| int sphere_enable = 0 |
Definition at line 130 of file presence.c.
Referenced by get_sphere(), handle_publish(), pres_htable_restore(), update_presentity(), and update_watchers_status().
| int startup_time = 0 |
| shtable_t subs_htable = NULL |
Definition at line 128 of file presence.c.
Referenced by get_stored_info(), get_subs_dialog(), get_wi_notify_body(), notify(), p_tm_callback(), refresh_watcher(), restore_db_subs(), timer_db_update(), and update_subscription().
TM bind
Definition at line 102 of file presence.c.
| char* to_tag_pref = "10" |
| str watchers_table = str_init("watchers") |
Definition at line 92 of file presence.c.
Referenced by add_waiting_watchers(), get_db_subs_auth(), insert_db_subs_auth(), and msg_watchers_clean().
1.5.6