1 /* 2 * Copyright (C) 2006 Voice Sistem SRL 3 * 4 * This file is part of Kamailio, a free SIP server. 5 * 6 * Kamailio is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * Kamailio is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 * 20 */ 21 22 /*! 23 * \file 24 * \brief Kamailio presence module :: Core 25 * \ingroup presence 26 */ 27 28 29 #ifndef PA_MOD_H 30 #define PA_MOD_H 31 32 #include "../../core/parser/msg_parser.h" 33 #include "../../modules/tm/tm_load.h" 34 #include "../../modules/sl/sl.h" 35 #include "../../lib/srdb1/db.h" 36 #include "../../core/parser/parse_from.h" 37 #include "../../core/utils/sruid.h" 38 #include "event_list.h" 39 #include "hash.h" 40 41 /* DB modes */ 42 43 /** subscriptions are stored only in memory */ 44 #define NO_DB 0 45 /** subscriptions are written in memory and in DB synchronously and read only from memory */ 46 #define WRITE_THROUGH 1 47 /** subscriptions are stored in memory and periodically updated in DB */ 48 #define WRITE_BACK 2 49 /** subscriptions are stored only in database */ 50 #define DB_ONLY 3 51 52 #define NO_UPDATE_TYPE -1 53 #define UPDATED_TYPE 1 54 55 #define PS_PCACHE_NONE 0 56 #define PS_PCACHE_HYBRID 1 57 #define PS_PCACHE_RECORD 2 58 59 /** TM bind */ 60 extern struct tm_binds tmb; 61 62 extern sl_api_t slb; 63 64 /* DB module bind */ 65 extern db_func_t pa_dbf; 66 extern db1_con_t *pa_db; 67 68 /* PRESENCE database */ 69 extern str pres_db_url; 70 extern str presentity_table; 71 extern str active_watchers_table; 72 extern str watchers_table; 73 74 extern int pres_counter; 75 extern int pres_pid; 76 extern int pres_startup_time; 77 extern int pres_expires_offset; 78 extern int pres_cseq_offset; 79 extern str pres_server_address; 80 extern uint32_t pres_min_expires; 81 extern int pres_min_expires_action; 82 extern uint32_t pres_max_expires; 83 extern int pres_subs_dbmode; 84 extern int publ_cache_mode; 85 extern int pres_sphere_enable; 86 extern int pres_timeout_rm_subs; 87 extern int pres_send_fast_notify; 88 extern int shtable_size; 89 extern shtable_t subs_htable; 90 91 extern int pres_fetch_rows; 92 93 extern int pres_waitn_time; 94 extern int pres_notifier_poll_rate; 95 extern int pres_notifier_processes; 96 extern int pres_force_delete; 97 extern int pres_startup_mode; 98 extern str pres_xavp_cfg; 99 extern int pres_retrieve_order; 100 extern str pres_retrieve_order_by; 101 extern int pres_enable_dmq; 102 103 extern int phtable_size; 104 extern phtable_t *pres_htable; 105 106 extern sruid_t pres_sruid; 107 108 extern db_locking_t pres_db_table_lock; 109 110 int update_watchers_status(str *pres_uri, pres_ev_t *ev, str *rules_doc); 111 int pres_auth_status(struct sip_msg *msg, str watcher_uri, str presentity_uri); 112 int _api_pres_refresh_watchers(str *pres, str *event, int type); 113 114 typedef int (*sip_uri_match_f)(str *s1, str *s2); 115 extern sip_uri_match_f presence_sip_uri_match; 116 117 int pv_get_subscription( 118 struct sip_msg *msg, pv_param_t *param, pv_value_t *res); 119 int pv_parse_subscription_name(pv_spec_p sp, str *in); 120 121 #endif /* PA_MOD_H */ 122