Imported Upstream version 0.1.16
[platform/upstream/libnice.git] / docs / reference / libnice / html / libnice-Timer.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Timer: libnice Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
7 <link rel="home" href="index.html" title="libnice Reference Manual">
8 <link rel="up" href="ch04.html" title="STUN usages">
9 <link rel="prev" href="libnice-TURN.html" title="TURN">
10 <link rel="next" href="pt03.html" title="Part III. Pseudo TCP Socket implementation">
11 <meta name="generator" content="GTK-Doc V1.29 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18                   <a href="#libnice-Timer.description" class="shortcut">Description</a></span>
19 </td>
20 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21 <td><a accesskey="u" href="ch04.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22 <td><a accesskey="p" href="libnice-TURN.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23 <td><a accesskey="n" href="pt03.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
24 </tr></table>
25 <div class="refentry">
26 <a name="libnice-Timer"></a><div class="titlepage"></div>
27 <div class="refnamediv"><table width="100%"><tr>
28 <td valign="top">
29 <h2><span class="refentrytitle"><a name="libnice-Timer.top_of_page"></a>Timer</span></h2>
30 <p>Timer — STUN timer Usage</p>
31 </td>
32 <td class="gallery_image" valign="top" align="right"></td>
33 </tr></table></div>
34 <div class="refsect1">
35 <a name="libnice-Timer.stability-level"></a><h2>Stability Level</h2>
36 <acronym title="The intention of a Stable interface is to enable arbitrary third parties to
37 develop applications to these interfaces, release them, and have confidence that
38 they will run on all minor releases of the product (after the one in which the
39 interface was introduced, and within the same major release). Even at a major
40 release, incompatible changes are expected to be rare, and to have strong
41 justifications.
42 "><span class="acronym">Stable</span></acronym>, unless otherwise indicated
43 </div>
44 <div class="refsect1">
45 <a name="libnice-Timer.functions"></a><h2>Functions</h2>
46 <div class="informaltable"><table class="informaltable" width="100%" border="0">
47 <colgroup>
48 <col width="150px" class="functions_return">
49 <col class="functions_name">
50 </colgroup>
51 <tbody>
52 <tr>
53 <td class="function_type">
54 <span class="returnvalue">void</span>
55 </td>
56 <td class="function_name">
57 <a class="link" href="libnice-Timer.html#stun-timer-start" title="stun_timer_start ()">stun_timer_start</a> <span class="c_punctuation">()</span>
58 </td>
59 </tr>
60 <tr>
61 <td class="function_type">
62 <span class="returnvalue">void</span>
63 </td>
64 <td class="function_name">
65 <a class="link" href="libnice-Timer.html#stun-timer-start-reliable" title="stun_timer_start_reliable ()">stun_timer_start_reliable</a> <span class="c_punctuation">()</span>
66 </td>
67 </tr>
68 <tr>
69 <td class="function_type">
70 <a class="link" href="libnice-Timer.html#StunUsageTimerReturn" title="enum StunUsageTimerReturn"><span class="returnvalue">StunUsageTimerReturn</span></a>
71 </td>
72 <td class="function_name">
73 <a class="link" href="libnice-Timer.html#stun-timer-refresh" title="stun_timer_refresh ()">stun_timer_refresh</a> <span class="c_punctuation">()</span>
74 </td>
75 </tr>
76 <tr>
77 <td class="function_type">
78 <span class="returnvalue">unsigned</span>
79 </td>
80 <td class="function_name">
81 <a class="link" href="libnice-Timer.html#stun-timer-remainder" title="stun_timer_remainder ()">stun_timer_remainder</a> <span class="c_punctuation">()</span>
82 </td>
83 </tr>
84 </tbody>
85 </table></div>
86 </div>
87 <div class="refsect1">
88 <a name="libnice-Timer.other"></a><h2>Types and Values</h2>
89 <div class="informaltable"><table class="informaltable" width="100%" border="0">
90 <colgroup>
91 <col width="150px" class="name">
92 <col class="description">
93 </colgroup>
94 <tbody>
95 <tr>
96 <td class="typedef_keyword">typedef</td>
97 <td class="function_name"><a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer">StunTimer</a></td>
98 </tr>
99 <tr>
100 <td class="datatype_keyword">enum</td>
101 <td class="function_name"><a class="link" href="libnice-Timer.html#StunUsageTimerReturn" title="enum StunUsageTimerReturn">StunUsageTimerReturn</a></td>
102 </tr>
103 <tr>
104 <td class="define_keyword">#define</td>
105 <td class="function_name"><a class="link" href="libnice-Timer.html#STUN-TIMER-DEFAULT-MAX-RETRANSMISSIONS:CAPS" title="STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS">STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS</a></td>
106 </tr>
107 <tr>
108 <td class="define_keyword">#define</td>
109 <td class="function_name"><a class="link" href="libnice-Timer.html#STUN-TIMER-DEFAULT-RELIABLE-TIMEOUT:CAPS" title="STUN_TIMER_DEFAULT_RELIABLE_TIMEOUT">STUN_TIMER_DEFAULT_RELIABLE_TIMEOUT</a></td>
110 </tr>
111 <tr>
112 <td class="define_keyword">#define</td>
113 <td class="function_name"><a class="link" href="libnice-Timer.html#STUN-TIMER-DEFAULT-TIMEOUT:CAPS" title="STUN_TIMER_DEFAULT_TIMEOUT">STUN_TIMER_DEFAULT_TIMEOUT</a></td>
114 </tr>
115 </tbody>
116 </table></div>
117 </div>
118 <div class="refsect1">
119 <a name="libnice-Timer.includes"></a><h2>Includes</h2>
120 <pre class="synopsis">#include &lt;stun/usages/timer.h&gt;
121 </pre>
122 </div>
123 <div class="refsect1">
124 <a name="libnice-Timer.description"></a><h2>Description</h2>
125 <p>The STUN timer usage is a set of helpful utility functions that allows you
126 to easily track when a STUN message should be retransmitted or considered
127 as timed out.</p>
128 <div class="example">
129 <a name="id-1.3.3.5.7.3"></a><p class="title"><b>Example 3. Simple example on how to use the timer usage</b></p>
130 <div class="example-contents">
131   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
132     <tbody>
133       <tr>
134         <td class="listing_lines" align="right"><pre>1
135 2
136 3
137 4
138 5
139 6
140 7
141 8
142 9
143 10
144 11
145 12
146 13
147 14
148 15
149 16
150 17
151 18
152 19
153 20
154 21
155 22
156 23
157 24
158 25
159 26
160 27
161 28
162 29
163 30
164 31
165 32
166 33
167 34
168 35
169 36
170 37
171 38
172 39
173 40
174 41
175 42
176 43
177 44</pre></td>
178         <td class="listing_code"><pre class="programlisting"><span class="usertype">StunTimer</span><span class="normal"> timer</span><span class="symbol">;</span>
179 <span class="type">unsigned</span><span class="normal"> remainder</span><span class="symbol">;</span>
180 <span class="usertype">StunUsageTimerReturn</span><span class="normal"> ret</span><span class="symbol">;</span>
181
182 <span class="comment">// Build the message, etc..</span>
183 <span class="symbol">...</span>
184
185 <span class="comment">// Send the message and start the timer</span>
186 <span class="function">send</span><span class="symbol">(</span><span class="normal">socket</span><span class="symbol">,</span><span class="normal"> request</span><span class="symbol">,</span><span class="normal"> </span><span class="keyword">sizeof</span><span class="symbol">(</span><span class="normal">request</span><span class="symbol">));</span>
187 <span class="function"><a href="libnice-Timer.html#stun-timer-start">stun_timer_start</a></span><span class="symbol">(&amp;</span><span class="normal">timer</span><span class="symbol">,</span><span class="normal"> <a href="libnice-Timer.html#STUN-TIMER-DEFAULT-TIMEOUT:CAPS">STUN_TIMER_DEFAULT_TIMEOUT</a></span><span class="symbol">,</span>
188 <span class="normal">                 <a href="libnice-Timer.html#STUN-TIMER-DEFAULT-MAX-RETRANSMISSIONS:CAPS">STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS</a></span><span class="symbol">);</span>
189
190 <span class="comment">// Loop until we get the response</span>
191 <span class="keyword">for</span><span class="normal"> </span><span class="symbol">(;;)</span><span class="normal"> </span><span class="cbracket">{</span>
192 <span class="normal">  remainder </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="libnice-Timer.html#stun-timer-remainder">stun_timer_remainder</a></span><span class="symbol">(&amp;</span><span class="normal">timer</span><span class="symbol">);</span>
193
194 <span class="normal">  </span><span class="comment">// Poll the socket until data is received or the timer expires</span>
195 <span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function">poll</span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">pollfd</span><span class="symbol">,</span><span class="normal"> </span><span class="number">1</span><span class="symbol">,</span><span class="normal"> delay</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">&lt;=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
196 <span class="normal">    </span><span class="comment">// Time out and no response was received</span>
197 <span class="normal">    ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="libnice-Timer.html#stun-timer-refresh">stun_timer_refresh</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">timer</span><span class="symbol">);</span>
198 <span class="normal">    </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">ret </span><span class="symbol">==</span><span class="normal"> <a href="libnice-Timer.html#STUN-USAGE-TIMER-RETURN-TIMEOUT:CAPS">STUN_USAGE_TIMER_RETURN_TIMEOUT</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
199 <span class="normal">      </span><span class="comment">// Transaction timed out</span>
200 <span class="normal">      </span><span class="keyword">break</span><span class="symbol">;</span>
201 <span class="normal">    </span><span class="cbracket">}</span><span class="normal"> </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">ret </span><span class="symbol">==</span><span class="normal"> <a href="libnice-Timer.html#STUN-USAGE-TIMER-RETURN-RETRANSMIT:CAPS">STUN_USAGE_TIMER_RETURN_RETRANSMIT</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
202 <span class="normal">      </span><span class="comment">// A retransmission is necessary</span>
203 <span class="normal">      </span><span class="function">send</span><span class="symbol">(</span><span class="normal">socket</span><span class="symbol">,</span><span class="normal"> request</span><span class="symbol">,</span><span class="normal"> </span><span class="keyword">sizeof</span><span class="symbol">(</span><span class="normal">request</span><span class="symbol">));</span>
204 <span class="normal">      </span><span class="keyword">continue</span><span class="symbol">;</span>
205 <span class="normal">    </span><span class="cbracket">}</span><span class="normal"> </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">ret </span><span class="symbol">==</span><span class="normal"> <a href="libnice-Timer.html#STUN-USAGE-TIMER-RETURN-SUCCESS:CAPS">STUN_USAGE_TIMER_RETURN_SUCCESS</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
206 <span class="normal">      </span><span class="comment">// The refresh succeeded and nothing has to be done, continue polling</span>
207 <span class="normal">      </span><span class="keyword">continue</span><span class="symbol">;</span>
208 <span class="normal">    </span><span class="cbracket">}</span>
209 <span class="normal">  </span><span class="cbracket">}</span><span class="normal"> </span><span class="keyword">else</span><span class="normal"> </span><span class="cbracket">{</span>
210 <span class="normal">    </span><span class="comment">// We received a response, read it</span>
211 <span class="normal">    </span><span class="function">recv</span><span class="symbol">(</span><span class="normal">socket</span><span class="symbol">,</span><span class="normal"> response</span><span class="symbol">,</span><span class="normal"> </span><span class="keyword">sizeof</span><span class="symbol">(</span><span class="normal">response</span><span class="symbol">));</span>
212 <span class="normal">    </span><span class="keyword">break</span><span class="symbol">;</span>
213 <span class="normal">  </span><span class="cbracket">}</span>
214 <span class="cbracket">}</span>
215
216 <span class="comment">// Check if the transaction timed out or not</span>
217 <span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">ret </span><span class="symbol">==</span><span class="normal"> <a href="libnice-Timer.html#STUN-USAGE-TIMER-RETURN-TIMEOUT:CAPS">STUN_USAGE_TIMER_RETURN_TIMEOUT</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
218 <span class="normal">  </span><span class="comment">// do whatever needs to be done in that case</span>
219 <span class="cbracket">}</span><span class="normal"> </span><span class="keyword">else</span><span class="normal"> </span><span class="cbracket">{</span>
220 <span class="normal">  </span><span class="comment">// Parse the response</span>
221 <span class="cbracket">}</span></pre></td>
222       </tr>
223     </tbody>
224   </table>
225 </div>
226
227 </div>
228 <br class="example-break">
229 </div>
230 <div class="refsect1">
231 <a name="libnice-Timer.functions_details"></a><h2>Functions</h2>
232 <div class="refsect2">
233 <a name="stun-timer-start"></a><h3>stun_timer_start ()</h3>
234 <pre class="programlisting"><span class="returnvalue">void</span>
235 stun_timer_start (<em class="parameter"><code><a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer"><span class="type">StunTimer</span></a> *timer</code></em>,
236                   <em class="parameter"><code>unsigned <span class="type">int</span> initial_timeout</code></em>,
237                   <em class="parameter"><code>unsigned <span class="type">int</span> max_retransmissions</code></em>);</pre>
238 <p>Starts a STUN transaction retransmission timer.
239 This should be called as soon as you send the message for the first time on
240 a UDP socket.
241 The timeout before the next retransmission is set to <em class="parameter"><code>initial_timeout</code></em>
242 , then
243 each time a packet is retransmited, that timeout will be doubled, until the
244 <em class="parameter"><code>max_retransmissions</code></em>
245  retransmissions limit is reached.</p>
246 <p>
247 To determine the total timeout value, one can use the following equation :
248  </p>
249 <pre class="programlisting">
250  total_timeout =  initial_timeout * (2^(max_retransmissions + 1) - 1);
251  </pre>
252 <p>
253 </p>
254 <p>See also: <a class="link" href="libnice-Timer.html#STUN-TIMER-DEFAULT-TIMEOUT:CAPS" title="STUN_TIMER_DEFAULT_TIMEOUT"><span class="type">STUN_TIMER_DEFAULT_TIMEOUT</span></a></p>
255 <p>See also: <a class="link" href="libnice-Timer.html#STUN-TIMER-DEFAULT-MAX-RETRANSMISSIONS:CAPS" title="STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS"><span class="type">STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS</span></a></p>
256 <div class="refsect3">
257 <a name="stun-timer-start.parameters"></a><h4>Parameters</h4>
258 <div class="informaltable"><table class="informaltable" width="100%" border="0">
259 <colgroup>
260 <col width="150px" class="parameters_name">
261 <col class="parameters_description">
262 <col width="200px" class="parameters_annotations">
263 </colgroup>
264 <tbody>
265 <tr>
266 <td class="parameter_name"><p>timer</p></td>
267 <td class="parameter_description"><p>The <a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer"><span class="type">StunTimer</span></a> to start</p></td>
268 <td class="parameter_annotations"> </td>
269 </tr>
270 <tr>
271 <td class="parameter_name"><p>initial_timeout</p></td>
272 <td class="parameter_description"><p>The initial timeout to use before the first retransmission</p></td>
273 <td class="parameter_annotations"> </td>
274 </tr>
275 <tr>
276 <td class="parameter_name"><p>max_retransmissions</p></td>
277 <td class="parameter_description"><p>The maximum number of transmissions before the
278 <a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer"><span class="type">StunTimer</span></a> times out</p></td>
279 <td class="parameter_annotations"> </td>
280 </tr>
281 </tbody>
282 </table></div>
283 </div>
284 </div>
285 <hr>
286 <div class="refsect2">
287 <a name="stun-timer-start-reliable"></a><h3>stun_timer_start_reliable ()</h3>
288 <pre class="programlisting"><span class="returnvalue">void</span>
289 stun_timer_start_reliable (<em class="parameter"><code><a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer"><span class="type">StunTimer</span></a> *timer</code></em>,
290                            <em class="parameter"><code>unsigned <span class="type">int</span> initial_timeout</code></em>);</pre>
291 <p>Starts a STUN transaction retransmission timer for a reliable transport.
292 This should be called as soon as you send the message for the first time on
293 a TCP socket</p>
294 <div class="refsect3">
295 <a name="stun-timer-start-reliable.parameters"></a><h4>Parameters</h4>
296 <div class="informaltable"><table class="informaltable" width="100%" border="0">
297 <colgroup>
298 <col width="150px" class="parameters_name">
299 <col class="parameters_description">
300 <col width="200px" class="parameters_annotations">
301 </colgroup>
302 <tbody>
303 <tr>
304 <td class="parameter_name"><p>timer</p></td>
305 <td class="parameter_description"><p>The <a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer"><span class="type">StunTimer</span></a> to start</p></td>
306 <td class="parameter_annotations"> </td>
307 </tr>
308 <tr>
309 <td class="parameter_name"><p>initial_timeout</p></td>
310 <td class="parameter_description"><p>The initial timeout to use before the first retransmission</p></td>
311 <td class="parameter_annotations"> </td>
312 </tr>
313 </tbody>
314 </table></div>
315 </div>
316 </div>
317 <hr>
318 <div class="refsect2">
319 <a name="stun-timer-refresh"></a><h3>stun_timer_refresh ()</h3>
320 <pre class="programlisting"><a class="link" href="libnice-Timer.html#StunUsageTimerReturn" title="enum StunUsageTimerReturn"><span class="returnvalue">StunUsageTimerReturn</span></a>
321 stun_timer_refresh (<em class="parameter"><code><a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer"><span class="type">StunTimer</span></a> *timer</code></em>);</pre>
322 <p>Updates a STUN transaction retransmission timer.</p>
323 <div class="refsect3">
324 <a name="stun-timer-refresh.parameters"></a><h4>Parameters</h4>
325 <div class="informaltable"><table class="informaltable" width="100%" border="0">
326 <colgroup>
327 <col width="150px" class="parameters_name">
328 <col class="parameters_description">
329 <col width="200px" class="parameters_annotations">
330 </colgroup>
331 <tbody><tr>
332 <td class="parameter_name"><p>timer</p></td>
333 <td class="parameter_description"><p>The <a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer"><span class="type">StunTimer</span></a> to refresh</p></td>
334 <td class="parameter_annotations"> </td>
335 </tr></tbody>
336 </table></div>
337 </div>
338 <div class="refsect3">
339 <a name="stun-timer-refresh.returns"></a><h4>Returns</h4>
340 <p> A <a class="link" href="libnice-Timer.html#StunUsageTimerReturn" title="enum StunUsageTimerReturn"><span class="type">StunUsageTimerReturn</span></a> telling you what to do next</p>
341 </div>
342 </div>
343 <hr>
344 <div class="refsect2">
345 <a name="stun-timer-remainder"></a><h3>stun_timer_remainder ()</h3>
346 <pre class="programlisting"><span class="returnvalue">unsigned</span>
347 stun_timer_remainder (<em class="parameter"><code>const <a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer"><span class="type">StunTimer</span></a> *timer</code></em>);</pre>
348 <p>Query the timer on the time left before the next refresh should be done</p>
349 <div class="refsect3">
350 <a name="stun-timer-remainder.parameters"></a><h4>Parameters</h4>
351 <div class="informaltable"><table class="informaltable" width="100%" border="0">
352 <colgroup>
353 <col width="150px" class="parameters_name">
354 <col class="parameters_description">
355 <col width="200px" class="parameters_annotations">
356 </colgroup>
357 <tbody><tr>
358 <td class="parameter_name"><p>timer</p></td>
359 <td class="parameter_description"><p>The <a class="link" href="libnice-Timer.html#StunTimer" title="StunTimer"><span class="type">StunTimer</span></a> to query</p></td>
360 <td class="parameter_annotations"> </td>
361 </tr></tbody>
362 </table></div>
363 </div>
364 <div class="refsect3">
365 <a name="stun-timer-remainder.returns"></a><h4>Returns</h4>
366 <p> The time remaining for the timer to expire in milliseconds</p>
367 </div>
368 </div>
369 </div>
370 <div class="refsect1">
371 <a name="libnice-Timer.other_details"></a><h2>Types and Values</h2>
372 <div class="refsect2">
373 <a name="StunTimer"></a><h3>StunTimer</h3>
374 <pre class="programlisting">typedef struct stun_timer_s StunTimer;
375 </pre>
376 <p>An opaque structure representing a STUN transaction retransmission timer</p>
377 </div>
378 <hr>
379 <div class="refsect2">
380 <a name="StunUsageTimerReturn"></a><h3>enum StunUsageTimerReturn</h3>
381 <p>Return value of <code class="function">stun_usage_timer_refresh()</code> which provides you with status
382 information on the timer.</p>
383 <div class="refsect3">
384 <a name="StunUsageTimerReturn.members"></a><h4>Members</h4>
385 <div class="informaltable"><table class="informaltable" width="100%" border="0">
386 <colgroup>
387 <col width="300px" class="enum_members_name">
388 <col class="enum_members_description">
389 <col width="200px" class="enum_members_annotations">
390 </colgroup>
391 <tbody>
392 <tr>
393 <td class="enum_member_name"><p><a name="STUN-USAGE-TIMER-RETURN-SUCCESS:CAPS"></a>STUN_USAGE_TIMER_RETURN_SUCCESS</p></td>
394 <td class="enum_member_description">
395 <p>The timer was refreshed successfully
396 and there is nothing to be done</p>
397 </td>
398 <td class="enum_member_annotations"> </td>
399 </tr>
400 <tr>
401 <td class="enum_member_name"><p><a name="STUN-USAGE-TIMER-RETURN-RETRANSMIT:CAPS"></a>STUN_USAGE_TIMER_RETURN_RETRANSMIT</p></td>
402 <td class="enum_member_description">
403 <p>The timer expired and the message
404 should be retransmitted now.</p>
405 </td>
406 <td class="enum_member_annotations"> </td>
407 </tr>
408 <tr>
409 <td class="enum_member_name"><p><a name="STUN-USAGE-TIMER-RETURN-TIMEOUT:CAPS"></a>STUN_USAGE_TIMER_RETURN_TIMEOUT</p></td>
410 <td class="enum_member_description">
411 <p>The timer expired as well as all the
412 retransmissions, the transaction timed out</p>
413 </td>
414 <td class="enum_member_annotations"> </td>
415 </tr>
416 </tbody>
417 </table></div>
418 </div>
419 </div>
420 <hr>
421 <div class="refsect2">
422 <a name="STUN-TIMER-DEFAULT-MAX-RETRANSMISSIONS:CAPS"></a><h3>STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS</h3>
423 <pre class="programlisting">#define STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS 7
424 </pre>
425 <p>The default maximum retransmissions allowed before a timer decides to timeout</p>
426 </div>
427 <hr>
428 <div class="refsect2">
429 <a name="STUN-TIMER-DEFAULT-RELIABLE-TIMEOUT:CAPS"></a><h3>STUN_TIMER_DEFAULT_RELIABLE_TIMEOUT</h3>
430 <pre class="programlisting">#define STUN_TIMER_DEFAULT_RELIABLE_TIMEOUT 7900
431 </pre>
432 <p>The default intial timeout to use for a reliable timer</p>
433 </div>
434 <hr>
435 <div class="refsect2">
436 <a name="STUN-TIMER-DEFAULT-TIMEOUT:CAPS"></a><h3>STUN_TIMER_DEFAULT_TIMEOUT</h3>
437 <pre class="programlisting">#define STUN_TIMER_DEFAULT_TIMEOUT 200
438 </pre>
439 <p>The default intial timeout to use for the timer
440 RFC recommendds 500, but it's ridiculous, 50ms is known to work in most
441 cases as it is also what is used by SIP style VoIP when sending A-Law and
442 mu-Law audio, so 200ms should be hyper safe. With an initial timeout
443 of 200ms, a default of 7 transmissions, the last timeout will be
444 16 * 200ms, and we expect to receive a response from the stun server
445 before (1 + 2 + 4 + 8 + 16 + 32 + 16) * 200ms = 15200 ms after the initial
446 stun request has been sent.</p>
447 </div>
448 </div>
449 </div>
450 <div class="footer">
451 <hr>Generated by GTK-Doc V1.29</div>
452 </body>
453 </html>