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 #ifndef _REGISTRAR_API_H_
00029 #define _REGISTRAR_API_H_
00030
00031 #include "../../sr_module.h"
00032 #include "../../parser/msg_parser.h"
00033
00034 typedef int (*regapi_save_f)(struct sip_msg *msg, char *table, int flags);
00035 int regapi_save(struct sip_msg *msg, char *table, int flags);
00036
00037 typedef int (*regapi_lookup_f)(struct sip_msg *msg, char *table);
00038 int regapi_lookup(struct sip_msg *msg, char *table);
00039
00043 typedef struct registrar_api {
00044 regapi_save_f save;
00045 regapi_lookup_f lookup;
00046 regapi_lookup_f registered;
00047 } registrar_api_t;
00048
00049 typedef int (*bind_registrar_f)(registrar_api_t* api);
00050 int bind_registrar(registrar_api_t* api);
00051
00055 static inline int registrar_load_api(registrar_api_t *api)
00056 {
00057 bind_registrar_f bindregistrar;
00058
00059 bindregistrar = (bind_registrar_f)find_export("bind_registrar", 0, 0);
00060 if(bindregistrar == 0) {
00061 LM_ERR("cannot find bind_registrar\n");
00062 return -1;
00063 }
00064 if (bindregistrar(api) < 0)
00065 {
00066 LM_ERR("cannot bind registrar api\n");
00067 return -1;
00068 }
00069 return 0;
00070 }
00071
00072
00073 #endif