tuple.h

00001 #ifndef __TUPLE_H
00002 #define __TUPLE_H
00003 
00004 /* PA tuple functions (data structures are defined in presentity.h) */
00005 
00006 #include "presentity.h"
00007 
00008 /* Create a new presence_tuple */
00009 int new_presence_tuple(str* _contact, time_t expires, 
00010                 presence_tuple_t ** _t, int is_published, str *id,
00011                 str *published_id, str *etag);
00012 
00013 /* add presence tuple to presentity and to database */
00014 void add_presence_tuple(presentity_t *_p, presence_tuple_t *_t);
00015 
00016 /* Remove tuple from presentity and from database too */
00017 void remove_presence_tuple(presentity_t *_p, presence_tuple_t *_t);
00018 
00019 /* Free all memory associated with a presence_tuple */
00020 void free_presence_tuple(presence_tuple_t * _t);
00021 
00022 /* Find a tuple for contact _contact on presentity _p - only registered contacts ! */
00023 int find_registered_presence_tuple(str* _contact, presentity_t *_p, presence_tuple_t ** _t);
00024 
00025 /* Find tuple with given id */
00026 int find_presence_tuple_id(str* id, presentity_t *_p, presence_tuple_t ** _t);
00027 
00028 /* Find published tuple with given ID (ID used for publication, not tuple ID!) */
00029 presence_tuple_t *find_published_tuple(presentity_t *presentity, str *etag, str *id);
00030 
00032 int db_read_tuples(presentity_t *_p, db_con_t* db);
00033 
00034 /* update tuple status in database */
00035 int db_update_presence_tuple(presentity_t *_p, presence_tuple_t *t, int update_notes_and_ext);
00036 
00037 /* creates new tuple from given information (needed for publishing */
00038 presence_tuple_t *presence_tuple_info2pa(presence_tuple_info_t *i, str *etag, time_t expires);
00039 
00040 /* updates published information */
00041 void update_tuple(presentity_t *p, presence_tuple_t *t, presence_tuple_info_t *i, time_t expires);
00042 
00043 #endif