Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 Copyright (c) 2007, Adobe Systems, Incorporated
3 All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 * Neither the name of Adobe Systems, Network Resonance nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
34 #ifndef _stun_build_h
35 #define _stun_build_h
37 #include "stun.h"
39 #define NR_STUN_MODE_STUN 1
40 #ifdef USE_STUND_0_96
41 #define NR_STUN_MODE_STUND_0_96 2 /* backwards compatibility mode */
42 #endif /* USE_STUND_0_96 */
43 int nr_stun_form_request_or_indication(int mode, int msg_type, nr_stun_message **msg);
45 typedef struct nr_stun_client_stun_binding_request_params_ {
46 char *username;
47 Data *password;
48 char *nonce;
49 char *realm;
50 } nr_stun_client_stun_binding_request_params;
52 int nr_stun_build_req_lt_auth(nr_stun_client_stun_binding_request_params *params, nr_stun_message **msg);
53 int nr_stun_build_req_st_auth(nr_stun_client_stun_binding_request_params *params, nr_stun_message **msg);
54 int nr_stun_build_req_no_auth(nr_stun_client_stun_binding_request_params *params, nr_stun_message **msg);
57 typedef struct nr_stun_client_stun_keepalive_params_ {
58 #if defined(WIN32) || defined(__clang__)
59 // VC++ and clang give error and warning respectively if no members
60 int dummy;
61 #endif
62 } nr_stun_client_stun_keepalive_params;
64 int nr_stun_build_keepalive(nr_stun_client_stun_keepalive_params *params, nr_stun_message **msg);
67 #ifdef USE_STUND_0_96
68 typedef struct nr_stun_client_stun_binding_request_stund_0_96_params_ {
69 #ifdef WIN32 // silly VC++ gives error if no members
70 int dummy;
71 #endif
72 } nr_stun_client_stun_binding_request_stund_0_96_params;
74 int nr_stun_build_req_stund_0_96(nr_stun_client_stun_binding_request_stund_0_96_params *params, nr_stun_message **msg);
75 #endif /* USE_STUND_0_96 */
78 #ifdef USE_ICE
79 typedef struct nr_stun_client_ice_use_candidate_params_ {
80 char *username;
81 Data password;
82 UINT4 priority;
83 UINT8 tiebreaker;
84 } nr_stun_client_ice_use_candidate_params;
86 int nr_stun_build_use_candidate(nr_stun_client_ice_use_candidate_params *params, nr_stun_message **msg);
89 typedef struct nr_stun_client_ice_binding_request_params_ {
90 char *username;
91 Data password;
92 UINT4 priority;
93 int control;
94 #define NR_ICE_CONTROLLING 1
95 #define NR_ICE_CONTROLLED 2
96 UINT8 tiebreaker;
97 } nr_stun_client_ice_binding_request_params;
99 int nr_stun_build_req_ice(nr_stun_client_ice_binding_request_params *params, nr_stun_message **msg);
100 #endif /* USE_ICE */
103 typedef struct nr_stun_client_auth_params_ {
104 char authenticate;
105 char *username;
106 char *realm;
107 char *nonce;
108 Data password;
109 } nr_stun_client_auth_params;
111 #ifdef USE_TURN
112 typedef struct nr_stun_client_allocate_request_params_ {
113 UINT4 lifetime_secs;
114 } nr_stun_client_allocate_request_params;
116 int nr_stun_build_allocate_request(nr_stun_client_auth_params *auth, nr_stun_client_allocate_request_params *params, nr_stun_message **msg);
119 typedef struct nr_stun_client_refresh_request_params_ {
120 UINT4 lifetime_secs;
121 } nr_stun_client_refresh_request_params;
123 int nr_stun_build_refresh_request(nr_stun_client_auth_params *auth, nr_stun_client_refresh_request_params *params, nr_stun_message **msg);
127 typedef struct nr_stun_client_permission_request_params_ {
128 nr_transport_addr remote_addr;
129 } nr_stun_client_permission_request_params;
131 int nr_stun_build_permission_request(nr_stun_client_auth_params *auth, nr_stun_client_permission_request_params *params, nr_stun_message **msg);
134 typedef struct nr_stun_client_send_indication_params_ {
135 nr_transport_addr remote_addr;
136 Data data;
137 } nr_stun_client_send_indication_params;
139 int nr_stun_build_send_indication(nr_stun_client_send_indication_params *params, nr_stun_message **msg);
141 typedef struct nr_stun_client_data_indication_params_ {
142 nr_transport_addr remote_addr;
143 Data data;
144 } nr_stun_client_data_indication_params;
146 int nr_stun_build_data_indication(nr_stun_client_data_indication_params *params, nr_stun_message **msg);
147 #endif /* USE_TURN */
149 int nr_stun_form_success_response(nr_stun_message *req, nr_transport_addr *from, Data *password, nr_stun_message *res);
150 void nr_stun_form_error_response(nr_stun_message *request, nr_stun_message* response, int number, char* msg);
151 int nr_stun_compute_lt_message_integrity_password(const char *username, const char *realm,
152 Data *password, Data *hmac_key);
154 #endif