t_funcs.h
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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef _T_FUNCS_H
00042 #define _T_FUNCS_H
00043
00044 #include <errno.h>
00045 #include <netdb.h>
00046
00047 #include "../../mem/shm_mem.h"
00048 #include "../../parser/msg_parser.h"
00049 #include "../../globals.h"
00050 #include "../../udp_server.h"
00051 #include "../../msg_translator.h"
00052 #include "../../timer.h"
00053 #include "../../forward.h"
00054 #include "../../mem/mem.h"
00055 #include "../../md5utils.h"
00056 #include "../../ip_addr.h"
00057 #include "../../parser/parse_uri.h"
00058 #include "../../usr_avp.h"
00059
00060 #include "config.h"
00061 #include "lock.h"
00062 #include "timer.h"
00063 #include "sip_msg.h"
00064 #include "h_table.h"
00065 #include "ut.h"
00066
00067 struct s_table;
00068 struct timer;
00069 struct entry;
00070 struct cell;
00071
00072 extern int noisy_ctimer;
00073
00074
00075
00076 #define TM_T_REPLY_repl_FLAG (1<<0)
00077 #define TM_T_REPLY_no100_FLAG (1<<1)
00078 #define TM_T_REPLY_noerr_FLAG (1<<2)
00079 #define TM_T_REPLY_nodnsfo_FLAG (1<<3)
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 #ifdef EXTRA_DEBUG
00091 int send_pr_buffer( struct retr_buf *rb,
00092 void *buf, int len, char* file, const char *function, int line );
00093 #define SEND_PR_BUFFER(_rb,_bf,_le ) \
00094 send_pr_buffer( (_rb), (_bf), (_le), __FILE__, __FUNCTION__, __LINE__ )
00095 #else
00096 int send_pr_buffer( struct retr_buf *rb, void *buf, int len);
00097 #define SEND_PR_BUFFER(_rb,_bf,_le ) \
00098 send_pr_buffer( (_rb), (_bf), (_le))
00099 #endif
00100
00101 #define SEND_BUFFER( _rb ) \
00102 SEND_PR_BUFFER( (_rb) , (_rb)->buffer.s , (_rb)->buffer.len )
00103
00104
00105 #define UNREF_UNSAFE(_T_cell) do { \
00106 ((_T_cell)->ref_count--);\
00107 LM_DBG("UNREF_UNSAFE: after is %d\n",(_T_cell)->ref_count);\
00108 }while(0)
00109 #define UNREF(_T_cell) do{ \
00110 LOCK_HASH( (_T_cell)->hash_index ); \
00111 UNREF_UNSAFE(_T_cell); \
00112 UNLOCK_HASH( (_T_cell)->hash_index ); }while(0)
00113 #define REF_UNSAFE(_T_cell) do {\
00114 ((_T_cell)->ref_count++);\
00115 LM_DBG("REF_UNSAFE: after is %d\n",(_T_cell)->ref_count);\
00116 }while(0)
00117 #define INIT_REF_UNSAFE(_T_cell) ((_T_cell)->ref_count=1)
00118 #define IS_REFFED_UNSAFE(_T_cell) ((_T_cell)->ref_count!=0)
00119
00120
00121
00122
00123 int init_avp_params(char *fr_timer_param, char *fr_inv_timer_param,
00124 char *contacts_avp_param);
00125
00126
00127
00128
00129 extern int fr_inv_timer_avp_type;
00130 extern int_str fr_inv_timer_avp;
00131 extern int contacts_avp_type;
00132 extern int_str contacts_avp;
00133
00134
00135
00136
00137 int fr_avp2timer( utime_t* timer);
00138 int fr_inv_avp2timer( utime_t* timer);
00139
00140
00141 inline static void _set_fr_retr( struct retr_buf *rb, int retr )
00142 {
00143 utime_t timer;
00144
00145 if (retr) {
00146 rb->retr_list=RT_T1_TO_1;
00147 set_timer( &rb->retr_timer, RT_T1_TO_1, 0 );
00148 }
00149
00150 if (!fr_avp2timer(&timer)) {
00151 LM_DBG("FR_TIMER = %llu\n", timer);
00152 set_timer(&rb->fr_timer, FR_TIMER_LIST, &timer);
00153 } else {
00154 set_timer(&rb->fr_timer, FR_TIMER_LIST, 0);
00155 }
00156 }
00157
00158
00159 inline static void start_retr(struct retr_buf *rb)
00160 {
00161 _set_fr_retr(rb, rb->dst.proto==PROTO_UDP);
00162 }
00163
00164
00165 inline static void force_retr(struct retr_buf *rb)
00166 {
00167 _set_fr_retr(rb, 1);
00168 }
00169
00170
00171 void tm_shutdown(void);
00172
00173
00174
00175
00176
00177
00178 int t_add_transaction( struct sip_msg* p_msg );
00179
00180
00181
00182 int t_release_transaction( struct cell *trans );
00183
00184
00185 int get_ip_and_port_from_uri( str* uri , unsigned int *param_ip,
00186 unsigned int *param_port);
00187
00188
00189 void put_on_wait( struct cell *Trans );
00190
00191
00192 void cleanup_localcancel_timers( struct cell *t );
00193
00194
00195 int t_relay_to( struct sip_msg *p_msg, struct proxy_l *proxy, int replicate);
00196
00197
00198 #endif
00199