aboutsummaryrefslogtreecommitdiff
path: root/src/vpn/vpn_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpn/vpn_api.c')
-rw-r--r--src/vpn/vpn_api.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c
index 8539a6a37..cf493cc52 100644
--- a/src/vpn/vpn_api.c
+++ b/src/vpn/vpn_api.c
@@ -106,7 +106,7 @@ struct GNUNET_VPN_RedirectionRequest
106 * Function to call with the designated IP address. 106 * Function to call with the designated IP address.
107 */ 107 */
108 GNUNET_VPN_AllocationCallback cb; 108 GNUNET_VPN_AllocationCallback cb;
109 109
110 /** 110 /**
111 * Closure for 'cb'. 111 * Closure for 'cb'.
112 */ 112 */
@@ -120,7 +120,7 @@ struct GNUNET_VPN_RedirectionRequest
120 /** 120 /**
121 * For service redirection, service descriptor. 121 * For service redirection, service descriptor.
122 */ 122 */
123 struct GNUNET_HashCode serv; 123 struct GNUNET_HashCode serv;
124 124
125 /** 125 /**
126 * At what time should the created service mapping expire? 126 * At what time should the created service mapping expire?
@@ -141,7 +141,7 @@ struct GNUNET_VPN_RedirectionRequest
141 * Address family of 'addr'. AF_INET or AF_INET6. 141 * Address family of 'addr'. AF_INET or AF_INET6.
142 */ 142 */
143 int addr_af; 143 int addr_af;
144 144
145 /** 145 /**
146 * For service redirection, IPPROT_UDP or IPPROTO_TCP. 146 * For service redirection, IPPROT_UDP or IPPROTO_TCP.
147 */ 147 */
@@ -165,7 +165,7 @@ reconnect (struct GNUNET_VPN_Handle *vh);
165 * @param cls the 'struct GNUNET_VPN_Handle' 165 * @param cls the 'struct GNUNET_VPN_Handle'
166 * @param msg message received, NULL on timeout or fatal error 166 * @param msg message received, NULL on timeout or fatal error
167 */ 167 */
168static void 168static void
169receive_response (void *cls, 169receive_response (void *cls,
170 const struct GNUNET_MessageHeader* msg) 170 const struct GNUNET_MessageHeader* msg)
171{ 171{
@@ -176,7 +176,7 @@ receive_response (void *cls,
176 size_t alen; 176 size_t alen;
177 int af; 177 int af;
178 178
179 if (NULL == msg) 179 if (NULL == msg)
180 { 180 {
181 reconnect (vh); 181 reconnect (vh);
182 return; 182 return;
@@ -212,10 +212,10 @@ receive_response (void *cls,
212 GNUNET_break (0); 212 GNUNET_break (0);
213 reconnect (vh); 213 reconnect (vh);
214 return; 214 return;
215 } 215 }
216 GNUNET_CLIENT_receive (vh->client, 216 GNUNET_CLIENT_receive (vh->client,
217 &receive_response, vh, 217 &receive_response, vh,
218 GNUNET_TIME_UNIT_FOREVER_REL); 218 GNUNET_TIME_UNIT_FOREVER_REL);
219 for (rr = vh->rr_head; NULL != rr; rr = rr->next) 219 for (rr = vh->rr_head; NULL != rr; rr = rr->next)
220 { 220 {
221 if (rr->request_id == rm->request_id) 221 if (rr->request_id == rm->request_id)
@@ -260,9 +260,9 @@ transmit_request (void *cls,
260 while ( (NULL != rr) && 260 while ( (NULL != rr) &&
261 (0 != rr->request_id) ) 261 (0 != rr->request_id) )
262 rr = rr->next; 262 rr = rr->next;
263 if (NULL == rr) 263 if (NULL == rr)
264 return 0; 264 return 0;
265 if (0 == size) 265 if (0 == size)
266 { 266 {
267 reconnect (vh); 267 reconnect (vh);
268 return 0; 268 return 0;
@@ -272,7 +272,7 @@ transmit_request (void *cls,
272 if (0 == vh->request_id_gen) 272 if (0 == vh->request_id_gen)
273 GNUNET_CLIENT_receive (vh->client, 273 GNUNET_CLIENT_receive (vh->client,
274 &receive_response, vh, 274 &receive_response, vh,
275 GNUNET_TIME_UNIT_FOREVER_REL); 275 GNUNET_TIME_UNIT_FOREVER_REL);
276 if (NULL == rr->addr) 276 if (NULL == rr->addr)
277 { 277 {
278 ret = sizeof (struct RedirectToServiceRequestMessage); 278 ret = sizeof (struct RedirectToServiceRequestMessage);
@@ -285,7 +285,7 @@ transmit_request (void *cls,
285 rs.result_af = htonl (rr->result_af); 285 rs.result_af = htonl (rr->result_af);
286 rs.target = rr->peer; 286 rs.target = rr->peer;
287 rs.service_descriptor = rr->serv; 287 rs.service_descriptor = rr->serv;
288 rs.request_id = rr->request_id = ++vh->request_id_gen; 288 rs.request_id = rr->request_id = ++vh->request_id_gen;
289 memcpy (buf, &rs, sizeof (struct RedirectToServiceRequestMessage)); 289 memcpy (buf, &rs, sizeof (struct RedirectToServiceRequestMessage));
290 } 290 }
291 else 291 else
@@ -332,7 +332,7 @@ transmit_request (void *cls,
332 332
333/** 333/**
334 * Add a request to our request queue and transmit it. 334 * Add a request to our request queue and transmit it.
335 * 335 *
336 * @param rr request to queue and transmit. 336 * @param rr request to queue and transmit.
337 */ 337 */
338static void 338static void
@@ -366,12 +366,12 @@ connect_task (void *cls,
366 const struct GNUNET_SCHEDULER_TaskContext *tc) 366 const struct GNUNET_SCHEDULER_TaskContext *tc)
367{ 367{
368 struct GNUNET_VPN_Handle *vh = cls; 368 struct GNUNET_VPN_Handle *vh = cls;
369 369
370 vh->rt = GNUNET_SCHEDULER_NO_TASK; 370 vh->rt = GNUNET_SCHEDULER_NO_TASK;
371 vh->client = GNUNET_CLIENT_connect ("vpn", vh->cfg); 371 vh->client = GNUNET_CLIENT_connect ("vpn", vh->cfg);
372 GNUNET_assert (NULL != vh->client); 372 GNUNET_assert (NULL != vh->client);
373 GNUNET_assert (NULL == vh->th); 373 GNUNET_assert (NULL == vh->th);
374 if (NULL != vh->rr_head) 374 if (NULL != vh->rr_head)
375 vh->th = GNUNET_CLIENT_notify_transmit_ready (vh->client, 375 vh->th = GNUNET_CLIENT_notify_transmit_ready (vh->client,
376 sizeof (struct RedirectToServiceRequestMessage), 376 sizeof (struct RedirectToServiceRequestMessage),
377 GNUNET_TIME_UNIT_FOREVER_REL, 377 GNUNET_TIME_UNIT_FOREVER_REL,
@@ -395,7 +395,7 @@ reconnect (struct GNUNET_VPN_Handle *vh)
395 { 395 {
396 GNUNET_CLIENT_notify_transmit_ready_cancel (vh->th); 396 GNUNET_CLIENT_notify_transmit_ready_cancel (vh->th);
397 vh->th = NULL; 397 vh->th = NULL;
398 } 398 }
399 GNUNET_CLIENT_disconnect (vh->client); 399 GNUNET_CLIENT_disconnect (vh->client);
400 vh->client = NULL; 400 vh->client = NULL;
401 vh->request_id_gen = 0; 401 vh->request_id_gen = 0;
@@ -405,7 +405,7 @@ reconnect (struct GNUNET_VPN_Handle *vh)
405 GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (vh->backoff, 2), 405 GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (vh->backoff, 2),
406 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30))); 406 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)));
407 vh->rt = GNUNET_SCHEDULER_add_delayed (vh->backoff, 407 vh->rt = GNUNET_SCHEDULER_add_delayed (vh->backoff,
408 &connect_task, 408 &connect_task,
409 vh); 409 vh);
410} 410}
411 411
@@ -540,7 +540,7 @@ GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh,
540 * Connect to the VPN service 540 * Connect to the VPN service
541 * 541 *
542 * @param cfg configuration to use 542 * @param cfg configuration to use
543 * @return VPN handle 543 * @return VPN handle
544 */ 544 */
545struct GNUNET_VPN_Handle * 545struct GNUNET_VPN_Handle *
546GNUNET_VPN_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) 546GNUNET_VPN_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)