send_subscribe.h

00001 /*
00002  * $Id$
00003  *
00004  * pua module - presence user agent module
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 
00025 
00026 #ifndef _PU_SEND_SUBSC_
00027 #define _PU_SEND_SUBSC_
00028 
00029 #include <time.h>
00030 
00031 #include "../../modules/tm/tm_load.h"
00032 #include "../../str.h"
00033 #include "hash.h"
00034 
00035 typedef struct subs_info
00036 {
00037         str id;
00038         str* pres_uri;
00039         str* watcher_uri;
00040         str* contact;
00041         str* remote_target;
00042         str* outbound_proxy;
00043         int event;
00044         str* extra_headers;
00045         int expires;
00046         int source_flag;
00047         int flag;         /*  it can be : INSERT_TYPE or UPDATE_TYPE; not compulsory */
00048         void* cb_param;  /* the parameter for the function to be called on the callback 
00049                                                  for the received reply; it must be allocated in share memory;
00050                                                  a reference to it will be found in the cb_param filed of the ua_pres_structure
00051                                                  receied as a parameter for the registered function*/
00052         int internal_update_flag;
00053 }subs_info_t;
00054 
00055 
00056 typedef int (*send_subscribe_t)(subs_info_t* subs);
00057 int send_subscribe(subs_info_t* subs);
00058 void subs_cback_func(struct cell *t, int type, struct tmcb_params *ps);
00059 str* subs_build_hdr(str* watcher_uri, int expires, int event, str* extra_headers);
00060 dlg_t* pua_build_dlg_t(ua_pres_t* presentity);
00061 ua_pres_t* subscribe_cbparam(subs_info_t* subs, int ua_flag);
00062 ua_pres_t* subs_cbparam_indlg(ua_pres_t* subs, int expires, int ua_flag);
00063 
00064 #endif