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
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 do{ \
00054 dest.s= (char*)buf+ size;\
00055 memcpy(dest.s, source.s, source.len);\
00056 dest.len= source.len;\
00057 size+= source.len; \
00058 } while(0);
00059
00060 #define PKG_MEM_TYPE 1<< 1
00061 #define SHM_MEM_TYPE 1<< 2
00062
00063
00064 struct subscription;
00065
00066 typedef struct subs_entry
00067 {
00068 struct subscription* entries;
00069 gen_lock_t lock;
00070 }subs_entry_t;
00071
00072 typedef subs_entry_t* shtable_t;
00073
00074 shtable_t new_shtable(int hash_size);
00075
00076 struct subscription* search_shtable(shtable_t htable, str callid,str to_tag,str from_tag,
00077 unsigned int hash_code);
00078
00079 int insert_shtable(shtable_t htable, unsigned int hash_code, struct subscription* subs);
00080
00081 int delete_shtable(shtable_t htable, unsigned int hash_code, str to_tag);
00082
00083 int update_shtable(shtable_t htable, unsigned int hash_code, struct subscription* subs,
00084 int type);
00085
00086 struct subscription* mem_copy_subs(struct subscription* s, int mem_type);
00087
00088 void free_subs_list(struct subscription* s_array, int mem_type, int ic);
00089
00090 void destroy_shtable(shtable_t htable, int hash_size);
00091
00092
00093 typedef shtable_t (*new_shtable_t)(int hash_size);
00094
00095 typedef struct subscription* (*search_shtable_t)(shtable_t htable, str callid,str to_tag,
00096 str from_tag, unsigned int hash_code);
00097
00098 typedef int (*insert_shtable_t)(shtable_t htable, unsigned int hash_code,
00099 struct subscription* subs);
00100
00101 typedef int (*delete_shtable_t)(shtable_t htable, unsigned int hash_code,
00102 str to_tag);
00103
00104 typedef int (*update_shtable_t)(shtable_t htable, unsigned int hash_code,
00105 struct subscription* subs, int type);
00106
00107 typedef void (*destroy_shtable_t)(shtable_t htable, int hash_size);
00108
00109 typedef struct subscription* (*mem_copy_subs_t)(struct subscription* s, int mem_type);
00110
00111
00112
00113 typedef struct pres_entry
00114 {
00115 str pres_uri;
00116 int event;
00117 int publ_count;
00118 char* sphere;
00119 struct pres_entry* next;
00120 }pres_entry_t;
00121
00122 typedef struct pres_htable
00123 {
00124 pres_entry_t* entries;
00125 gen_lock_t lock;
00126 }phtable_t;
00127
00128 phtable_t* new_phtable(void);
00129
00130 pres_entry_t* search_phtable(str* pres_uri, int event, unsigned int hash_code);
00131
00132 int insert_phtable(str* pres_uri, int event, char* sphere);
00133
00134 int update_phtable(struct presentity* presentity, str pres_uri, str body);
00135
00136 int delete_phtable(str* pres_uri, int event);
00137
00138 void destroy_phtable(void);
00139
00140 #endif
00141