bind_presence.h

Go to the documentation of this file.
00001 /*
00002  * $Id: bind_presence.h 1979 2007-04-06 13:24:12Z anca_vamanu $
00003  *
00004  * presence module - presence server implementation
00005  *
00006  * Copyright (C) 2007 Voice Sistem S.R.L.
00007  *
00008  * This file is part of Kamailio, a free SIP server.
00009  *
00010  * Kamailio is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version
00014  *
00015  * Kamailio is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License 
00021  * along with this program; if not, write to the Free Software 
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  * History:
00025  * --------
00026  *  2007-04-17  initial version (Anca Vamanu)
00027  */
00035 #ifndef _PRES_BIND_H_
00036 #define _PRES_BIND_H_
00037 
00038 #include "event_list.h"
00039 #include "hash.h"
00040 #include "presentity.h"
00041 #include "../../sr_module.h"
00042 
00043 typedef int (*update_watchers_t)(str pres_uri, pres_ev_t* ev, str* rules_doc);
00044 typedef str* (*pres_get_presentity_t)(str pres_uri, pres_ev_t *ev, str *etag, str *contact);
00045 typedef void (*pres_free_presentity_t)(str *presentity, pres_ev_t *ev);
00046 typedef int (*pres_auth_status_t)(struct sip_msg* msg, str watcher_uri, str presentity_uri);
00047 typedef int (*pres_handle_publish_t)(struct sip_msg* msg, char *str1, char* str2);
00048 typedef int (*pres_handle_subscribe0_t)(struct sip_msg* msg);
00049 typedef int (*pres_handle_subscribe_t)(struct sip_msg* msg, str watcher_user, str watcher_domain);
00050 
00051 typedef struct presence_api {
00052         add_event_t add_event;
00053         contains_event_t contains_event;
00054         search_event_t search_event;
00055         get_event_list_t get_event_list;
00056         update_watchers_t update_watchers_status;
00057         /* subs hash table functions */
00058         new_shtable_t new_shtable;
00059         destroy_shtable_t destroy_shtable;
00060         insert_shtable_t insert_shtable;
00061         search_shtable_t search_shtable;
00062         delete_shtable_t delete_shtable;
00063         update_shtable_t update_shtable;
00064         mem_copy_subs_t  mem_copy_subs;
00065         update_db_subs_t update_db_subs_timer;
00066         extract_sdialog_info_t extract_sdialog_info;
00067         pres_get_sphere_t get_sphere;
00068         pres_get_presentity_t get_presentity;
00069         pres_free_presentity_t free_presentity;
00070         pres_auth_status_t pres_auth_status;
00071         pres_handle_publish_t handle_publish;
00072         pres_handle_subscribe0_t handle_subscribe0;
00073         pres_handle_subscribe_t handle_subscribe;
00074 } presence_api_t;
00075 
00076 int bind_presence(presence_api_t* api);
00077 
00078 typedef int (*bind_presence_t)(presence_api_t* api);
00079 
00080 inline static int presence_load_api(presence_api_t *api)
00081 {
00082         bind_presence_t bind_presence_exports;
00083         if (!(bind_presence_exports = (bind_presence_t)find_export("bind_presence", 1, 0)))
00084         {
00085                 LM_ERR("Failed to import bind_presence\n");
00086                 return -1;
00087         }
00088         return bind_presence_exports(api);
00089 }
00090 
00091 #endif
00092