2 * Copyright (C) 2006 Voice Sistem SRL
4 * This file is part of Kamailio, a free SIP server.
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.
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.
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.
24 * \brief Kamailio presence module :: Core
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"
43 /** subscriptions are stored only in memory */
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 */
49 /** subscriptions are stored only in database */
52 #define NO_UPDATE_TYPE -1
53 #define UPDATED_TYPE 1
55 #define PS_PCACHE_NONE 0
56 #define PS_PCACHE_HYBRID 1
57 #define PS_PCACHE_RECORD 1
60 extern struct tm_binds tmb;
65 extern db_func_t pa_dbf;
66 extern db1_con_t *pa_db;
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;
74 extern int pres_counter;
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;
91 extern int pres_fetch_rows;
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;
103 extern int phtable_size;
104 extern phtable_t *pres_htable;
106 extern sruid_t pres_sruid;
108 extern db_locking_t pres_db_table_lock;
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);
114 typedef int (*sip_uri_match_f)(str *s1, str *s2);
115 extern sip_uri_match_f presence_sip_uri_match;
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);
121 #endif /* PA_MOD_H */