00001
00023 #ifndef _HT_MOD_API_H_
00024 #define _HT_MOD_API_H_
00025
00026 #include "../../sr_module.h"
00027 #include "../../usr_avp.h"
00028
00029 typedef int (*ht_api_set_cell_f)(str *hname, str *name, int type,
00030 int_str *val, int mode);
00031 typedef int (*ht_api_del_cell_f)(str *hname, str *name);
00032
00033 typedef int (*ht_api_set_cell_expire_f)(str *hname, str *name,
00034 int type, int_str *val);
00035 typedef int (*ht_api_get_cell_expire_f)(str *hname, str *name,
00036 unsigned int *val);
00037
00038 typedef int (*ht_api_rm_cell_re_f)(str *hname, str *sre, int mode);
00039 typedef int (*ht_api_count_cells_re_f)(str *hname, str *sre, int mode);
00040
00041 typedef struct htable_api {
00042 ht_api_set_cell_f set;
00043 ht_api_del_cell_f rm;
00044 ht_api_set_cell_expire_f set_expire;
00045 ht_api_get_cell_expire_f get_expire;
00046 ht_api_rm_cell_re_f rm_re;
00047 ht_api_count_cells_re_f count_re;
00048 } htable_api_t;
00049
00050 typedef int (*bind_htable_f)(htable_api_t* api);
00051 int bind_htable(htable_api_t* api);
00052
00056 static inline int htable_load_api(htable_api_t *api)
00057 {
00058 bind_htable_f bindhtable;
00059
00060 bindhtable = (bind_htable_f)find_export("bind_htable", 0, 0);
00061 if(bindhtable == 0) {
00062 LM_ERR("cannot find bind_htable\n");
00063 return -1;
00064 }
00065 if(bindhtable(api)<0)
00066 {
00067 LM_ERR("cannot bind htable api\n");
00068 return -1;
00069 }
00070 return 0;
00071 }
00072
00073 #endif