modules_k/presence/presentity.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006 Voice Sistem S.R.L.
00003  *
00004  * This file is part of Kamailio, a free SIP server.
00005  *
00006  * Kamailio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version
00010  *
00011  * Kamailio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License 
00017  * along with this program; if not, write to the Free Software 
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  * History:
00021  * --------
00022  *  2006-08-15  initial version (Anca Vamanu)
00023  */
00024 
00032 #ifndef PRESENTITY_H
00033 #define PRESENTITY_H
00034 
00035 #include "../../str.h"
00036 #include "../../parser/msg_parser.h" 
00037 #include "event_list.h"
00038 //#include "presence.h"
00039 
00040 extern char prefix;
00041 
00042 typedef struct presentity
00043 {
00044         int presid;
00045         str user;
00046         str domain;
00047         pres_ev_t* event;
00048         str etag;
00049         str* sender;
00050         time_t expires;
00051         time_t received_time;
00052 } presentity_t;
00053 
00054 /* create new presentity */
00055 presentity_t* new_presentity( str* domain,str* user,int expires, 
00056                 pres_ev_t* event, str* etag, str* sender);
00057 
00058 /* update presentity in database */
00059 int update_presentity(struct sip_msg* msg,presentity_t* p,str* body,int t_new,
00060                 int* sent_reply, char* sphere);
00061 
00062 /* free memory */
00063 void free_presentity(presentity_t* p);
00064 
00065 char* generate_ETag(int publ_count);
00066 
00067 int pres_htable_restore(void);
00068 
00069 char* extract_sphere(str body);
00070 
00071 char* get_sphere(str* pres_uri);
00072 typedef char* (*pres_get_sphere_t)(str* pres_uri);
00073 
00074 int mark_presentity_for_delete(presentity_t *pres);
00075 int delete_presentity(presentity_t *pres);
00076 int delete_offline_presentities(str *pres_uri, pres_ev_t *event);
00077 
00078 #endif
00079