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
00034 #ifndef _SL_H_
00035 #define _SL_H_
00036
00037 #include "../../sr_module.h"
00038 #include "../../parser/msg_parser.h"
00039
00040
00041 #define SLCB_REPLY_READY (1<<0)
00042 #define SLCB_ACK_FILTERED (1<<1)
00043
00047 typedef struct sl_cbp {
00048 unsigned int type;
00049 sip_msg_t *req;
00050 int code;
00051 str *reason;
00052 str *reply;
00053 struct dest_info *dst;
00054 void *cbp;
00055 } sl_cbp_t;
00056
00060 typedef void (*sl_cbf_f)(sl_cbp_t *slcbp);
00061
00065 typedef struct sl_cbelem {
00066 unsigned int type;
00067 sl_cbf_f cbf;
00068 void *cbp;
00069 struct sl_cbelem* next;
00070 } sl_cbelem_t;
00071
00072 void sl_destroy_callbacks_list(void);
00073
00074 typedef int (*sl_register_cb_f)(sl_cbelem_t *cbe);
00075 int sl_register_callback(sl_cbelem_t *cbe);
00076
00077 void sl_run_callbacks(unsigned int type, struct sip_msg *req,
00078 int code, char *reason, str *reply, struct dest_info *dst);
00079
00080
00081 typedef int (*get_reply_totag_f)(struct sip_msg *msg, str *tag);
00082 typedef int (*send_reply_f)(struct sip_msg *msg, int code, str *reason);
00083 typedef int (*sl_send_reply_f)(struct sip_msg *msg, int code, char *reason);
00084 typedef int (*sl_send_sreply_f)(struct sip_msg *msg, int code, str *reason);
00085 typedef int (*sl_send_dreply_f)(struct sip_msg *msg, int code, str *reason,
00086 str *tag);
00087
00091 typedef struct sl_api {
00092 sl_send_reply_f zreply;
00093 sl_send_sreply_f sreply;
00094 sl_send_dreply_f dreply;
00095 send_reply_f freply;
00096 get_reply_totag_f get_reply_totag;
00097 sl_register_cb_f register_cb;
00098 } sl_api_t;
00099
00100 typedef int (*bind_sl_f)(sl_api_t* api);
00101
00105 static inline int sl_load_api(sl_api_t *slb)
00106 {
00107 bind_sl_f bindsl;
00108
00109 bindsl = (bind_sl_f)find_export("bind_sl", 0, 0);
00110 if ( bindsl == 0) {
00111 LM_ERR("cannot find bind_sl\n");
00112 return -1;
00113 }
00114 if (bindsl(slb)==-1)
00115 {
00116 LM_ERR("cannot bind sl api\n");
00117 return -1;
00118 }
00119 return 0;
00120 }
00121
00122 #endif