aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_nat_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_nat_lib.h')
-rw-r--r--src/include/gnunet_nat_lib.h90
1 files changed, 43 insertions, 47 deletions
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h
index 2ab3eccb6..a84f684a7 100644
--- a/src/include/gnunet_nat_lib.h
+++ b/src/include/gnunet_nat_lib.h
@@ -41,9 +41,9 @@
41 * @param addr either the previous or the new public IP address 41 * @param addr either the previous or the new public IP address
42 * @param addrlen actual lenght of the address 42 * @param addrlen actual lenght of the address
43 */ 43 */
44typedef void (*GNUNET_NAT_AddressCallback) (void *cls, 44typedef void (*GNUNET_NAT_AddressCallback) (void *cls,
45 int add_remove, 45 int add_remove,
46 const struct sockaddr *addr, 46 const struct sockaddr * addr,
47 socklen_t addrlen); 47 socklen_t addrlen);
48 48
49 49
@@ -56,9 +56,9 @@ typedef void (*GNUNET_NAT_AddressCallback) (void *cls,
56 * @param addr public IP address of the other peer 56 * @param addr public IP address of the other peer
57 * @param addrlen actual lenght of the address 57 * @param addrlen actual lenght of the address
58 */ 58 */
59typedef void (*GNUNET_NAT_ReversalCallback) (void *cls, 59typedef void (*GNUNET_NAT_ReversalCallback) (void *cls,
60 const struct sockaddr *addr, 60 const struct sockaddr * addr,
61 socklen_t addrlen); 61 socklen_t addrlen);
62 62
63 63
64/** 64/**
@@ -87,16 +87,17 @@ struct GNUNET_NAT_Handle;
87 * @param callback_cls closure for callback 87 * @param callback_cls closure for callback
88 * @return NULL on error, otherwise handle that can be used to unregister 88 * @return NULL on error, otherwise handle that can be used to unregister
89 */ 89 */
90struct GNUNET_NAT_Handle * 90struct GNUNET_NAT_Handle *GNUNET_NAT_register (const struct
91GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, 91 GNUNET_CONFIGURATION_Handle *cfg,
92 int is_tcp, 92 int is_tcp, uint16_t adv_port,
93 uint16_t adv_port, 93 unsigned int num_addrs,
94 unsigned int num_addrs, 94 const struct sockaddr **addrs,
95 const struct sockaddr **addrs, 95 const socklen_t * addrlens,
96 const socklen_t *addrlens, 96 GNUNET_NAT_AddressCallback
97 GNUNET_NAT_AddressCallback address_callback, 97 address_callback,
98 GNUNET_NAT_ReversalCallback reversal_callback, 98 GNUNET_NAT_ReversalCallback
99 void *callback_cls); 99 reversal_callback,
100 void *callback_cls);
100 101
101 102
102/** 103/**
@@ -111,8 +112,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
111 */ 112 */
112int 113int
113GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, 114GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h,
114 const void *addr, 115 const void *addr, socklen_t addrlen);
115 socklen_t addrlen);
116 116
117 117
118/** 118/**
@@ -125,7 +125,7 @@ GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h,
125 */ 125 */
126void 126void
127GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, 127GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h,
128 const struct sockaddr_in *sa); 128 const struct sockaddr_in *sa);
129 129
130 130
131 131
@@ -135,8 +135,7 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h,
135 * 135 *
136 * @param h the handle to stop 136 * @param h the handle to stop
137 */ 137 */
138void 138void GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h);
139GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h);
140 139
141 140
142/** 141/**
@@ -153,8 +152,7 @@ struct GNUNET_NAT_Test;
153 * GNUNET_SYSERR if the test could not be 152 * GNUNET_SYSERR if the test could not be
154 * properly started (internal failure) 153 * properly started (internal failure)
155 */ 154 */
156typedef void (*GNUNET_NAT_TestCallback)(void *cls, 155typedef void (*GNUNET_NAT_TestCallback) (void *cls, int success);
157 int success);
158 156
159/** 157/**
160 * Start testing if NAT traversal works using the 158 * Start testing if NAT traversal works using the
@@ -168,13 +166,12 @@ typedef void (*GNUNET_NAT_TestCallback)(void *cls,
168 * @param report_cls closure for report 166 * @param report_cls closure for report
169 * @return handle to cancel NAT test 167 * @return handle to cancel NAT test
170 */ 168 */
171struct GNUNET_NAT_Test * 169struct GNUNET_NAT_Test *GNUNET_NAT_test_start (const struct
172GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, 170 GNUNET_CONFIGURATION_Handle *cfg,
173 int is_tcp, 171 int is_tcp, uint16_t bnd_port,
174 uint16_t bnd_port, 172 uint16_t adv_port,
175 uint16_t adv_port, 173 GNUNET_NAT_TestCallback report,
176 GNUNET_NAT_TestCallback report, 174 void *report_cls);
177 void *report_cls);
178 175
179 176
180/** 177/**
@@ -182,8 +179,7 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
182 * 179 *
183 * @param tst test to stop. 180 * @param tst test to stop.
184 */ 181 */
185void 182void GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst);
186GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst);
187 183
188 184
189/** 185/**
@@ -192,8 +188,7 @@ GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst);
192 * @param cls closure 188 * @param cls closure
193 * @param addr the address, NULL on errors 189 * @param addr the address, NULL on errors
194 */ 190 */
195typedef void (*GNUNET_NAT_IPCallback)(void *cls, 191typedef void (*GNUNET_NAT_IPCallback) (void *cls, const struct in_addr * addr);
196 const struct in_addr *addr);
197 192
198 193
199 194
@@ -211,10 +206,13 @@ struct GNUNET_NAT_ExternalHandle;
211 * @param cb_cls closure for 'cb' 206 * @param cb_cls closure for 'cb'
212 * @return handle for cancellation (can only be used until 'cb' is called), NULL on error 207 * @return handle for cancellation (can only be used until 'cb' is called), NULL on error
213 */ 208 */
214struct GNUNET_NAT_ExternalHandle * 209struct GNUNET_NAT_ExternalHandle *GNUNET_NAT_mini_get_external_ipv4 (struct
215GNUNET_NAT_mini_get_external_ipv4 (struct GNUNET_TIME_Relative timeout, 210 GNUNET_TIME_Relative
216 GNUNET_NAT_IPCallback cb, 211 timeout,
217 void *cb_cls); 212 GNUNET_NAT_IPCallback
213 cb,
214 void
215 *cb_cls);
218 216
219 217
220/** 218/**
@@ -228,7 +226,7 @@ GNUNET_NAT_mini_get_external_ipv4_cancel (struct GNUNET_NAT_ExternalHandle *eh);
228 226
229/** 227/**
230 * Handle to a mapping created with upnpc. 228 * Handle to a mapping created with upnpc.
231 */ 229 */
232struct GNUNET_NAT_MiniHandle; 230struct GNUNET_NAT_MiniHandle;
233 231
234 232
@@ -245,11 +243,10 @@ struct GNUNET_NAT_MiniHandle;
245 * @param ac_cls closure for 'ac' 243 * @param ac_cls closure for 'ac'
246 * @return NULL on error 244 * @return NULL on error
247 */ 245 */
248struct GNUNET_NAT_MiniHandle * 246struct GNUNET_NAT_MiniHandle *GNUNET_NAT_mini_map_start (uint16_t port,
249GNUNET_NAT_mini_map_start (uint16_t port, 247 int is_tcp,
250 int is_tcp, 248 GNUNET_NAT_AddressCallback
251 GNUNET_NAT_AddressCallback ac, 249 ac, void *ac_cls);
252 void *ac_cls);
253 250
254 251
255/** 252/**
@@ -260,10 +257,9 @@ GNUNET_NAT_mini_map_start (uint16_t port,
260 * 257 *
261 * @param mini the handle 258 * @param mini the handle
262 */ 259 */
263void 260void GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini);
264GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini);
265 261
266 262
267#endif 263#endif
268 264
269/* end of gnunet_nat_lib.h */ 265/* end of gnunet_nat_lib.h */