Go to the documentation of this file.00001
00031 #ifndef _DISPATCHER_API_H_
00032 #define _DISPATCHER_API_H_
00033
00034 #include "../../sr_module.h"
00035
00036 typedef int (*ds_select_dst_f)(struct sip_msg *msg, int set,
00037 int alg, int mode);
00038 typedef int (*ds_next_dst_f)(struct sip_msg *msg, int mode);
00039 typedef int (*ds_mark_dst_f)(struct sip_msg *msg, int mode);
00040
00041 typedef int (*ds_is_from_list_f)(struct sip_msg *_m, int group);
00042
00043 typedef struct dispatcher_api {
00044 ds_select_dst_f select;
00045 ds_next_dst_f next;
00046 ds_mark_dst_f mark;
00047 ds_is_from_list_f is_from;
00048 } dispatcher_api_t;
00049
00050 typedef int (*bind_dispatcher_f)(dispatcher_api_t* api);
00051 int bind_dispatcher(dispatcher_api_t* api);
00052
00056 static inline int dispatcher_load_api(dispatcher_api_t *api)
00057 {
00058 bind_dispatcher_f binddispatcher;
00059
00060 binddispatcher = (bind_dispatcher_f)find_export("bind_dispatcher", 0, 0);
00061 if(binddispatcher == 0) {
00062 LM_ERR("cannot find bind_dispatcher\n");
00063 return -1;
00064 }
00065 if(binddispatcher(api)<0)
00066 {
00067 LM_ERR("cannot bind dispatcher api\n");
00068 return -1;
00069 }
00070 return 0;
00071 }
00072
00073
00074 #endif
00075