presence/hash.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef PS_HASH_H
00037 #define PS_HASH_H
00038
00039 #include "../../lock_ops.h"
00040
00041
00042 struct presentity;
00043 #define REMOTE_TYPE 1<<1
00044 #define LOCAL_TYPE 1<<2
00045
00046 #define PKG_MEM_STR "pkg"
00047 #define SHARE_MEM "share"
00048
00049 #define ERR_MEM(mem_type) LM_ERR("No more %s memory\n",mem_type);\
00050 goto error
00051
00052 #define CONT_COPY(buf, dest, source)\
00053 dest.s= (char*)buf+ size;\
00054 memcpy(dest.s, source.s, source.len);\
00055 dest.len= source.len;\
00056 size+= source.len;
00057
00058 #define PKG_MEM_TYPE 1<< 1
00059 #define SHM_MEM_TYPE 1<< 2
00060
00061
00062 struct subscription;
00063
00064 typedef struct subs_entry
00065 {
00066 struct subscription* entries;
00067 gen_lock_t lock;
00068 }subs_entry_t;
00069
00070 typedef subs_entry_t* shtable_t;
00071
00072 shtable_t new_shtable(int hash_size);
00073
00074 struct subscription* search_shtable(shtable_t htable, str callid,str to_tag,str from_tag,
00075 unsigned int hash_code);
00076
00077 int insert_shtable(shtable_t htable, unsigned int hash_code, struct subscription* subs);
00078
00079 int delete_shtable(shtable_t htable, unsigned int hash_code, str to_tag);
00080
00081 int update_shtable(shtable_t htable, unsigned int hash_code, struct subscription* subs,
00082 int type);
00083
00084 struct subscription* mem_copy_subs(struct subscription* s, int mem_type);
00085
00086 void free_subs_list(struct subscription* s_array, int mem_type, int ic);
00087
00088 void destroy_shtable(shtable_t htable, int hash_size);
00089
00090
00091 typedef shtable_t (*new_shtable_t)(int hash_size);
00092
00093 typedef struct subscription* (*search_shtable_t)(shtable_t htable, str callid,str to_tag,
00094 str from_tag, unsigned int hash_code);
00095
00096 typedef int (*insert_shtable_t)(shtable_t htable, unsigned int hash_code,
00097 struct subscription* subs);
00098
00099 typedef int (*delete_shtable_t)(shtable_t htable, unsigned int hash_code,
00100 str to_tag);
00101
00102 typedef int (*update_shtable_t)(shtable_t htable, unsigned int hash_code,
00103 struct subscription* subs, int type);
00104
00105 typedef void (*destroy_shtable_t)(shtable_t htable, int hash_size);
00106
00107 typedef struct subscription* (*mem_copy_subs_t)(struct subscription* s, int mem_type);
00108
00109
00110
00111 typedef struct pres_entry
00112 {
00113 str pres_uri;
00114 int event;
00115 int publ_count;
00116 char* sphere;
00117 struct pres_entry* next;
00118 }pres_entry_t;
00119
00120 typedef struct pres_htable
00121 {
00122 pres_entry_t* entries;
00123 gen_lock_t lock;
00124 }phtable_t;
00125
00126 phtable_t* new_phtable(void);
00127
00128 pres_entry_t* search_phtable(str* pres_uri, int event, unsigned int hash_code);
00129
00130 int insert_phtable(str* pres_uri, int event, char* sphere);
00131
00132 int update_phtable(struct presentity* presentity, str pres_uri, str body);
00133
00134 int delete_phtable(str* pres_uri, int event);
00135
00136 void destroy_phtable(void);
00137
00138 #endif
00139