1 /*
2  * $Id: sip_timers.h 1048 2008-07-15 18:48:07Z sayer $
3  *
4  * Copyright (C) 2007 Raphael Coeffic
5  *
6  * This file is part of SEMS, a free SIP media server.
7  *
8  * SEMS is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version. This program is released under
12  * the GPL with the additional exemption that compiling, linking,
13  * and/or using OpenSSL is allowed.
14  *
15  * For a license to use the SEMS software under conditions
16  * other than those described here, or to purchase support for this
17  * software, please contact iptel.org by e-mail at the following addresses:
18  *    info@iptel.org
19  *
20  * SEMS is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28  */
29 #ifndef _sip_timers_h_
30 #define _sip_timers_h_
31 
32 /**
33  * SIP transaction timer type definition
34  */
35 enum sip_timer_type {
36 
37     // INVITE client transaction
38     STIMER_A=0,// Calling: (re-)send INV
39     STIMER_B,  // Calling -> Terminated
40     STIMER_D,  // Completed -> Terminated
41 
42     // non-INVITE client transaction
43     STIMER_E,  // Trying/Proceeding: (re-)send request
44     STIMER_F,  // Trying/Proceeding -> Terminated
45     STIMER_K,  // Completed -> Terminated
46 
47     // INVITE server transaction
48     STIMER_G,  // Completed: (re-)send response
49     STIMER_H,  // Completed -> Terminated
50     STIMER_I,  // Confirmed -> Terminated
51 
52     // non-INVITE server transaction
53     STIMER_J,  // Completed -> Terminated
54 
55     // These timers are not defined by
56     // RFC 3261.
57 
58     // Used to handle 200 ACKs automatically
59     // in INVITE client transactions.
60     STIMER_L,  // Terminated_200 -> Terminated
61 
62     // Transport address failover timer:
63     // - used to cycle throught multiple addresses
64     //   in case the R-URI resolves to multiple addresses
65     STIMER_M,
66 
67     // INVITE client transaction
68     STIMER_C,  // Proceeding -> Terminated
69 
70     // Blacklist grace timer
71     STIMER_BL,
72 
73     __STIMER_MAX
74 };
75 
76 
77 /**
78  * SIP transaction timer default values
79  */
80 
81 #define T1_TIMER  500 /* 500 ms */
82 #define DEFAULT_T2_TIMER 4000 /*   4 s  */
83 #define T4_TIMER 5000 /*   5 s  */
84 
85 //type 0x01
86 #define DEFAULT_A_TIMER  T1_TIMER
87 
88 //type 0x02
89 #define DEFAULT_B_TIMER  64*T1_TIMER
90 
91 //type 0x0d
92 #define DEFAULT_C_TIMER  (3*60*1000)
93 
94 //type 0x03
95 #define DEFAULT_D_TIMER  64*T1_TIMER
96 
97 //type 0x04
98 #define DEFAULT_E_TIMER  T1_TIMER
99 
100 //type 0x05
101 #define DEFAULT_F_TIMER  64*T1_TIMER
102 
103 //type 0x06
104 #define DEFAULT_K_TIMER  T4_TIMER
105 
106 //type 0x07
107 #define DEFAULT_G_TIMER  T1_TIMER
108 
109 //type 0x08
110 #define DEFAULT_H_TIMER  64*T1_TIMER
111 
112 //type 0x09
113 #define DEFAULT_I_TIMER  T4_TIMER
114 
115 //type 0x0a
116 #define DEFAULT_J_TIMER  64*T1_TIMER
117 
118 // Following timer values are not defined by
119 // RFC 3261.
120 
121 // Used to handle 200 ACKs automatically
122 // in INVITE client transactions.
123 //type 0x0b
124 #define DEFAULT_L_TIMER  64*T1_TIMER
125 
126 // Transport address failover timer:
127 // - used to cycle throught multiple addresses
128 //   in case the R-URI resolves to multiple addresses
129 //type 0x0c
130 #define DEFAULT_M_TIMER  (DEFAULT_B_TIMER/4)
131 
132 // Blacklist grace timer (client transaction only)
133 // - set after locally generated 408
134 //   to wait for downstream 408
135 #define DEFAULT_BL_TIMER DEFAULT_B_TIMER
136 
137 #define A_TIMER sip_timers[STIMER_A]
138 #define B_TIMER sip_timers[STIMER_B]
139 #define D_TIMER sip_timers[STIMER_D]
140 
141 #define E_TIMER sip_timers[STIMER_E]
142 #define F_TIMER sip_timers[STIMER_F]
143 #define K_TIMER sip_timers[STIMER_K]
144 
145 #define G_TIMER sip_timers[STIMER_G]
146 #define H_TIMER sip_timers[STIMER_H]
147 #define I_TIMER sip_timers[STIMER_I]
148 
149 #define J_TIMER sip_timers[STIMER_J]
150 
151 #define L_TIMER sip_timers[STIMER_L]
152 #define M_TIMER sip_timers[STIMER_M]
153 #define C_TIMER sip_timers[STIMER_C]
154 
155 #define BL_TIMER sip_timers[STIMER_BL]
156 
157 extern unsigned int sip_timers[__STIMER_MAX];
158 
159 #define T2_TIMER sip_timer_t2
160 extern unsigned int sip_timer_t2;
161 
162 const char* timer_name(unsigned int type);
163 
164 #endif
165 
166 /** EMACS **
167  * Local variables:
168  * mode: c++
169  * c-basic-offset: 4
170  * End:
171  */
172