GNUnet  0.10.x
dnsstub.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2012, 2018 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19 */
25 #include "platform.h"
26 #include "gnunet_util_lib.h"
27 
31 #define DNS_RETRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250)
32 
33 
37 struct DnsServer;
38 
39 
44 {
45 
50 
55 
60 
64  void *rc_cls;
65 
70 
75 
79  struct DnsServer *ds_pos;
80 
85 
89  void *request;
90 
94  size_t request_len;
95 
96 };
97 
98 
102 struct DnsServer
103 {
104 
108  struct DnsServer *next;
109 
113  struct DnsServer *prev;
114 
118  struct sockaddr_storage ss;
119 };
120 
121 
126 {
127 
132 
137 
142 
146  struct GNUNET_TIME_Relative retry_freq;
147 
151  unsigned int num_sockets;
152 
153 };
154 
155 
161 static void
163 {
164  if (NULL != rs->dnsout4)
165  {
167  rs->dnsout4 = NULL;
168  }
169  if (NULL != rs->dnsout6)
170  {
172  rs->dnsout6 = NULL;
173  }
174  if (NULL != rs->read_task)
175  {
177  rs->read_task = NULL;
178  }
179  if (NULL != rs->retry_task)
180  {
182  rs->retry_task = NULL;
183  }
184  if (NULL != rs->request)
185  {
186  GNUNET_free (rs->request);
187  rs->request = NULL;
188  }
189 }
190 
191 
198 static struct GNUNET_NETWORK_Handle *
200 {
201  struct sockaddr_in a4;
202  struct sockaddr_in6 a6;
203  struct sockaddr *sa;
204  socklen_t alen;
205  struct GNUNET_NETWORK_Handle *ret;
206 
207  ret = GNUNET_NETWORK_socket_create (af, SOCK_DGRAM, 0);
208  if (NULL == ret)
209  return NULL;
210  switch (af)
211  {
212  case AF_INET:
213  memset (&a4, 0, alen = sizeof (struct sockaddr_in));
214  sa = (struct sockaddr *) &a4;
215  break;
216  case AF_INET6:
217  memset (&a6, 0, alen = sizeof (struct sockaddr_in6));
218  sa = (struct sockaddr *) &a6;
219  break;
220  default:
221  GNUNET_break (0);
223  return NULL;
224  }
225  sa->sa_family = af;
227  sa,
228  alen))
229  {
231  _("Could not bind to any port: %s\n"),
232  STRERROR (errno));
234  return NULL;
235  }
236  return ret;
237 }
238 
239 
247 static struct GNUNET_DNSSTUB_RequestSocket *
249 {
250  struct GNUNET_DNSSTUB_RequestSocket *rs;
251 
252  for (unsigned int i=0;i<256;i++)
253  {
255  ctx->num_sockets)];
256  if (NULL == rs->rc)
257  break;
258  }
259  if (NULL != rs->rc)
260  {
261  /* signal "failure" */
262  rs->rc (rs->rc_cls,
263  NULL,
264  0);
265  rs->rc = NULL;
266  }
267  if (NULL != rs->read_task)
268  {
270  rs->read_task = NULL;
271  }
272  if (NULL != rs->retry_task)
273  {
275  rs->retry_task = NULL;
276  }
277  if (NULL != rs->request)
278  {
279  GNUNET_free (rs->request);
280  rs->request = NULL;
281  }
282  rs->ctx = ctx;
283  return rs;
284 }
285 
286 
295 static int
297  struct GNUNET_NETWORK_Handle *dnsout)
298 {
299  struct GNUNET_DNSSTUB_Context *ctx = rs->ctx;
300  ssize_t r;
301  int len;
302 
303 #ifndef MINGW
304  if (0 != ioctl (GNUNET_NETWORK_get_fd (dnsout),
305  FIONREAD,
306  &len))
307  {
308  /* conservative choice: */
309  len = UINT16_MAX;
310  }
311 #else
312  /* port the code above? */
313  len = UINT16_MAX;
314 #endif
316  "Receiving %d byte DNS reply\n",
317  len);
318  {
319  unsigned char buf[len] GNUNET_ALIGN;
320  int found;
321  struct sockaddr_storage addr;
322  socklen_t addrlen;
323  struct GNUNET_TUN_DnsHeader *dns;
324 
325  addrlen = sizeof (addr);
326  memset (&addr,
327  0,
328  sizeof (addr));
329  r = GNUNET_NETWORK_socket_recvfrom (dnsout,
330  buf,
331  sizeof (buf),
332  (struct sockaddr*) &addr,
333  &addrlen);
334  if (-1 == r)
335  {
337  "recvfrom");
339  return GNUNET_SYSERR;
340  }
341  found = GNUNET_NO;
342  for (struct DnsServer *ds = ctx->dns_head; NULL != ds; ds = ds->next)
343  {
344  if (0 == memcmp (&addr,
345  &ds->ss,
346  GNUNET_MIN (sizeof (struct sockaddr_storage),
347  addrlen)))
348  {
349  found = GNUNET_YES;
350  break;
351  }
352  }
353  if (GNUNET_NO == found)
354  {
356  "Received DNS response from server we never asked (ignored)");
357  return GNUNET_NO;
358  }
359  if (sizeof (struct GNUNET_TUN_DnsHeader) > (size_t) r)
360  {
362  _("Received DNS response that is too small (%u bytes)"),
363  (unsigned int) r);
364  return GNUNET_NO;
365  }
366  dns = (struct GNUNET_TUN_DnsHeader *) buf;
367  if (NULL == rs->rc)
368  {
370  "Request timeout or cancelled; ignoring reply\n");
371  return GNUNET_NO;
372  }
373  rs->rc (rs->rc_cls,
374  dns,
375  r);
376  }
377  return GNUNET_OK;
378 }
379 
380 
386 static void
387 read_response (void *cls);
388 
389 
395 static void
397 {
398  struct GNUNET_NETWORK_FDSet *rset;
399 
400  if (NULL != rs->read_task)
402  rset = GNUNET_NETWORK_fdset_create ();
403  if (NULL != rs->dnsout4)
405  rs->dnsout4);
406  if (NULL != rs->dnsout6)
408  rs->dnsout6);
411  rset,
412  NULL,
413  &read_response,
414  rs);
416 }
417 
418 
424 static void
425 read_response (void *cls)
426 {
427  struct GNUNET_DNSSTUB_RequestSocket *rs = cls;
428  const struct GNUNET_SCHEDULER_TaskContext *tc;
429 
430  rs->read_task = NULL;
432  /* read and process ready sockets */
433  if ( (NULL != rs->dnsout4) &&
435  rs->dnsout4)) &&
436  (GNUNET_SYSERR ==
437  do_dns_read (rs,
438  rs->dnsout4)) )
439  rs->dnsout4 = NULL;
440  if ( (NULL != rs->dnsout6) &&
442  rs->dnsout6)) &&
443  (GNUNET_SYSERR ==
444  do_dns_read (rs,
445  rs->dnsout6)) )
446  rs->dnsout6 = NULL;
447  /* re-schedule read task */
448  schedule_read (rs);
449 }
450 
451 
458 static void
459 transmit_query (void *cls)
460 {
461  struct GNUNET_DNSSTUB_RequestSocket *rs = cls;
462  struct GNUNET_DNSSTUB_Context *ctx = rs->ctx;
463  const struct sockaddr *sa;
464  socklen_t salen;
465  struct DnsServer *ds;
466  struct GNUNET_NETWORK_Handle *dnsout;
467 
470  rs);
471  ds = rs->ds_pos;
472  rs->ds_pos = ds->next;
473  if (NULL == rs->ds_pos)
474  rs->ds_pos = ctx->dns_head;
475  GNUNET_assert (NULL != ds);
476  dnsout = NULL;
477  switch (ds->ss.ss_family)
478  {
479  case AF_INET:
480  if (NULL == rs->dnsout4)
481  rs->dnsout4 = open_socket (AF_INET);
482  dnsout = rs->dnsout4;
483  sa = (const struct sockaddr *) &ds->ss;
484  salen = sizeof (struct sockaddr_in);
485  break;
486  case AF_INET6:
487  if (NULL == rs->dnsout6)
488  rs->dnsout6 = open_socket (AF_INET6);
489  dnsout = rs->dnsout6;
490  sa = (const struct sockaddr *) &ds->ss;
491  salen = sizeof (struct sockaddr_in6);
492  break;
493  default:
494  return;
495  }
496  if (NULL == dnsout)
497  {
499  "Unable to use configure DNS server, skipping\n");
500  return;
501  }
502  if (GNUNET_SYSERR ==
504  rs->request,
505  rs->request_len,
506  sa,
507  salen))
509  _("Failed to send DNS request to %s: %s\n"),
510  GNUNET_a2s (sa,
511  salen),
512  STRERROR (errno));
513  else
515  _("Sent DNS request to %s\n"),
516  GNUNET_a2s (sa,
517  salen));
518  schedule_read (rs);
519 }
520 
521 
534  const void *request,
535  size_t request_len,
537  void *rc_cls)
538 {
539  struct GNUNET_DNSSTUB_RequestSocket *rs;
540 
541  if (NULL == ctx->dns_head)
542  {
544  "No DNS server configured for resolution\n");
545  return NULL;
546  }
547  if (NULL == (rs = get_request_socket (ctx)))
548  {
550  "No request socket available for DNS resolution\n");
551  return NULL;
552  }
553  rs->ds_pos = ctx->dns_head;
554  rs->rc = rc;
555  rs->rc_cls = rc_cls;
556  rs->request = GNUNET_memdup (request,
557  request_len);
558  rs->request_len = request_len;
560  rs);
561  return rs;
562 }
563 
564 
570 void
572 {
573  rs->rc = NULL;
574  if (NULL != rs->retry_task)
575  {
577  rs->retry_task = NULL;
578  }
579  if (NULL != rs->read_task)
580  {
582  rs->read_task = NULL;
583  }
584 }
585 
586 
594 struct GNUNET_DNSSTUB_Context *
596 {
597  struct GNUNET_DNSSTUB_Context *ctx;
598 
599  if (0 == num_sockets)
600  {
601  GNUNET_break (0);
602  return NULL;
603  }
604  ctx = GNUNET_new (struct GNUNET_DNSSTUB_Context);
605  ctx->num_sockets = num_sockets;
606  ctx->sockets = GNUNET_new_array (num_sockets,
609  return ctx;
610 }
611 
612 
621 int
623  const char *dns_ip)
624 {
625  struct DnsServer *ds;
626  struct in_addr i4;
627  struct in6_addr i6;
628 
629  ds = GNUNET_new (struct DnsServer);
630  if (1 == inet_pton (AF_INET,
631  dns_ip,
632  &i4))
633  {
634  struct sockaddr_in *s4 = (struct sockaddr_in *) &ds->ss;
635 
636  s4->sin_family = AF_INET;
637  s4->sin_port = htons (53);
638  s4->sin_addr = i4;
639 #if HAVE_SOCKADDR_IN_SIN_LEN
640  s4->sin_len = (u_char) sizeof (struct sockaddr_in);
641 #endif
642  }
643  else if (1 == inet_pton (AF_INET6,
644  dns_ip,
645  &i6))
646  {
647  struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) &ds->ss;
648 
649  s6->sin6_family = AF_INET6;
650  s6->sin6_port = htons (53);
651  s6->sin6_addr = i6;
652 #if HAVE_SOCKADDR_IN_SIN_LEN
653  s6->sin6_len = (u_char) sizeof (struct sockaddr_in6);
654 #endif
655  }
656  else
657  {
659  "Malformed IP address `%s' for DNS server\n",
660  dns_ip);
661  GNUNET_free (ds);
662  return GNUNET_SYSERR;
663  }
665  ctx->dns_tail,
666  ds);
667  return GNUNET_OK;
668 }
669 
670 
679 int
681  const struct sockaddr *sa)
682 {
683  struct DnsServer *ds;
684 
685  ds = GNUNET_new (struct DnsServer);
686  switch (sa->sa_family)
687  {
688  case AF_INET:
689  GNUNET_memcpy (&ds->ss,
690  sa,
691  sizeof (struct sockaddr_in));
692  break;
693  case AF_INET6:
694  GNUNET_memcpy (&ds->ss,
695  sa,
696  sizeof (struct sockaddr_in6));
697  break;
698  default:
699  GNUNET_break (0);
700  GNUNET_free (ds);
701  return GNUNET_SYSERR;
702  }
704  ctx->dns_tail,
705  ds);
706  return GNUNET_OK;
707 }
708 
709 
717 void
719  struct GNUNET_TIME_Relative retry_freq)
720 {
721  ctx->retry_freq = retry_freq;
722 }
723 
724 
730 void
732 {
733  struct DnsServer *ds;
734 
735  while (NULL != (ds = ctx->dns_head))
736  {
738  ctx->dns_tail,
739  ds);
740  GNUNET_free (ds);
741  }
742  for (unsigned int i=0;i<ctx->num_sockets;i++)
743  cleanup_rs (&ctx->sockets[i]);
744  GNUNET_free (ctx->sockets);
745  GNUNET_free (ctx);
746 }
747 
748 
749 /* end of dnsstub.c */
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
const struct GNUNET_SCHEDULER_TaskContext * GNUNET_SCHEDULER_get_task_context(void)
Obtain the reasoning why the current task was started.
Definition: scheduler.c:746
int GNUNET_NETWORK_get_fd(const struct GNUNET_NETWORK_Handle *desc)
Return file descriptor for this network handle.
Definition: network.c:1268
struct GNUNET_SCHEDULER_Task * read_task
Task for reading from dnsout4 and dnsout6.
Definition: dnsstub.c:69
struct DnsServer * prev
Kept in a DLL.
Definition: dnsstub.c:113
void GNUNET_DNSSTUB_set_retry(struct GNUNET_DNSSTUB_Context *ctx, struct GNUNET_TIME_Relative retry_freq)
How long should we try requests before timing out? Only effective for requests issued after this call...
Definition: dnsstub.c:718
struct GNUNET_NETWORK_Handle * dnsout6
UDP socket we use for this request for IPv6.
Definition: dnsstub.c:54
void(* GNUNET_DNSSTUB_ResultCallback)(void *cls, const struct GNUNET_TUN_DnsHeader *dns, size_t dns_len)
Function called with the result of a DNS resolution.
struct DnsServer * dns_head
DLL of DNS resolvers we use.
Definition: dnsstub.c:136
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
static void transmit_query(void *cls)
Task to (re)transmit the DNS query, possibly repeatedly until we succeed.
Definition: dnsstub.c:459
Context information passed to each scheduler task.
static char * dns_ip
IP of DNS server.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_DNSSTUB_stop(struct GNUNET_DNSSTUB_Context *ctx)
Cleanup DNSSTUB resolver.
Definition: dnsstub.c:731
#define STRERROR(i)
Definition: plibc.h:676
static struct GNUNET_SCHEDULER_TaskContext tc
Task context of the current task.
Definition: scheduler.c:417
GNUNET_DNSSTUB_ResultCallback rc
Function to call with result.
Definition: dnsstub.c:59
int GNUNET_DNSSTUB_add_dns_ip(struct GNUNET_DNSSTUB_Context *ctx, const char *dns_ip)
Add nameserver for use by the DNSSTUB.
Definition: dnsstub.c:622
int GNUNET_NETWORK_socket_bind(struct GNUNET_NETWORK_Handle *desc, const struct sockaddr *address, socklen_t address_len)
Bind a socket to a particular address.
Definition: network.c:522
#define DNS_RETRANSMIT_DELAY
Timeout for retrying DNS queries.
Definition: dnsstub.c:31
void * request
Query we sent to addr.
Definition: dnsstub.c:89
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_memdup(buf, size)
Allocate and initialize a block of memory.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
const struct GNUNET_NETWORK_FDSet * read_ready
Set of file descriptors ready for reading; note that additional bits may be set that were not in the ...
#define GNUNET_new(type)
Allocate a struct or union of the given type.
size_t request_len
Number of bytes in request.
Definition: dnsstub.c:94
static int ret
Final status code.
Definition: gnunet-arm.c:89
struct sockaddr_storage ss
IP address of the DNS resolver.
Definition: dnsstub.c:118
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_DNSSTUB_Context * ctx
Context this request executes in.
Definition: dnsstub.c:84
struct DnsServer * next
Kept in a DLL.
Definition: dnsstub.c:108
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
void GNUNET_NETWORK_fdset_destroy(struct GNUNET_NETWORK_FDSet *fds)
Releases the associated memory of an fd set.
Definition: network.c:1554
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level &#39;level&#39; that indicates a failure of the command &#39;cmd&#39; with the mess...
static void read_response(void *cls)
Read a DNS response from the (unhindered) UDP-Socket.
Definition: dnsstub.c:425
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1246
struct GNUNET_NETWORK_FDSet * GNUNET_NETWORK_fdset_create(void)
Creates an fd set.
Definition: network.c:1538
unsigned int num_sockets
Length of sockets array.
Definition: dnsstub.c:151
#define GNUNET_memcpy(dst, src, n)
struct DnsServer * ds_pos
Next address we sent the DNS request to.
Definition: dnsstub.c:79
struct GNUNET_DNSSTUB_Context * GNUNET_DNSSTUB_start(unsigned int num_sockets)
Start a DNS stub resolver.
Definition: dnsstub.c:595
static struct GNUNET_NETWORK_Handle * open_socket(int af)
Open source port for sending DNS requests.
Definition: dnsstub.c:199
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
DNS Server used for resolution.
Definition: dnsstub.c:102
#define GNUNET_MIN(a, b)
Definition: gnunet_common.h:83
struct DnsServer * dns_tail
DLL of DNS resolvers we use.
Definition: dnsstub.c:141
ssize_t GNUNET_NETWORK_socket_sendto(const struct GNUNET_NETWORK_Handle *desc, const void *message, size_t length, const struct sockaddr *dest_addr, socklen_t dest_len)
Send data to a particular destination (always non-blocking).
Definition: network.c:968
Randomness for IVs etc.
collection of IO descriptors
static char buf[2048]
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_select(enum GNUNET_SCHEDULER_Priority prio, struct GNUNET_TIME_Relative delay, const struct GNUNET_NETWORK_FDSet *rs, const struct GNUNET_NETWORK_FDSet *ws, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when any of the specified file descriptor set...
Definition: scheduler.c:1829
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
const char * GNUNET_a2s(const struct sockaddr *addr, socklen_t addrlen)
Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string (for printing debug messages)...
struct GNUNET_DNSSTUB_RequestSocket * sockets
Array of all open sockets for DNS requests.
Definition: dnsstub.c:131
static struct GNUNET_DNSSTUB_RequestSocket * get_request_socket(struct GNUNET_DNSSTUB_Context *ctx)
Get a socket of the specified address family to send out a UDP DNS request to the Internet...
Definition: dnsstub.c:248
static int do_dns_read(struct GNUNET_DNSSTUB_RequestSocket *rs, struct GNUNET_NETWORK_Handle *dnsout)
Actually do the reading of a DNS packet from our UDP socket and see if we have a valid, matching, pending request.
Definition: dnsstub.c:296
Handle to the stub resolver.
Definition: dnsstub.c:125
void * rc_cls
Closure for rc.
Definition: dnsstub.c:64
struct GNUNET_DNSSTUB_RequestSocket * GNUNET_DNSSTUB_resolve(struct GNUNET_DNSSTUB_Context *ctx, const void *request, size_t request_len, GNUNET_DNSSTUB_ResultCallback rc, void *rc_cls)
Perform DNS resolution using our default IP from init.
Definition: dnsstub.c:533
static void schedule_read(struct GNUNET_DNSSTUB_RequestSocket *rs)
Schedule read_response() task for rs.
Definition: dnsstub.c:396
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
void GNUNET_NETWORK_fdset_set(struct GNUNET_NETWORK_FDSet *fds, const struct GNUNET_NETWORK_Handle *desc)
Add a socket to the FD set.
Definition: network.c:1163
struct GNUNET_NETWORK_Handle * dnsout4
UDP socket we use for this request for IPv4.
Definition: dnsstub.c:49
#define GNUNET_ALIGN
gcc-ism to force alignment; we use this to align char-arrays that may then be cast to &#39;struct&#39;s...
void GNUNET_DNSSTUB_resolve_cancel(struct GNUNET_DNSSTUB_RequestSocket *rs)
Cancel DNS resolution.
Definition: dnsstub.c:571
static int inet_pton(int af, const char *cp, struct in_addr *buf)
Convert IPv4 address from text to binary form.
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Definition: scheduler.c:134
struct GNUNET_SCHEDULER_Task * retry_task
Task for retrying transmission of the query.
Definition: dnsstub.c:74
handle to a socket
Definition: network.c:46
int af
Address family / domain.
Definition: network.c:57
struct GNUNET_TIME_Relative retry_freq
How frequently do we retry requests?
Definition: dnsstub.c:146
#define GNUNET_YES
Definition: gnunet_common.h:80
static struct GNUNET_FS_DirScanner * ds
Handle to the directory scanner (for recursive insertions).
static void cleanup_rs(struct GNUNET_DNSSTUB_RequestSocket *rs)
We&#39;re done with a struct GNUNET_DNSSTUB_RequestSocket, close it for now.
Definition: dnsstub.c:162
Run with the default priority (normal P2P operations).
UDP socket we are using for sending DNS requests to the Internet.
Definition: dnsstub.c:43
int GNUNET_NETWORK_fdset_isset(const struct GNUNET_NETWORK_FDSet *fds, const struct GNUNET_NETWORK_Handle *desc)
Check whether a socket is part of the fd set.
Definition: network.c:1181
ssize_t GNUNET_NETWORK_socket_recvfrom(const struct GNUNET_NETWORK_Handle *desc, void *buffer, size_t length, struct sockaddr *src_addr, socklen_t *addrlen)
Read data from a socket (always non-blocking).
Definition: network.c:856
int GNUNET_DNSSTUB_add_dns_sa(struct GNUNET_DNSSTUB_Context *ctx, const struct sockaddr *sa)
Add nameserver for use by the DNSSTUB.
Definition: dnsstub.c:680
int GNUNET_NETWORK_socket_close(struct GNUNET_NETWORK_Handle *desc)
Close a socket.
Definition: network.c:604
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
struct GNUNET_NETWORK_Handle * GNUNET_NETWORK_socket_create(int domain, int type, int protocol)
Create a new socket.
Definition: network.c:1037
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965