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
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _TM_BIND_H
00037 #define _TM_BIND_H
00038
00039 #include "defs.h"
00040
00041
00042 #include "../../sr_module.h"
00043 #include "t_hooks.h"
00044 #include "uac.h"
00045 #include "t_fwd.h"
00046 #include "t_lookup.h"
00047 #include "t_reply.h"
00048 #include "dlg.h"
00049 #include "callid.h"
00050 #include "t_cancel.h"
00051 #include "t_suspend.h"
00052 #include "t_stats.h"
00053
00054
00055 #define NO_SCRIPT -1
00056
00057 struct tm_binds {
00058 register_tmcb_f register_tmcb;
00059 cmd_function t_relay_to_udp;
00060 cmd_function t_relay_to_tcp;
00061 cmd_function t_relay;
00062 treplicate_uri_f t_replicate;
00063 tnewtran_f t_newtran;
00064 treply_f t_reply;
00065 treply_wb_f t_reply_with_body;
00066 tislocal_f t_is_local;
00067 tget_ti_f t_get_trans_ident;
00068 tlookup_ident_f t_lookup_ident;
00069 taddblind_f t_addblind;
00070 treply_f t_reply_unsafe;
00071 treply_trans_f t_reply_trans;
00072 tfwd_f t_forward_nonack;
00073 reqwith_t t_request_within;
00074 reqout_t t_request_outside;
00075 req_t t_request;
00076 new_dlg_uac_f new_dlg_uac;
00077 dlg_response_uac_f dlg_response_uac;
00078 new_dlg_uas_f new_dlg_uas;
00079 update_dlg_uas_f update_dlg_uas;
00080 dlg_request_uas_f dlg_request_uas;
00081 set_dlg_target_f set_dlg_target;
00082 free_dlg_f free_dlg;
00083 print_dlg_f print_dlg;
00084 tgett_f t_gett;
00085 calculate_hooks_f calculate_hooks;
00086 t_uac_t t_uac;
00087 t_uac_with_ids_t t_uac_with_ids;
00088 trelease_f t_release;
00089 tunref_f t_unref;
00090 run_failure_handlers_f run_failure_handlers;
00091 cancel_uacs_f cancel_uacs;
00092 cancel_all_uacs_f cancel_all_uacs;
00093 prepare_request_within_f prepare_request_within;
00094 send_prepared_request_f send_prepared_request;
00095 enum route_mode* route_mode;
00096 #ifdef DIALOG_CALLBACKS
00097 register_new_dlg_cb_f register_new_dlg_cb;
00098 register_dlg_tmcb_f register_dlg_tmcb;
00099 #else
00100 void* reserved1;
00101
00102 void* reserved2;
00103 #endif
00104 #ifdef WITH_AS_SUPPORT
00105 ack_local_uac_f ack_local_uac;
00106 t_get_canceled_ident_f t_get_canceled_ident;
00107 #else
00108 void* reserved3;
00109 void* reserved4;
00110 #endif
00111 t_suspend_f t_suspend;
00112 t_continue_f t_continue;
00113 t_cancel_suspend_f t_cancel_suspend;
00114 tget_reply_totag_f t_get_reply_totag;
00115 tget_picked_f t_get_picked_branch;
00116 tlookup_callid_f t_lookup_callid;
00117 generate_callid_f generate_callid;
00118 generate_fromtag_f generate_fromtag;
00119 tlookup_request_f t_lookup_request;
00120 tlookup_original_f t_lookup_original;
00121 tcheck_f t_check;
00122 unref_cell_f unref_cell;
00123 prepare_to_cancel_f prepare_to_cancel;
00124 tm_get_stats_f get_stats;
00125 tm_get_table_f get_table;
00126 dlg_add_extra_f dlg_add_extra;
00127 tuaccancel_f t_cancel_uac;
00128 #ifdef WITH_TM_CTX
00129 tm_ctx_get_f tm_ctx_get;
00130 #else
00131 void* reserved5;
00132 #endif
00133 };
00134
00135 typedef struct tm_binds tm_api_t;
00136
00137 extern int tm_init;
00138
00139 typedef int(*load_tm_f)( struct tm_binds *tmb );
00140 int load_tm(struct tm_binds *tmb);
00141
00142
00143 static inline int load_tm_api(struct tm_binds* tmb)
00144 {
00145 load_tm_f load_tm;
00146
00147
00148 load_tm = (load_tm_f)find_export("load_tm", NO_SCRIPT, 0);
00149
00150 if (load_tm == NULL) {
00151 LOG(L_WARN, "Cannot import load_tm function from tm module\n");
00152 return -1;
00153 }
00154
00155
00156 if (load_tm(tmb) == -1) {
00157 return -1;
00158 }
00159 return 0;
00160 }
00161
00162 static inline int tm_load_api(tm_api_t *tmb)
00163 {
00164 return load_tm_api(tmb);
00165 }
00166
00171 typedef void (*t_on_route_f)(unsigned int);
00172 typedef int (*t_no_param_f)(struct sip_msg *);
00173
00174 int t_check_trans(struct sip_msg* msg);
00175 int t_is_canceled(struct sip_msg* msg);
00176
00177 typedef struct tm_xbinds {
00178 t_on_route_f t_on_failure;
00179 t_on_route_f t_on_branch;
00180 t_on_route_f t_on_reply;
00181 t_no_param_f t_check_trans;
00182 t_no_param_f t_is_canceled;
00183 } tm_xapi_t;
00184
00185 typedef int(*load_xtm_f)( tm_xapi_t *xtmb );
00186 int load_xtm(tm_xapi_t *xtmb);
00187
00188 static inline int tm_load_xapi(tm_xapi_t *xtmb)
00189 {
00190 load_xtm_f load_xtm;
00191
00192
00193 load_xtm = (load_xtm_f)find_export("load_xtm", NO_SCRIPT, 0);
00194
00195 if (load_xtm == NULL) {
00196 LOG(L_WARN, "Cannot import load_xtm function from tm module\n");
00197 return -1;
00198 }
00199
00200
00201 if (load_xtm(xtmb) < 0) {
00202 LOG(L_WARN, "Cannot bind xapi from tm module\n");
00203 return -1;
00204 }
00205 return 0;
00206 }
00207
00208 #endif