modules_k/presence/notify.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
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 Vamanu)
00027  */
00028 
00035 #include "../../str.h"
00036 #include "../../modules/tm/dlg.h"
00037 #include "subscribe.h"
00038 #include "presentity.h"
00039 
00040 #ifndef NOTIFY_H
00041 #define NOTIFY_H
00042 
00043 #define FULL_STATE_FLAG (1<<0)
00044 #define PARTIAL_STATE_FLAG (1<<1)
00045 
00046 #define PRES_LEN 8
00047 #define PWINFO_LEN 14
00048 #define BLA_LEN 10
00049 
00050 
00051 typedef struct watcher
00052 {
00053         str uri;
00054         str id;
00055         int status;
00056         str event;
00057         str display_name;
00058         str expiration;
00059         str duration_subscribed;
00060         struct watcher* next;
00061 }watcher_t;
00062 
00063 typedef struct wid_cback
00064 {
00065         str pres_uri;
00066         str ev_name;
00067         str to_tag;   /* to identify the exact record */
00068         str from_tag;
00069         str callid;
00070 }c_back_param;
00071 
00072 extern str str_to_user_col;
00073 extern str str_username_col;
00074 extern str str_domain_col;
00075 extern str str_body_col;
00076 extern str str_to_domain_col;
00077 extern str str_from_user_col;
00078 extern str str_from_domain_col;
00079 extern str str_watcher_username_col;
00080 extern str str_watcher_domain_col;
00081 extern str str_event_id_col;
00082 extern str str_event_col;
00083 extern str str_etag_col;
00084 extern str str_from_tag_col;
00085 extern str str_to_tag_col;
00086 extern str str_callid_col;
00087 extern str str_local_cseq_col;
00088 extern str str_remote_cseq_col;
00089 extern str str_record_route_col;
00090 extern str str_contact_col;
00091 extern str str_expires_col;
00092 extern str str_status_col;
00093 extern str str_reason_col;
00094 extern str str_socket_info_col;
00095 extern str str_local_contact_col;
00096 extern str str_version_col;
00097 extern str str_presentity_uri_col;
00098 extern str str_inserted_time_col;
00099 extern str str_received_time_col;
00100 extern str str_id_col;
00101 extern str str_sender_col;
00102 extern str str_updated_col;
00103 extern str str_updated_winfo_col;
00104 
00105 void PRINT_DLG(FILE* out, dlg_t* _d);
00106 
00107 void printf_subs(subs_t* subs);
00108 
00109 int query_db_notify(str* pres_uri,pres_ev_t* event, subs_t* watcher_subs );
00110 
00111 int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag,
00112                 str* rules_doc);
00113 int publ_notify_notifier(str pres_uri, pres_ev_t *event);
00114 int set_updated(subs_t *sub);
00115 int set_wipeer_subs_updated(str *pres_uri, pres_ev_t *event, int full);
00116 
00117 int notify(subs_t* subs, subs_t* watcher_subs, str* n_body,int force_null_body);
00118 
00119 int send_notify_request(subs_t* subs, subs_t * watcher_subs,
00120                 str* n_body,int force_null_body);
00121 
00122 char* get_status_str(int flag);
00123 
00124 str *get_p_notify_body(str pres_uri, pres_ev_t *event, str *etag, str *contact);
00125 void free_notify_body(str *body, pres_ev_t *ev);
00126 void pres_timer_send_notify(unsigned int ticks, void *param);
00127 #endif