48
50
<div class="refsynopsisdiv" title="Synopsis">
49
51
<a name="libnice-StunAgent.synopsis"></a><h2>Synopsis</h2>
50
52
<pre class="synopsis">
52
53
#include <stun/stunagent.h>
54
55
typedef <a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a>;
55
56
enum <a class="link" href="libnice-StunAgent.html#StunCompatibility" title="enum StunCompatibility">StunCompatibility</a>;
56
57
enum <a class="link" href="libnice-StunAgent.html#StunAgentUsageFlags" title="enum StunAgentUsageFlags">StunAgentUsageFlags</a>;
57
58
enum <a class="link" href="libnice-StunAgent.html#StunValidationStatus" title="enum StunValidationStatus">StunValidationStatus</a>;
58
bool (<a class="link" href="libnice-StunAgent.html#StunMessageIntegrityValidate" title="StunMessageIntegrityValidate ()">*StunMessageIntegrityValidate</a>) (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
59
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *message,
61
uint16_t username_len,
59
<span class="returnvalue">bool</span> (<a class="link" href="libnice-StunAgent.html#StunMessageIntegrityValidate" title="StunMessageIntegrityValidate ()">*StunMessageIntegrityValidate</a>) (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
60
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *message,
61
<span class="returnvalue">uint8_t</span> *username,
62
<span class="returnvalue">uint16_t</span> username_len,
63
<span class="returnvalue">uint8_t</span> **password,
64
<span class="returnvalue">size_t</span> *password_len,
65
<span class="returnvalue">void</span> *user_data);
65
66
<a class="link" href="libnice-StunAgent.html#StunDefaultValidaterData" title="StunDefaultValidaterData">StunDefaultValidaterData</a>;
66
void <a class="link" href="libnice-StunAgent.html#stun-agent-init" title="stun_agent_init ()">stun_agent_init</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
67
const uint16_t *known_attributes,
68
<a class="link" href="libnice-StunAgent.html#StunCompatibility" title="enum StunCompatibility">StunCompatibility</a> compatibility,
69
<a class="link" href="libnice-StunAgent.html#StunAgentUsageFlags" title="enum StunAgentUsageFlags">StunAgentUsageFlags</a> usage_flags);
70
<a class="link" href="libnice-StunAgent.html#StunValidationStatus" title="enum StunValidationStatus">StunValidationStatus</a> <a class="link" href="libnice-StunAgent.html#stun-agent-validate" title="stun_agent_validate ()">stun_agent_validate</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
71
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *msg,
72
const uint8_t *buffer,
74
<a class="link" href="libnice-StunAgent.html#StunMessageIntegrityValidate" title="StunMessageIntegrityValidate ()">StunMessageIntegrityValidate</a> validater,
75
void *validater_data);
76
bool <a class="link" href="libnice-StunAgent.html#stun-agent-default-validater" title="stun_agent_default_validater ()">stun_agent_default_validater</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
77
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *message,
79
uint16_t username_len,
83
bool <a class="link" href="libnice-StunAgent.html#stun-agent-init-request" title="stun_agent_init_request ()">stun_agent_init_request</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
84
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *msg,
87
<a class="link" href="libnice-StunMessage.html#StunMethod" title="enum StunMethod">StunMethod</a> m);
88
bool <a class="link" href="libnice-StunAgent.html#stun-agent-init-indication" title="stun_agent_init_indication ()">stun_agent_init_indication</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
89
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *msg,
92
<a class="link" href="libnice-StunMessage.html#StunMethod" title="enum StunMethod">StunMethod</a> m);
93
bool <a class="link" href="libnice-StunAgent.html#stun-agent-init-response" title="stun_agent_init_response ()">stun_agent_init_response</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
94
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *msg,
97
const <a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *request);
98
bool <a class="link" href="libnice-StunAgent.html#stun-agent-init-error" title="stun_agent_init_error ()">stun_agent_init_error</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
99
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *msg,
102
const <a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *request,
103
<a class="link" href="libnice-StunMessage.html#StunError" title="enum StunError">StunError</a> err);
104
size_t <a class="link" href="libnice-StunAgent.html#stun-agent-build-unknown-attributes-error" title="stun_agent_build_unknown_attributes_error ()">stun_agent_build_unknown_attributes_error</a>
105
(<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
106
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *msg,
109
const <a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *request);
110
size_t <a class="link" href="libnice-StunAgent.html#stun-agent-finish-message" title="stun_agent_finish_message ()">stun_agent_finish_message</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
111
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *msg,
114
bool <a class="link" href="libnice-StunAgent.html#stun-agent-forget-transaction" title="stun_agent_forget_transaction ()">stun_agent_forget_transaction</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
115
<a class="link" href="libnice-StunMessage.html#StunTransactionId" title="StunTransactionId">StunTransactionId</a> id);
116
void <a class="link" href="libnice-StunAgent.html#stun-agent-set-software" title="stun_agent_set_software ()">stun_agent_set_software</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
117
const char *software);
118
void <a class="link" href="libnice-StunAgent.html#stun-debug-enable" title="stun_debug_enable ()">stun_debug_enable</a> (void);
119
void <a class="link" href="libnice-StunAgent.html#stun-debug-disable" title="stun_debug_disable ()">stun_debug_disable</a> (void);
67
<span class="returnvalue">void</span> <a class="link" href="libnice-StunAgent.html#stun-agent-init" title="stun_agent_init ()">stun_agent_init</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
68
const <span class="returnvalue">uint16_t</span> *known_attributes,
69
<a class="link" href="libnice-StunAgent.html#StunCompatibility" title="enum StunCompatibility"><span class="returnvalue">StunCompatibility</span></a> compatibility,
70
<a class="link" href="libnice-StunAgent.html#StunAgentUsageFlags" title="enum StunAgentUsageFlags"><span class="returnvalue">StunAgentUsageFlags</span></a> usage_flags);
71
<a class="link" href="libnice-StunAgent.html#StunValidationStatus" title="enum StunValidationStatus"><span class="returnvalue">StunValidationStatus</span></a> <a class="link" href="libnice-StunAgent.html#stun-agent-validate" title="stun_agent_validate ()">stun_agent_validate</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
72
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *msg,
73
const <span class="returnvalue">uint8_t</span> *buffer,
74
<span class="returnvalue">size_t</span> buffer_len,
75
<a class="link" href="libnice-StunAgent.html#StunMessageIntegrityValidate" title="StunMessageIntegrityValidate ()"><span class="returnvalue">StunMessageIntegrityValidate</span></a> validater,
76
<span class="returnvalue">void</span> *validater_data);
77
<span class="returnvalue">bool</span> <a class="link" href="libnice-StunAgent.html#stun-agent-default-validater" title="stun_agent_default_validater ()">stun_agent_default_validater</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
78
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *message,
79
<span class="returnvalue">uint8_t</span> *username,
80
<span class="returnvalue">uint16_t</span> username_len,
81
<span class="returnvalue">uint8_t</span> **password,
82
<span class="returnvalue">size_t</span> *password_len,
83
<span class="returnvalue">void</span> *user_data);
84
<span class="returnvalue">bool</span> <a class="link" href="libnice-StunAgent.html#stun-agent-init-request" title="stun_agent_init_request ()">stun_agent_init_request</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
85
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *msg,
86
<span class="returnvalue">uint8_t</span> *buffer,
87
<span class="returnvalue">size_t</span> buffer_len,
88
<a class="link" href="libnice-StunMessage.html#StunMethod" title="enum StunMethod"><span class="returnvalue">StunMethod</span></a> m);
89
<span class="returnvalue">bool</span> <a class="link" href="libnice-StunAgent.html#stun-agent-init-indication" title="stun_agent_init_indication ()">stun_agent_init_indication</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
90
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *msg,
91
<span class="returnvalue">uint8_t</span> *buffer,
92
<span class="returnvalue">size_t</span> buffer_len,
93
<a class="link" href="libnice-StunMessage.html#StunMethod" title="enum StunMethod"><span class="returnvalue">StunMethod</span></a> m);
94
<span class="returnvalue">bool</span> <a class="link" href="libnice-StunAgent.html#stun-agent-init-response" title="stun_agent_init_response ()">stun_agent_init_response</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
95
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *msg,
96
<span class="returnvalue">uint8_t</span> *buffer,
97
<span class="returnvalue">size_t</span> buffer_len,
98
const <a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *request);
99
<span class="returnvalue">bool</span> <a class="link" href="libnice-StunAgent.html#stun-agent-init-error" title="stun_agent_init_error ()">stun_agent_init_error</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
100
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *msg,
101
<span class="returnvalue">uint8_t</span> *buffer,
102
<span class="returnvalue">size_t</span> buffer_len,
103
const <a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *request,
104
<a class="link" href="libnice-StunMessage.html#StunError" title="enum StunError"><span class="returnvalue">StunError</span></a> err);
105
<span class="returnvalue">size_t</span> <a class="link" href="libnice-StunAgent.html#stun-agent-build-unknown-attributes-error" title="stun_agent_build_unknown_attributes_error ()">stun_agent_build_unknown_attributes_error</a>
106
(<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
107
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *msg,
108
<span class="returnvalue">uint8_t</span> *buffer,
109
<span class="returnvalue">size_t</span> buffer_len,
110
const <a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *request);
111
<span class="returnvalue">size_t</span> <a class="link" href="libnice-StunAgent.html#stun-agent-finish-message" title="stun_agent_finish_message ()">stun_agent_finish_message</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
112
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *msg,
113
const <span class="returnvalue">uint8_t</span> *key,
114
<span class="returnvalue">size_t</span> key_len);
115
<span class="returnvalue">bool</span> <a class="link" href="libnice-StunAgent.html#stun-agent-forget-transaction" title="stun_agent_forget_transaction ()">stun_agent_forget_transaction</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
116
<a class="link" href="libnice-StunMessage.html#StunTransactionId" title="StunTransactionId"><span class="returnvalue">StunTransactionId</span></a> id);
117
<span class="returnvalue">void</span> <a class="link" href="libnice-StunAgent.html#stun-agent-set-software" title="stun_agent_set_software ()">stun_agent_set_software</a> (<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
118
const <span class="returnvalue">char</span> *software);
119
<span class="returnvalue">void</span> <a class="link" href="libnice-StunAgent.html#stun-debug-enable" title="stun_debug_enable ()">stun_debug_enable</a> (void);
120
<span class="returnvalue">void</span> <a class="link" href="libnice-StunAgent.html#stun-debug-disable" title="stun_debug_disable ()">stun_debug_disable</a> (void);
122
123
<div class="refsect1" title="Description">
285
278
This enum is used as the return value of <a class="link" href="libnice-StunAgent.html#stun-agent-validate" title="stun_agent_validate ()"><code class="function">stun_agent_validate()</code></a> and represents
286
279
the status result of the validation of a STUN message.</p>
289
280
<div class="variablelist"><table border="0">
290
281
<col align="left" valign="top">
293
<td><p><a name="STUN-VALIDATION-SUCCESS--CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_SUCCESS</code></span></p></td>
284
<td><p><a name="STUN-VALIDATION-SUCCESS:CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_SUCCESS</code></span></p></td>
294
285
<td> The message is validated
298
<td><p><a name="STUN-VALIDATION-NOT-STUN--CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_NOT_STUN</code></span></p></td>
289
<td><p><a name="STUN-VALIDATION-NOT-STUN:CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_NOT_STUN</code></span></p></td>
299
290
<td> This is not a valid STUN message
303
<td><p><a name="STUN-VALIDATION-INCOMPLETE-STUN--CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_INCOMPLETE_STUN</code></span></p></td>
294
<td><p><a name="STUN-VALIDATION-INCOMPLETE-STUN:CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_INCOMPLETE_STUN</code></span></p></td>
304
295
<td> The message seems to be valid but incomplete
308
<td><p><a name="STUN-VALIDATION-BAD-REQUEST--CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_BAD_REQUEST</code></span></p></td>
299
<td><p><a name="STUN-VALIDATION-BAD-REQUEST:CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_BAD_REQUEST</code></span></p></td>
309
300
<td> The message does not have the cookie or the
310
301
fingerprint while the agent needs it with its usage
314
<td><p><a name="STUN-VALIDATION-UNAUTHORIZED-BAD-REQUEST--CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNAUTHORIZED_BAD_REQUEST</code></span></p></td>
305
<td><p><a name="STUN-VALIDATION-UNAUTHORIZED-BAD-REQUEST:CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNAUTHORIZED_BAD_REQUEST</code></span></p></td>
315
306
<td> The message is valid but
316
307
unauthorized with no username and message-integrity attributes.
317
308
A BAD_REQUEST error must be generated
321
<td><p><a name="STUN-VALIDATION-UNAUTHORIZED--CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNAUTHORIZED</code></span></p></td>
312
<td><p><a name="STUN-VALIDATION-UNAUTHORIZED:CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNAUTHORIZED</code></span></p></td>
322
313
<td> The message is valid but unauthorized as
323
314
the username/password do not match.
324
315
An UNAUTHORIZED error must be generated
328
<td><p><a name="STUN-VALIDATION-UNMATCHED-RESPONSE--CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNMATCHED_RESPONSE</code></span></p></td>
319
<td><p><a name="STUN-VALIDATION-UNMATCHED-RESPONSE:CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNMATCHED_RESPONSE</code></span></p></td>
329
320
<td> The message is valid but this is a
330
321
response/error that doesn't match a previously sent request
334
<td><p><a name="STUN-VALIDATION-UNKNOWN-REQUEST-ATTRIBUTE--CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNKNOWN_REQUEST_ATTRIBUTE</code></span></p></td>
325
<td><p><a name="STUN-VALIDATION-UNKNOWN-REQUEST-ATTRIBUTE:CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNKNOWN_REQUEST_ATTRIBUTE</code></span></p></td>
335
326
<td> The message is valid but
336
327
contains one or more unknown comprehension attributes.
337
328
<a class="link" href="libnice-StunAgent.html#stun-agent-build-unknown-attributes-error" title="stun_agent_build_unknown_attributes_error ()"><code class="function">stun_agent_build_unknown_attributes_error()</code></a> should be called
341
<td><p><a name="STUN-VALIDATION-UNKNOWN-ATTRIBUTE--CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNKNOWN_ATTRIBUTE</code></span></p></td>
332
<td><p><a name="STUN-VALIDATION-UNKNOWN-ATTRIBUTE:CAPS"></a><span class="term"><code class="literal">STUN_VALIDATION_UNKNOWN_ATTRIBUTE</code></span></p></td>
342
333
<td> The message is valid but contains one
343
334
or more unknown comprehension attributes. This is a response, or error,
344
335
or indication message and no error response should be sent
906
855
<div class="refsect2" title="stun_agent_build_unknown_attributes_error ()">
907
856
<a name="stun-agent-build-unknown-attributes-error"></a><h3>stun_agent_build_unknown_attributes_error ()</h3>
908
<pre class="programlisting">size_t stun_agent_build_unknown_attributes_error
909
(<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent">StunAgent</a> *agent,
910
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *msg,
913
const <a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage">StunMessage</a> *request);</pre>
857
<pre class="programlisting"><span class="returnvalue">size_t</span> stun_agent_build_unknown_attributes_error
858
(<a class="link" href="libnice-StunAgent.html#StunAgent" title="StunAgent"><span class="returnvalue">StunAgent</span></a> *agent,
859
<a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *msg,
860
<span class="returnvalue">uint8_t</span> *buffer,
861
<span class="returnvalue">size_t</span> buffer_len,
862
const <a class="link" href="libnice-StunMessage.html#StunMessage" title="StunMessage"><span class="returnvalue">StunMessage</span></a> *request);</pre>
915
Creates a new STUN message of class <a class="link" href="libnice-StunMessage.html#STUN-ERROR--CAPS"><span class="type">STUN_ERROR</span></a> and with the same method
864
Creates a new STUN message of class <a class="link" href="libnice-StunMessage.html#STUN-ERROR:CAPS"><span class="type">STUN_ERROR</span></a> and with the same method
916
865
and transaction ID as the message <em class="parameter"><code>request</code></em>. It will then add the ERROR-CODE
917
attribute with code <a class="link" href="libnice-StunMessage.html#STUN-ERROR-UNKNOWN-ATTRIBUTE--CAPS"><span class="type">STUN_ERROR_UNKNOWN_ATTRIBUTE</span></a> and add all the unknown
866
attribute with code <a class="link" href="libnice-StunMessage.html#STUN-ERROR-UNKNOWN-ATTRIBUTE:CAPS"><span class="type">STUN_ERROR_UNKNOWN_ATTRIBUTE</span></a> and add all the unknown
918
867
mandatory attributes from the <em class="parameter"><code>request</code></em> STUN message in the
919
<a class="link" href="libnice-StunMessage.html#STUN-ATTRIBUTE-UNKNOWN-ATTRIBUTES--CAPS"><span class="type">STUN_ATTRIBUTE_UNKNOWN_ATTRIBUTES</span></a> attribute, it will then finish the message
868
<a class="link" href="libnice-StunMessage.html#STUN-ATTRIBUTE-UNKNOWN-ATTRIBUTES:CAPS"><span class="type">STUN_ATTRIBUTE_UNKNOWN_ATTRIBUTES</span></a> attribute, it will then finish the message
920
869
by calling <a class="link" href="libnice-StunAgent.html#stun-agent-finish-message" title="stun_agent_finish_message ()"><code class="function">stun_agent_finish_message()</code></a></p>
923
870
<div class="variablelist"><table border="0">
924
871
<col align="left" valign="top">