diff options
Diffstat (limited to 'src/include/gnunet_nat_lib.h')
-rw-r--r-- | src/include/gnunet_nat_lib.h | 90 |
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 | */ |
44 | typedef void (*GNUNET_NAT_AddressCallback) (void *cls, | 44 | typedef 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 | */ |
59 | typedef void (*GNUNET_NAT_ReversalCallback) (void *cls, | 59 | typedef 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 | */ |
90 | struct GNUNET_NAT_Handle * | 90 | struct GNUNET_NAT_Handle *GNUNET_NAT_register (const struct |
91 | GNUNET_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 | */ |
112 | int | 113 | int |
113 | GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, | 114 | GNUNET_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 | */ |
126 | void | 126 | void |
127 | GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, | 127 | GNUNET_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 | */ |
138 | void | 138 | void GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h); |
139 | GNUNET_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 | */ |
156 | typedef void (*GNUNET_NAT_TestCallback)(void *cls, | 155 | typedef 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 | */ |
171 | struct GNUNET_NAT_Test * | 169 | struct GNUNET_NAT_Test *GNUNET_NAT_test_start (const struct |
172 | GNUNET_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 | */ |
185 | void | 182 | void GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); |
186 | GNUNET_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 | */ |
195 | typedef void (*GNUNET_NAT_IPCallback)(void *cls, | 191 | typedef 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 | */ |
214 | struct GNUNET_NAT_ExternalHandle * | 209 | struct GNUNET_NAT_ExternalHandle *GNUNET_NAT_mini_get_external_ipv4 (struct |
215 | GNUNET_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 | */ |
232 | struct GNUNET_NAT_MiniHandle; | 230 | struct 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 | */ |
248 | struct GNUNET_NAT_MiniHandle * | 246 | struct GNUNET_NAT_MiniHandle *GNUNET_NAT_mini_map_start (uint16_t port, |
249 | GNUNET_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 | */ |
263 | void | 260 | void GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini); |
264 | GNUNET_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 */ |