diff options
Diffstat (limited to 'src/vpn/vpn_api.c')
-rw-r--r-- | src/vpn/vpn_api.c | 341 |
1 files changed, 173 insertions, 168 deletions
diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c index dcb1d99c9..3b5ea9257 100644 --- a/src/vpn/vpn_api.c +++ b/src/vpn/vpn_api.c | |||
@@ -31,7 +31,8 @@ | |||
31 | /** | 31 | /** |
32 | * Opaque VPN handle | 32 | * Opaque VPN handle |
33 | */ | 33 | */ |
34 | struct GNUNET_VPN_Handle { | 34 | struct GNUNET_VPN_Handle |
35 | { | ||
35 | /** | 36 | /** |
36 | * Configuration we use. | 37 | * Configuration we use. |
37 | */ | 38 | */ |
@@ -72,7 +73,8 @@ struct GNUNET_VPN_Handle { | |||
72 | /** | 73 | /** |
73 | * Opaque redirection request handle. | 74 | * Opaque redirection request handle. |
74 | */ | 75 | */ |
75 | struct GNUNET_VPN_RedirectionRequest { | 76 | struct GNUNET_VPN_RedirectionRequest |
77 | { | ||
76 | /** | 78 | /** |
77 | * Element in DLL. | 79 | * Element in DLL. |
78 | */ | 80 | */ |
@@ -147,7 +149,7 @@ struct GNUNET_VPN_RedirectionRequest { | |||
147 | * @param vh handle to reconnect. | 149 | * @param vh handle to reconnect. |
148 | */ | 150 | */ |
149 | static void | 151 | static void |
150 | reconnect(struct GNUNET_VPN_Handle *vh); | 152 | reconnect (struct GNUNET_VPN_Handle *vh); |
151 | 153 | ||
152 | 154 | ||
153 | /** | 155 | /** |
@@ -159,37 +161,37 @@ reconnect(struct GNUNET_VPN_Handle *vh); | |||
159 | * @return #GNUNET_OK if @a rm is well-formed | 161 | * @return #GNUNET_OK if @a rm is well-formed |
160 | */ | 162 | */ |
161 | static int | 163 | static int |
162 | check_use_ip(void *cls, | 164 | check_use_ip (void *cls, |
163 | const struct RedirectToIpResponseMessage *rm) | 165 | const struct RedirectToIpResponseMessage *rm) |
164 | { | 166 | { |
165 | size_t alen; | 167 | size_t alen; |
166 | int af; | 168 | int af; |
167 | 169 | ||
168 | af = (int)ntohl(rm->result_af); | 170 | af = (int) ntohl (rm->result_af); |
169 | switch (af) | 171 | switch (af) |
170 | { | 172 | { |
171 | case AF_UNSPEC: | 173 | case AF_UNSPEC: |
172 | alen = 0; | 174 | alen = 0; |
173 | break; | 175 | break; |
174 | 176 | ||
175 | case AF_INET: | 177 | case AF_INET: |
176 | alen = sizeof(struct in_addr); | 178 | alen = sizeof(struct in_addr); |
177 | break; | 179 | break; |
178 | 180 | ||
179 | case AF_INET6: | 181 | case AF_INET6: |
180 | alen = sizeof(struct in6_addr); | 182 | alen = sizeof(struct in6_addr); |
181 | break; | 183 | break; |
182 | 184 | ||
183 | default: | 185 | default: |
184 | GNUNET_break(0); | 186 | GNUNET_break (0); |
185 | return GNUNET_SYSERR; | 187 | return GNUNET_SYSERR; |
186 | } | 188 | } |
187 | if ((ntohs(rm->header.size) != alen + sizeof(*rm)) || | 189 | if ((ntohs (rm->header.size) != alen + sizeof(*rm)) || |
188 | (0 == rm->request_id)) | 190 | (0 == rm->request_id)) |
189 | { | 191 | { |
190 | GNUNET_break(0); | 192 | GNUNET_break (0); |
191 | return GNUNET_SYSERR; | 193 | return GNUNET_SYSERR; |
192 | } | 194 | } |
193 | return GNUNET_OK; | 195 | return GNUNET_OK; |
194 | } | 196 | } |
195 | 197 | ||
@@ -202,28 +204,28 @@ check_use_ip(void *cls, | |||
202 | * @param rm message received | 204 | * @param rm message received |
203 | */ | 205 | */ |
204 | static void | 206 | static void |
205 | handle_use_ip(void *cls, | 207 | handle_use_ip (void *cls, |
206 | const struct RedirectToIpResponseMessage *rm) | 208 | const struct RedirectToIpResponseMessage *rm) |
207 | { | 209 | { |
208 | struct GNUNET_VPN_Handle *vh = cls; | 210 | struct GNUNET_VPN_Handle *vh = cls; |
209 | struct GNUNET_VPN_RedirectionRequest *rr; | 211 | struct GNUNET_VPN_RedirectionRequest *rr; |
210 | int af; | 212 | int af; |
211 | 213 | ||
212 | af = (int)ntohl(rm->result_af); | 214 | af = (int) ntohl (rm->result_af); |
213 | for (rr = vh->rr_head; NULL != rr; rr = rr->next) | 215 | for (rr = vh->rr_head; NULL != rr; rr = rr->next) |
216 | { | ||
217 | if (rr->request_id == rm->request_id) | ||
214 | { | 218 | { |
215 | if (rr->request_id == rm->request_id) | 219 | GNUNET_CONTAINER_DLL_remove (vh->rr_head, |
216 | { | 220 | vh->rr_tail, |
217 | GNUNET_CONTAINER_DLL_remove(vh->rr_head, | 221 | rr); |
218 | vh->rr_tail, | 222 | rr->cb (rr->cb_cls, |
219 | rr); | 223 | af, |
220 | rr->cb(rr->cb_cls, | 224 | (af == AF_UNSPEC) ? NULL : &rm[1]); |
221 | af, | 225 | GNUNET_free (rr); |
222 | (af == AF_UNSPEC) ? NULL : &rm[1]); | 226 | break; |
223 | GNUNET_free(rr); | ||
224 | break; | ||
225 | } | ||
226 | } | 227 | } |
228 | } | ||
227 | } | 229 | } |
228 | 230 | ||
229 | 231 | ||
@@ -233,7 +235,7 @@ handle_use_ip(void *cls, | |||
233 | * @param rr request to queue and transmit. | 235 | * @param rr request to queue and transmit. |
234 | */ | 236 | */ |
235 | static void | 237 | static void |
236 | send_request(struct GNUNET_VPN_RedirectionRequest *rr) | 238 | send_request (struct GNUNET_VPN_RedirectionRequest *rr) |
237 | { | 239 | { |
238 | struct GNUNET_VPN_Handle *vh = rr->vh; | 240 | struct GNUNET_VPN_Handle *vh = rr->vh; |
239 | struct RedirectToIpRequestMessage *rip; | 241 | struct RedirectToIpRequestMessage *rip; |
@@ -244,47 +246,47 @@ send_request(struct GNUNET_VPN_RedirectionRequest *rr) | |||
244 | if (NULL == vh->mq) | 246 | if (NULL == vh->mq) |
245 | return; | 247 | return; |
246 | if (NULL == rr->addr) | 248 | if (NULL == rr->addr) |
247 | { | 249 | { |
248 | env = GNUNET_MQ_msg(rs, | 250 | env = GNUNET_MQ_msg (rs, |
249 | GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE); | 251 | GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE); |
250 | rs->reserved = htonl(0); | 252 | rs->reserved = htonl (0); |
251 | rs->expiration_time = GNUNET_TIME_absolute_hton(rr->expiration_time); | 253 | rs->expiration_time = GNUNET_TIME_absolute_hton (rr->expiration_time); |
252 | rs->protocol = htonl(rr->protocol); | 254 | rs->protocol = htonl (rr->protocol); |
253 | rs->result_af = htonl(rr->result_af); | 255 | rs->result_af = htonl (rr->result_af); |
254 | rs->target = rr->peer; | 256 | rs->target = rr->peer; |
255 | rs->service_descriptor = rr->serv; | 257 | rs->service_descriptor = rr->serv; |
256 | rs->request_id = rr->request_id = ++vh->request_id_gen; | 258 | rs->request_id = rr->request_id = ++vh->request_id_gen; |
257 | } | 259 | } |
258 | else | 260 | else |
261 | { | ||
262 | switch (rr->addr_af) | ||
259 | { | 263 | { |
260 | switch (rr->addr_af) | 264 | case AF_INET: |
261 | { | 265 | alen = sizeof(struct in_addr); |
262 | case AF_INET: | 266 | break; |
263 | alen = sizeof(struct in_addr); | 267 | |
264 | break; | 268 | case AF_INET6: |
265 | 269 | alen = sizeof(struct in6_addr); | |
266 | case AF_INET6: | 270 | break; |
267 | alen = sizeof(struct in6_addr); | 271 | |
268 | break; | 272 | default: |
269 | 273 | GNUNET_assert (0); | |
270 | default: | 274 | return; |
271 | GNUNET_assert(0); | ||
272 | return; | ||
273 | } | ||
274 | env = GNUNET_MQ_msg_extra(rip, | ||
275 | alen, | ||
276 | GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP); | ||
277 | rip->reserved = htonl(0); | ||
278 | rip->expiration_time = GNUNET_TIME_absolute_hton(rr->expiration_time); | ||
279 | rip->result_af = htonl(rr->result_af); | ||
280 | rip->addr_af = htonl(rr->addr_af); | ||
281 | rip->request_id = rr->request_id = ++vh->request_id_gen; | ||
282 | GNUNET_memcpy(&rip[1], | ||
283 | rr->addr, | ||
284 | alen); | ||
285 | } | 275 | } |
286 | GNUNET_MQ_send(vh->mq, | 276 | env = GNUNET_MQ_msg_extra (rip, |
287 | env); | 277 | alen, |
278 | GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP); | ||
279 | rip->reserved = htonl (0); | ||
280 | rip->expiration_time = GNUNET_TIME_absolute_hton (rr->expiration_time); | ||
281 | rip->result_af = htonl (rr->result_af); | ||
282 | rip->addr_af = htonl (rr->addr_af); | ||
283 | rip->request_id = rr->request_id = ++vh->request_id_gen; | ||
284 | GNUNET_memcpy (&rip[1], | ||
285 | rr->addr, | ||
286 | alen); | ||
287 | } | ||
288 | GNUNET_MQ_send (vh->mq, | ||
289 | env); | ||
288 | } | 290 | } |
289 | 291 | ||
290 | 292 | ||
@@ -297,12 +299,12 @@ send_request(struct GNUNET_VPN_RedirectionRequest *rr) | |||
297 | * @param error error code | 299 | * @param error error code |
298 | */ | 300 | */ |
299 | static void | 301 | static void |
300 | mq_error_handler(void *cls, | 302 | mq_error_handler (void *cls, |
301 | enum GNUNET_MQ_Error error) | 303 | enum GNUNET_MQ_Error error) |
302 | { | 304 | { |
303 | struct GNUNET_VPN_Handle *vh = cls; | 305 | struct GNUNET_VPN_Handle *vh = cls; |
304 | 306 | ||
305 | reconnect(vh); | 307 | reconnect (vh); |
306 | } | 308 | } |
307 | 309 | ||
308 | 310 | ||
@@ -312,28 +314,28 @@ mq_error_handler(void *cls, | |||
312 | * @param cls the `struct GNUNET_VPN_Handle *` | 314 | * @param cls the `struct GNUNET_VPN_Handle *` |
313 | */ | 315 | */ |
314 | static void | 316 | static void |
315 | connect_task(void *cls) | 317 | connect_task (void *cls) |
316 | { | 318 | { |
317 | struct GNUNET_VPN_Handle *vh = cls; | 319 | struct GNUNET_VPN_Handle *vh = cls; |
318 | struct GNUNET_MQ_MessageHandler handlers[] = { | 320 | struct GNUNET_MQ_MessageHandler handlers[] = { |
319 | GNUNET_MQ_hd_var_size(use_ip, | 321 | GNUNET_MQ_hd_var_size (use_ip, |
320 | GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP, | 322 | GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP, |
321 | struct RedirectToIpResponseMessage, | 323 | struct RedirectToIpResponseMessage, |
322 | cls), | 324 | cls), |
323 | GNUNET_MQ_handler_end() | 325 | GNUNET_MQ_handler_end () |
324 | }; | 326 | }; |
325 | struct GNUNET_VPN_RedirectionRequest *rr; | 327 | struct GNUNET_VPN_RedirectionRequest *rr; |
326 | 328 | ||
327 | vh->rt = NULL; | 329 | vh->rt = NULL; |
328 | vh->mq = GNUNET_CLIENT_connect(vh->cfg, | 330 | vh->mq = GNUNET_CLIENT_connect (vh->cfg, |
329 | "vpn", | 331 | "vpn", |
330 | handlers, | 332 | handlers, |
331 | &mq_error_handler, | 333 | &mq_error_handler, |
332 | vh); | 334 | vh); |
333 | if (NULL == vh->mq) | 335 | if (NULL == vh->mq) |
334 | return; | 336 | return; |
335 | for (rr = vh->rr_head; NULL != rr; rr = rr->next) | 337 | for (rr = vh->rr_head; NULL != rr; rr = rr->next) |
336 | send_request(rr); | 338 | send_request (rr); |
337 | } | 339 | } |
338 | 340 | ||
339 | 341 | ||
@@ -343,21 +345,24 @@ connect_task(void *cls) | |||
343 | * @param vh handle to reconnect. | 345 | * @param vh handle to reconnect. |
344 | */ | 346 | */ |
345 | static void | 347 | static void |
346 | reconnect(struct GNUNET_VPN_Handle *vh) | 348 | reconnect (struct GNUNET_VPN_Handle *vh) |
347 | { | 349 | { |
348 | struct GNUNET_VPN_RedirectionRequest *rr; | 350 | struct GNUNET_VPN_RedirectionRequest *rr; |
349 | 351 | ||
350 | GNUNET_MQ_destroy(vh->mq); | 352 | GNUNET_MQ_destroy (vh->mq); |
351 | vh->mq = NULL; | 353 | vh->mq = NULL; |
352 | vh->request_id_gen = 0; | 354 | vh->request_id_gen = 0; |
353 | for (rr = vh->rr_head; NULL != rr; rr = rr->next) | 355 | for (rr = vh->rr_head; NULL != rr; rr = rr->next) |
354 | rr->request_id = 0; | 356 | rr->request_id = 0; |
355 | vh->backoff = GNUNET_TIME_relative_max(GNUNET_TIME_UNIT_MILLISECONDS, | 357 | vh->backoff = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, |
356 | GNUNET_TIME_relative_min(GNUNET_TIME_relative_saturating_multiply(vh->backoff, 2), | 358 | GNUNET_TIME_relative_min ( |
357 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30))); | 359 | GNUNET_TIME_relative_saturating_multiply ( |
358 | vh->rt = GNUNET_SCHEDULER_add_delayed(vh->backoff, | 360 | vh->backoff, 2), |
359 | &connect_task, | 361 | GNUNET_TIME_relative_multiply ( |
360 | vh); | 362 | GNUNET_TIME_UNIT_SECONDS, 30))); |
363 | vh->rt = GNUNET_SCHEDULER_add_delayed (vh->backoff, | ||
364 | &connect_task, | ||
365 | vh); | ||
361 | } | 366 | } |
362 | 367 | ||
363 | 368 | ||
@@ -367,15 +372,15 @@ reconnect(struct GNUNET_VPN_Handle *vh) | |||
367 | * @param rr request to cancel | 372 | * @param rr request to cancel |
368 | */ | 373 | */ |
369 | void | 374 | void |
370 | GNUNET_VPN_cancel_request(struct GNUNET_VPN_RedirectionRequest *rr) | 375 | GNUNET_VPN_cancel_request (struct GNUNET_VPN_RedirectionRequest *rr) |
371 | { | 376 | { |
372 | struct GNUNET_VPN_Handle *vh; | 377 | struct GNUNET_VPN_Handle *vh; |
373 | 378 | ||
374 | vh = rr->vh; | 379 | vh = rr->vh; |
375 | GNUNET_CONTAINER_DLL_remove(vh->rr_head, | 380 | GNUNET_CONTAINER_DLL_remove (vh->rr_head, |
376 | vh->rr_tail, | 381 | vh->rr_tail, |
377 | rr); | 382 | rr); |
378 | GNUNET_free(rr); | 383 | GNUNET_free (rr); |
379 | } | 384 | } |
380 | 385 | ||
381 | 386 | ||
@@ -402,18 +407,18 @@ GNUNET_VPN_cancel_request(struct GNUNET_VPN_RedirectionRequest *rr) | |||
402 | * anyway) | 407 | * anyway) |
403 | */ | 408 | */ |
404 | struct GNUNET_VPN_RedirectionRequest * | 409 | struct GNUNET_VPN_RedirectionRequest * |
405 | GNUNET_VPN_redirect_to_peer(struct GNUNET_VPN_Handle *vh, | 410 | GNUNET_VPN_redirect_to_peer (struct GNUNET_VPN_Handle *vh, |
406 | int result_af, | 411 | int result_af, |
407 | uint8_t protocol, | 412 | uint8_t protocol, |
408 | const struct GNUNET_PeerIdentity *peer, | 413 | const struct GNUNET_PeerIdentity *peer, |
409 | const struct GNUNET_HashCode *serv, | 414 | const struct GNUNET_HashCode *serv, |
410 | struct GNUNET_TIME_Absolute expiration_time, | 415 | struct GNUNET_TIME_Absolute expiration_time, |
411 | GNUNET_VPN_AllocationCallback cb, | 416 | GNUNET_VPN_AllocationCallback cb, |
412 | void *cb_cls) | 417 | void *cb_cls) |
413 | { | 418 | { |
414 | struct GNUNET_VPN_RedirectionRequest *rr; | 419 | struct GNUNET_VPN_RedirectionRequest *rr; |
415 | 420 | ||
416 | rr = GNUNET_new(struct GNUNET_VPN_RedirectionRequest); | 421 | rr = GNUNET_new (struct GNUNET_VPN_RedirectionRequest); |
417 | rr->vh = vh; | 422 | rr->vh = vh; |
418 | rr->cb = cb; | 423 | rr->cb = cb; |
419 | rr->cb_cls = cb_cls; | 424 | rr->cb_cls = cb_cls; |
@@ -422,10 +427,10 @@ GNUNET_VPN_redirect_to_peer(struct GNUNET_VPN_Handle *vh, | |||
422 | rr->expiration_time = expiration_time; | 427 | rr->expiration_time = expiration_time; |
423 | rr->result_af = result_af; | 428 | rr->result_af = result_af; |
424 | rr->protocol = protocol; | 429 | rr->protocol = protocol; |
425 | GNUNET_CONTAINER_DLL_insert_tail(vh->rr_head, | 430 | GNUNET_CONTAINER_DLL_insert_tail (vh->rr_head, |
426 | vh->rr_tail, | 431 | vh->rr_tail, |
427 | rr); | 432 | rr); |
428 | send_request(rr); | 433 | send_request (rr); |
429 | return rr; | 434 | return rr; |
430 | } | 435 | } |
431 | 436 | ||
@@ -453,32 +458,32 @@ GNUNET_VPN_redirect_to_peer(struct GNUNET_VPN_Handle *vh, | |||
453 | * anyway) | 458 | * anyway) |
454 | */ | 459 | */ |
455 | struct GNUNET_VPN_RedirectionRequest * | 460 | struct GNUNET_VPN_RedirectionRequest * |
456 | GNUNET_VPN_redirect_to_ip(struct GNUNET_VPN_Handle *vh, | 461 | GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh, |
457 | int result_af, | 462 | int result_af, |
458 | int addr_af, | 463 | int addr_af, |
459 | const void *addr, | 464 | const void *addr, |
460 | struct GNUNET_TIME_Absolute expiration_time, | 465 | struct GNUNET_TIME_Absolute expiration_time, |
461 | GNUNET_VPN_AllocationCallback cb, | 466 | GNUNET_VPN_AllocationCallback cb, |
462 | void *cb_cls) | 467 | void *cb_cls) |
463 | { | 468 | { |
464 | struct GNUNET_VPN_RedirectionRequest *rr; | 469 | struct GNUNET_VPN_RedirectionRequest *rr; |
465 | size_t alen; | 470 | size_t alen; |
466 | 471 | ||
467 | switch (addr_af) | 472 | switch (addr_af) |
468 | { | 473 | { |
469 | case AF_INET: | 474 | case AF_INET: |
470 | alen = sizeof(struct in_addr); | 475 | alen = sizeof(struct in_addr); |
471 | break; | 476 | break; |
472 | 477 | ||
473 | case AF_INET6: | 478 | case AF_INET6: |
474 | alen = sizeof(struct in6_addr); | 479 | alen = sizeof(struct in6_addr); |
475 | break; | 480 | break; |
476 | 481 | ||
477 | default: | 482 | default: |
478 | GNUNET_break(0); | 483 | GNUNET_break (0); |
479 | return NULL; | 484 | return NULL; |
480 | } | 485 | } |
481 | rr = GNUNET_malloc(sizeof(struct GNUNET_VPN_RedirectionRequest) + alen); | 486 | rr = GNUNET_malloc (sizeof(struct GNUNET_VPN_RedirectionRequest) + alen); |
482 | rr->vh = vh; | 487 | rr->vh = vh; |
483 | rr->addr = &rr[1]; | 488 | rr->addr = &rr[1]; |
484 | rr->cb = cb; | 489 | rr->cb = cb; |
@@ -486,13 +491,13 @@ GNUNET_VPN_redirect_to_ip(struct GNUNET_VPN_Handle *vh, | |||
486 | rr->expiration_time = expiration_time; | 491 | rr->expiration_time = expiration_time; |
487 | rr->result_af = result_af; | 492 | rr->result_af = result_af; |
488 | rr->addr_af = addr_af; | 493 | rr->addr_af = addr_af; |
489 | GNUNET_memcpy(&rr[1], | 494 | GNUNET_memcpy (&rr[1], |
490 | addr, | 495 | addr, |
491 | alen); | 496 | alen); |
492 | GNUNET_CONTAINER_DLL_insert_tail(vh->rr_head, | 497 | GNUNET_CONTAINER_DLL_insert_tail (vh->rr_head, |
493 | vh->rr_tail, | 498 | vh->rr_tail, |
494 | rr); | 499 | rr); |
495 | send_request(rr); | 500 | send_request (rr); |
496 | return rr; | 501 | return rr; |
497 | } | 502 | } |
498 | 503 | ||
@@ -504,18 +509,18 @@ GNUNET_VPN_redirect_to_ip(struct GNUNET_VPN_Handle *vh, | |||
504 | * @return VPN handle | 509 | * @return VPN handle |
505 | */ | 510 | */ |
506 | struct GNUNET_VPN_Handle * | 511 | struct GNUNET_VPN_Handle * |
507 | GNUNET_VPN_connect(const struct GNUNET_CONFIGURATION_Handle *cfg) | 512 | GNUNET_VPN_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) |
508 | { | 513 | { |
509 | struct GNUNET_VPN_Handle *vh | 514 | struct GNUNET_VPN_Handle *vh |
510 | = GNUNET_new(struct GNUNET_VPN_Handle); | 515 | = GNUNET_new (struct GNUNET_VPN_Handle); |
511 | 516 | ||
512 | vh->cfg = cfg; | 517 | vh->cfg = cfg; |
513 | connect_task(vh); | 518 | connect_task (vh); |
514 | if (NULL == vh->mq) | 519 | if (NULL == vh->mq) |
515 | { | 520 | { |
516 | GNUNET_free(vh); | 521 | GNUNET_free (vh); |
517 | return NULL; | 522 | return NULL; |
518 | } | 523 | } |
519 | return vh; | 524 | return vh; |
520 | } | 525 | } |
521 | 526 | ||
@@ -526,20 +531,20 @@ GNUNET_VPN_connect(const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
526 | * @param vh VPN handle | 531 | * @param vh VPN handle |
527 | */ | 532 | */ |
528 | void | 533 | void |
529 | GNUNET_VPN_disconnect(struct GNUNET_VPN_Handle *vh) | 534 | GNUNET_VPN_disconnect (struct GNUNET_VPN_Handle *vh) |
530 | { | 535 | { |
531 | GNUNET_assert(NULL == vh->rr_head); | 536 | GNUNET_assert (NULL == vh->rr_head); |
532 | if (NULL != vh->mq) | 537 | if (NULL != vh->mq) |
533 | { | 538 | { |
534 | GNUNET_MQ_destroy(vh->mq); | 539 | GNUNET_MQ_destroy (vh->mq); |
535 | vh->mq = NULL; | 540 | vh->mq = NULL; |
536 | } | 541 | } |
537 | if (NULL != vh->rt) | 542 | if (NULL != vh->rt) |
538 | { | 543 | { |
539 | GNUNET_SCHEDULER_cancel(vh->rt); | 544 | GNUNET_SCHEDULER_cancel (vh->rt); |
540 | vh->rt = NULL; | 545 | vh->rt = NULL; |
541 | } | 546 | } |
542 | GNUNET_free(vh); | 547 | GNUNET_free (vh); |
543 | } | 548 | } |
544 | 549 | ||
545 | /* end of vpn_api.c */ | 550 | /* end of vpn_api.c */ |