1 /*
2 * presence module - presence server implementation
3 *
4 * Copyright (C) 2007 Voice Sistem S.R.L.
5 *
6 * This file is part of Kamailio, a free SIP server.
7 *
8 * Kamailio is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version
12 *
13 * Kamailio is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 */
23 /*! \file
24 * \brief Kamailio Presence :: Kamailio generic presence module
25 *
26 * \ingroup presence
27 */
28
29
30 #ifndef _PRES_BIND_H_
31 #define _PRES_BIND_H_
32
33 #include "event_list.h"
34 #include "hash.h"
35 #include "presentity.h"
36 #include "../../core/sr_module.h"
37
38 typedef int (*update_watchers_t)(str *pres_uri, pres_ev_t *ev, str *rules_doc);
39 typedef str *(*pres_get_presentity_t)(
40 str pres_uri, pres_ev_t *ev, str *etag, str *contact);
41 typedef void (*pres_free_presentity_t)(str *presentity, pres_ev_t *ev);
42 typedef int (*pres_auth_status_t)(
43 struct sip_msg *msg, str watcher_uri, str presentity_uri);
44 typedef int (*pres_handle_publish_t)(
45 struct sip_msg *msg, char *str1, char *str2);
46 typedef int (*pres_handle_subscribe0_t)(struct sip_msg *msg);
47 typedef int (*pres_handle_subscribe_t)(
48 struct sip_msg *msg, str watcher_user, str watcher_domain);
49 typedef int (*pres_update_presentity_t)(str *event, str *realm, str *user,
50 str *etag, str *sender, str *body, int expires, int new_t, int replace);
51 typedef int (*pres_refresh_watchers_t)(str *pres, str *event, int type);
52
53 typedef struct presence_api
54 {
55 add_event_t add_event;
56 contains_event_t contains_event;
57 search_event_t search_event;
58 get_event_list_t get_event_list;
59 update_watchers_t update_watchers_status;
60 /* subs hash table functions */
61 new_shtable_t new_shtable;
62 destroy_shtable_t destroy_shtable;
63 insert_shtable_t insert_shtable;
64 search_shtable_t search_shtable;
65 delete_shtable_t delete_shtable;
66 update_shtable_t update_shtable;
67 mem_copy_subs_t mem_copy_subs;
68 update_db_subs_t update_db_subs_timer;
69 extract_sdialog_info_t extract_sdialog_info;
70 pres_get_sphere_t get_sphere;
71 pres_get_presentity_t get_presentity;
72 pres_free_presentity_t free_presentity;
73 pres_auth_status_t pres_auth_status;
74 pres_handle_publish_t handle_publish;
75 pres_handle_subscribe0_t handle_subscribe0;
76 pres_handle_subscribe_t handle_subscribe;
77 pres_update_presentity_t update_presentity;
78 pres_refresh_watchers_t pres_refresh_watchers;
79 } presence_api_t;
80
81 int bind_presence(presence_api_t *api);
82
83 typedef int (*bind_presence_t)(presence_api_t *api);
84
presence_load_api(presence_api_t * api)85 inline static int presence_load_api(presence_api_t *api)
86 {
87 bind_presence_t bind_presence_exports;
88 if(!(bind_presence_exports =
89 (bind_presence_t)find_export("bind_presence", 1, 0))) {
90 LM_ERR("Failed to import bind_presence\n");
91 return -1;
92 }
93 return bind_presence_exports(api);
94 }
95
96 #endif
97