aboutsummaryrefslogtreecommitdiff
path: root/src/dns/dns_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dns/dns_api.c')
-rw-r--r--src/dns/dns_api.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/dns/dns_api.c b/src/dns/dns_api.c
index f48457a01..9a8e1ca2d 100644
--- a/src/dns/dns_api.c
+++ b/src/dns/dns_api.c
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file dns/dns_api.c 22 * @file dns/dns_api.c
23 * @brief API to access the DNS service. 23 * @brief API to access the DNS service.
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
@@ -100,7 +100,7 @@ struct GNUNET_DNS_Handle
100 * Function to call to get replies. 100 * Function to call to get replies.
101 */ 101 */
102 GNUNET_DNS_RequestHandler rh; 102 GNUNET_DNS_RequestHandler rh;
103 103
104 /** 104 /**
105 * Closure for 'rh'. 105 * Closure for 'rh'.
106 */ 106 */
@@ -125,7 +125,7 @@ struct GNUNET_DNS_Handle
125 * Re-connect counter, to make sure we did not reconnect in the meantime. 125 * Re-connect counter, to make sure we did not reconnect in the meantime.
126 */ 126 */
127 uint32_t generation; 127 uint32_t generation;
128 128
129 /** 129 /**
130 * Flags for events we care about. 130 * Flags for events we care about.
131 */ 131 */
@@ -253,7 +253,7 @@ request_handler (void *cls,
253 req = (const struct GNUNET_DNS_Request *) msg; 253 req = (const struct GNUNET_DNS_Request *) msg;
254 GNUNET_break (ntohl (req->reserved) == 0); 254 GNUNET_break (ntohl (req->reserved) == 0);
255 payload_length = ntohs (req->header.size) - sizeof (struct GNUNET_DNS_Request); 255 payload_length = ntohs (req->header.size) - sizeof (struct GNUNET_DNS_Request);
256 GNUNET_CLIENT_receive (dh->dns_connection, 256 GNUNET_CLIENT_receive (dh->dns_connection,
257 &request_handler, dh, 257 &request_handler, dh,
258 GNUNET_TIME_UNIT_FOREVER_REL); 258 GNUNET_TIME_UNIT_FOREVER_REL);
259 259
@@ -261,7 +261,7 @@ request_handler (void *cls,
261 rh = GNUNET_malloc (sizeof (struct GNUNET_DNS_RequestHandle)); 261 rh = GNUNET_malloc (sizeof (struct GNUNET_DNS_RequestHandle));
262 rh->dh =dh; 262 rh->dh =dh;
263 rh->request_id = req->request_id; 263 rh->request_id = req->request_id;
264 rh->generation = dh->generation; 264 rh->generation = dh->generation;
265 dh->pending_requests++; 265 dh->pending_requests++;
266 dh->rh (dh->rh_cls, 266 dh->rh (dh->rh_cls,
267 rh, 267 rh,
@@ -285,7 +285,7 @@ send_response (void *cls, size_t size, void *buf)
285 struct GNUNET_DNS_Handle *dh = cls; 285 struct GNUNET_DNS_Handle *dh = cls;
286 struct ReplyQueueEntry *qe; 286 struct ReplyQueueEntry *qe;
287 size_t len; 287 size_t len;
288 288
289 dh->dns_transmit_handle = NULL; 289 dh->dns_transmit_handle = NULL;
290 if (NULL == buf) 290 if (NULL == buf)
291 { 291 {
@@ -300,12 +300,12 @@ send_response (void *cls, size_t size, void *buf)
300 return 0; 300 return 0;
301 len = ntohs (qe->msg->size); 301 len = ntohs (qe->msg->size);
302 if (len > size) 302 if (len > size)
303 { 303 {
304 dh->dns_transmit_handle = 304 dh->dns_transmit_handle =
305 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection, 305 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection,
306 len, 306 len,
307 GNUNET_TIME_UNIT_FOREVER_REL, 307 GNUNET_TIME_UNIT_FOREVER_REL,
308 GNUNET_NO, 308 GNUNET_NO,
309 &send_response, dh); 309 &send_response, dh);
310 return 0; 310 return 0;
311 } 311 }
@@ -317,7 +317,7 @@ send_response (void *cls, size_t size, void *buf)
317 if (GNUNET_NO == dh->in_receive) 317 if (GNUNET_NO == dh->in_receive)
318 { 318 {
319 dh->in_receive = GNUNET_YES; 319 dh->in_receive = GNUNET_YES;
320 GNUNET_CLIENT_receive (dh->dns_connection, 320 GNUNET_CLIENT_receive (dh->dns_connection,
321 &request_handler, dh, 321 &request_handler, dh,
322 GNUNET_TIME_UNIT_FOREVER_REL); 322 GNUNET_TIME_UNIT_FOREVER_REL);
323 } 323 }
@@ -327,11 +327,11 @@ send_response (void *cls, size_t size, void *buf)
327 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection, 327 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection,
328 ntohs (qe->msg->size), 328 ntohs (qe->msg->size),
329 GNUNET_TIME_UNIT_FOREVER_REL, 329 GNUNET_TIME_UNIT_FOREVER_REL,
330 GNUNET_NO, 330 GNUNET_NO,
331 &send_response, dh); 331 &send_response, dh);
332 } 332 }
333 return len; 333 return len;
334} 334}
335 335
336 336
337/** 337/**
@@ -344,7 +344,7 @@ static void
344queue_reply (struct GNUNET_DNS_Handle *dh, 344queue_reply (struct GNUNET_DNS_Handle *dh,
345 struct ReplyQueueEntry *qe) 345 struct ReplyQueueEntry *qe)
346{ 346{
347 if (NULL == dh->dns_connection) 347 if (NULL == dh->dns_connection)
348 { 348 {
349 GNUNET_free (qe); 349 GNUNET_free (qe);
350 return; 350 return;
@@ -354,12 +354,12 @@ queue_reply (struct GNUNET_DNS_Handle *dh,
354 qe); 354 qe);
355 if (NULL != dh->dns_transmit_handle) 355 if (NULL != dh->dns_transmit_handle)
356 return; 356 return;
357 /* trigger sending */ 357 /* trigger sending */
358 dh->dns_transmit_handle = 358 dh->dns_transmit_handle =
359 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection, 359 GNUNET_CLIENT_notify_transmit_ready (dh->dns_connection,
360 ntohs (dh->rq_head->msg->size), 360 ntohs (dh->rq_head->msg->size),
361 GNUNET_TIME_UNIT_FOREVER_REL, 361 GNUNET_TIME_UNIT_FOREVER_REL,
362 GNUNET_NO, 362 GNUNET_NO,
363 &send_response, dh); 363 &send_response, dh);
364} 364}
365 365
@@ -440,7 +440,7 @@ GNUNET_DNS_request_drop (struct GNUNET_DNS_RequestHandle *rh)
440 * @param reply reply data 440 * @param reply reply data
441 */ 441 */
442void 442void
443GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, 443GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh,
444 uint16_t reply_length, 444 uint16_t reply_length,
445 const char *reply) 445 const char *reply)
446{ 446{
@@ -480,7 +480,7 @@ GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh,
480 * @param flags when to call rh 480 * @param flags when to call rh
481 * @param rh function to call with DNS requests 481 * @param rh function to call with DNS requests
482 * @param rh_cls closure to pass to rh 482 * @param rh_cls closure to pass to rh
483 * @return DNS handle 483 * @return DNS handle
484 */ 484 */
485struct GNUNET_DNS_Handle * 485struct GNUNET_DNS_Handle *
486GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 486GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -489,7 +489,7 @@ GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
489 void *rh_cls) 489 void *rh_cls)
490{ 490{
491 struct GNUNET_DNS_Handle *dh; 491 struct GNUNET_DNS_Handle *dh;
492 492
493 dh = GNUNET_malloc (sizeof (struct GNUNET_DNS_Handle)); 493 dh = GNUNET_malloc (sizeof (struct GNUNET_DNS_Handle));
494 dh->cfg = cfg; 494 dh->cfg = cfg;
495 dh->flags = flags; 495 dh->flags = flags;