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 #ifndef PUA_CBACK
00026 #define PUA_CBACK
00027
00028 #include "../../parser/parse_fline.h"
00029 #include "../pua/hash.h"
00030
00031 #define PUACB_MAX (1<<9)
00032
00033
00034 typedef int (pua_cb)(ua_pres_t* hentity, struct sip_msg*);
00035
00036 typedef int (*register_puacb_t)(int types, pua_cb f, void* param );
00037
00038
00039 struct pua_callback {
00040 int id;
00041 int types;
00042 pua_cb* callback;
00043 void* param;
00044 struct pua_callback* next;
00045 };
00046
00047 struct puacb_head_list {
00048 struct pua_callback *first;
00049 int reg_types;
00050 };
00051
00052
00053 extern struct puacb_head_list* puacb_list;
00054
00055 int init_puacb_list(void);
00056
00057 void destroy_puacb_list(void);
00058
00059
00060
00061 int register_puacb( int types, pua_cb f, void* param );
00062
00063
00064 static inline void run_pua_callbacks(ua_pres_t* hentity, struct sip_msg* msg)
00065 {
00066 struct pua_callback *cbp;
00067
00068 for (cbp= puacb_list->first; cbp; cbp=cbp->next) {
00069 if(cbp->types & hentity->flag)
00070 {
00071 LM_DBG("found callback\n");
00072 cbp->callback(hentity, msg);
00073 }
00074 }
00075 }
00076
00077
00078 #endif