presence/subscribe.h

Go to the documentation of this file.
00001 /*
00002  * $Id: subscribe.h 5619 2009-02-18 18:33:43Z miconda $
00003  *
00004  * presence module - presence server implementation
00005  *
00006  * Copyright (C) 2006 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  *  2006-08-15  initial version (anca)
00027  */
00028 
00029 /*! \file
00030  * \brief Kamailio presence module :: SUBSCRIBE support
00031  * \ref subscribe.c
00032  * \ingroup presence 
00033  */
00034 
00035 
00036 #ifndef SUBSCRIBE_H
00037 #define SUBSCRIBE_H
00038 
00039 //#include "presence.h"
00040 #include "../../str.h"
00041 #include "../../db/db.h"
00042 
00043 struct pres_ev;
00044 
00045 #include "event_list.h"
00046 #include "hash.h"
00047 
00048 #define ACTIVE_STATUS        1
00049 #define PENDING_STATUS       2
00050 #define TERMINATED_STATUS    3
00051 #define WAITING_STATUS       4
00052 
00053 struct subscription
00054 {
00055    str pres_uri;
00056    str to_user;
00057    str to_domain;
00058    str from_user;
00059    str from_domain;
00060    struct pres_ev* event;
00061    str event_id;
00062    str to_tag;
00063    str from_tag;
00064    str callid;
00065    str sockinfo_str;
00066    unsigned int remote_cseq; 
00067    unsigned int local_cseq; 
00068    str contact;
00069    str local_contact;
00070    str record_route;
00071    unsigned int expires;
00072    unsigned int status;
00073    str reason;
00074    int version;
00075    int send_on_cback;
00076    int db_flag;
00077    str* auth_rules_doc;
00078    struct subscription* next;
00079 
00080 };
00081 typedef struct subscription subs_t;
00082 
00083 void msg_active_watchers_clean(unsigned int ticks,void *param);
00084 
00085 void msg_watchers_clean(unsigned int ticks,void *param);
00086 
00087 int handle_subscribe(struct sip_msg*, char*, char*);
00088 
00089 int delete_db_subs(str pres_uri, str ev_stored_name, str to_tag);
00090 
00091 void timer_db_update(unsigned int ticks,void *param);
00092 
00093 int update_subs_db(subs_t* subs, int type);
00094 
00095 int refresh_watcher(str* pres_uri, str* watcher_uri, str* event, 
00096    int status, str* reason);
00097 
00098 typedef int (*refresh_watcher_t)(str*, str* , str* ,int , str* );
00099 
00100 int restore_db_subs(void);
00101 
00102 typedef int (*handle_expired_func_t)(subs_t* );
00103 
00104 void update_db_subs(db_con_t *db,db_func_t dbf, shtable_t hash_table,
00105    int htable_size, int no_lock, handle_expired_func_t handle_expired_func);
00106 
00107 typedef void (*update_db_subs_t)(db_con_t * ,db_func_t ,shtable_t ,int ,int ,
00108       handle_expired_func_t);
00109 
00110 int extract_sdialog_info(subs_t* subs,struct sip_msg* msg, int max_expire,
00111       int* to_tag_gen, str scontact);
00112 typedef int (*extract_sdialog_info_t)(subs_t* subs, struct sip_msg* msg,
00113       int max_expire, int* to_tag_gen, str scontact);
00114 
00115 #endif

Generated on Thu May 24 08:00:55 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6