GNUnet 0.21.1
nat_api.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2007-2017 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 */
20
29#include "platform.h"
30#include "gnunet_nat_service.h"
31#include "nat.h"
32#include "nat_stun.h"
33
34
39{
43 struct AddrEntry *next;
44
48 struct AddrEntry *prev;
49
54 void *app_ctx;
55
60
64 socklen_t addrlen;
65};
66
67
72{
77
82
87
92
97
102
107
112
117
122};
123
124
130static void
131do_connect (void *cls);
132
133
139static void
141{
142 struct AddrEntry *ae;
143
144 if (NULL != nh->mq)
145 {
147 nh->mq = NULL;
148 }
149 while (NULL != (ae = nh->ae_head))
150 {
153 &ae->app_ctx,
154 GNUNET_NO,
155 ae->ac,
156 (const struct sockaddr *) &ae[1],
157 ae->addrlen);
158 GNUNET_free (ae);
159 }
163}
164
165
173static int
175 void *cls,
177{
178 if (ntohs (crm->header.size) != sizeof(*crm) + sizeof(struct sockaddr_in))
179 {
180 GNUNET_break (0);
181 return GNUNET_SYSERR;
182 }
183 return GNUNET_OK;
184}
185
186
193static void
195 void *cls,
197{
198 struct GNUNET_NAT_Handle *nh = cls;
199
201 (const struct sockaddr *) &crm[1],
202 sizeof(struct sockaddr_in));
203}
204
205
213static int
215 void *cls,
217{
218 size_t alen = ntohs (acn->header.size) - sizeof(*acn);
219
220 switch (alen)
221 {
222 case sizeof(struct sockaddr_in): {
223 const struct sockaddr_in *s4 = (const struct sockaddr_in *) &acn[1];
224 if (AF_INET != s4->sin_family)
225 {
226 GNUNET_break (0);
227 return GNUNET_SYSERR;
228 }
229 }
230 break;
231
232 case sizeof(struct sockaddr_in6): {
233 const struct sockaddr_in6 *s6 = (const struct sockaddr_in6 *) &acn[1];
234 if (AF_INET6 != s6->sin6_family)
235 {
236 GNUNET_break (0);
237 return GNUNET_SYSERR;
238 }
239 }
240 break;
241
242 default:
243 GNUNET_break (0);
244 return GNUNET_SYSERR;
245 }
246 return GNUNET_OK;
247}
248
249
256static void
258 void *cls,
260{
261 struct GNUNET_NAT_Handle *nh = cls;
262 size_t alen = ntohs (acn->header.size) - sizeof(*acn);
263 const struct sockaddr *sa = (const struct sockaddr *) &acn[1];
265 struct AddrEntry *ae;
266
268 "Received address change notification\n");
269 ac = (enum GNUNET_NAT_AddressClass) ntohl (acn->addr_class);
270 if (GNUNET_YES == ntohl (acn->add_remove))
271 {
272 ae = GNUNET_malloc (sizeof(*ae) + alen);
273 ae->ac = ac;
274 ae->addrlen = alen;
275 GNUNET_memcpy (&ae[1], sa, alen);
278 &ae->app_ctx,
279 ntohl (acn->add_remove),
280 ac,
281 sa,
282 alen);
283 }
284 else
285 {
286 for (ae = nh->ae_head; NULL != ae; ae = ae->next)
287 if ((ae->addrlen == alen) && (0 == memcmp (&ae[1], sa, alen)))
288 break;
289 if (NULL == ae)
290 {
291 GNUNET_break (0);
292 reconnect (nh);
293 return;
294 }
297 &ae->app_ctx,
298 ntohl (acn->add_remove),
299 ac,
300 sa,
301 alen);
302 GNUNET_free (ae);
303 }
304}
305
306
313static void
315 enum GNUNET_MQ_Error error)
316{
317 struct GNUNET_NAT_Handle *nh = cls;
318
319 reconnect (nh);
320}
321
322
328static void
329do_connect (void *cls)
330{
331 struct GNUNET_NAT_Handle *nh = cls;
334 connection_reversal_request,
337 nh),
339 address_change_notification,
342 nh),
344 };
345 struct GNUNET_MQ_Envelope *env;
346
347 nh->reconnect_task = NULL;
348 nh->mq =
350 "nat",
351 handlers,
353 nh);
354 if (NULL == nh->mq)
355 {
356 reconnect (nh);
357 return;
358 }
361 env);
362}
363
364
365struct GNUNET_NAT_Handle *
367 const char *config_section,
368 uint8_t proto,
369 unsigned int num_addrs,
370 const struct sockaddr **addrs,
371 const socklen_t *addrlens,
374 void *callback_cls)
375{
376 struct GNUNET_NAT_Handle *nh;
378 size_t len;
379 size_t str_len;
380 char *off;
381
382 len = 0;
383 for (unsigned int i = 0; i < num_addrs; i++)
384 len += addrlens[i];
385 str_len = strlen (config_section) + 1;
386 len += str_len;
387 if ( (len > GNUNET_MAX_MESSAGE_SIZE - sizeof(*rm)) ||
388 (num_addrs > UINT16_MAX) ||
389 (str_len > UINT16_MAX) )
390 {
391 GNUNET_break (0);
392 return NULL;
393 }
394 rm = GNUNET_malloc (sizeof(*rm) + len);
395 rm->header.size = htons (sizeof(*rm) + len);
398 if (NULL != address_callback)
400 if (NULL != reversal_callback)
402 rm->proto = proto;
403 rm->str_len = htons (str_len);
404 rm->num_addrs = htons ((uint16_t) num_addrs);
405 off = (char *) &rm[1];
406 for (unsigned int i = 0; i < num_addrs; i++)
407 {
408 switch (addrs[i]->sa_family)
409 {
410 case AF_INET:
411 if (sizeof(struct sockaddr_in) != addrlens[i])
412 {
413 GNUNET_break (0);
414 GNUNET_free (rm);
415 return NULL;
416 }
417 break;
418
419 case AF_INET6:
420 if (sizeof(struct sockaddr_in6) != addrlens[i])
421 {
422 GNUNET_break (0);
423 GNUNET_free (rm);
424 return NULL;
425 }
426 break;
427
428#if AF_UNIX
429 case AF_UNIX:
430 if (sizeof(struct sockaddr_un) != addrlens[i])
431 {
432 GNUNET_break (0);
433 GNUNET_free (rm);
434 return NULL;
435 }
436 break;
437#endif
438 default:
439 GNUNET_break (0);
440 GNUNET_free (rm);
441 return NULL;
442 }
443 GNUNET_memcpy (off, addrs[i], addrlens[i]);
444 off += addrlens[i];
445 }
446 GNUNET_memcpy (off, config_section, str_len);
447
449 nh->reg = &rm->header;
450 nh->cfg = cfg;
451 nh->address_callback = address_callback;
453 nh->callback_cls = callback_cls;
454 do_connect (nh);
455 return nh;
456}
457
458
466static char *
468{
469 const char *colon;
470 char *colon_rest;
471 size_t colon_rest_length;
472 char *address_without_port;
473
474 colon = strchr (address,':');
475 colon_rest = GNUNET_strndup (address, colon - address);
476 colon_rest_length = strlen (colon_rest);
477 address_without_port = GNUNET_strndup (&colon_rest[4], colon_rest_length - 4);
478 GNUNET_free (colon_rest);
479
480 return address_without_port;
481}
482
483void
485 char *addr,
486 unsigned int address_length)
487{
489 struct GNUNET_MQ_Envelope *env;
490 //char *address_without_port = get_address_without_port (addr);
491 //unsigned int address_len_without_port = strlen (address_without_port);
492 char *off;
493
495 "natting address %s length %u\n",
496 addr,
497 address_length);
498
500 address_length,
502 aam->address_length = htons (address_length);
503 off = (char *) &aam[1];
504 GNUNET_memcpy (off, addr, address_length);
506 env);
507 //GNUNET_free (address_without_port);
508}
509
510
511
521test_stun_packet (const void *data, size_t len)
522{
523 const struct stun_header *hdr;
524 const struct stun_attr *attr;
525 uint32_t advertised_message_size;
526 uint32_t message_magic_cookie;
527
528 /* On entry, 'len' is the length of the UDP payload. After the
529 * initial checks it becomes the size of unprocessed options,
530 * while 'data' is advanced accordingly.
531 */
532 if (len < sizeof(struct stun_header))
533 {
535 "STUN packet too short (only %d, wanting at least %d)\n",
536 (int) len,
537 (int) sizeof(struct stun_header));
538 return GNUNET_NO;
539 }
540 hdr = (const struct stun_header *) data;
541 /* Skip header as it is already in hdr */
542 len -= sizeof(struct stun_header);
543 data += sizeof(struct stun_header);
544
545 /* len as advertised in the message */
546 advertised_message_size = ntohs (hdr->msglen);
547
548 message_magic_cookie = ntohl (hdr->magic);
549 /* Compare if the cookie match */
550 if (STUN_MAGIC_COOKIE != message_magic_cookie)
551 {
552 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Invalid magic cookie for STUN\n");
553 return GNUNET_NO;
554 }
555
556 if (advertised_message_size > len)
557 {
559 "Scrambled STUN packet length (got %d, expecting %d)\n",
560 advertised_message_size,
561 (int) len);
562 return GNUNET_NO;
563 }
564 len = advertised_message_size;
565 while (len > 0)
566 {
567 if (len < sizeof(struct stun_attr))
568 {
570 "Attribute too short in STUN packet (got %d, expecting %d)\n",
571 (int) len,
572 (int) sizeof(struct stun_attr));
573 return GNUNET_NO;
574 }
575 attr = (const struct stun_attr *) data;
576
577 /* compute total attribute length */
578 advertised_message_size = ntohs (attr->len) + sizeof(struct stun_attr);
579
580 /* Check if we still have space in our buffer */
581 if (advertised_message_size > len)
582 {
583 GNUNET_log (
585 "Inconsistent Attribute (length %d exceeds remaining msg len %d)\n",
586 advertised_message_size,
587 (int) len);
588 return GNUNET_NO;
589 }
590 data += advertised_message_size;
591 len -= advertised_message_size;
592 }
594 "STUN Packet, msg %04x, length: %d\n",
595 ntohs (hdr->msgtype),
596 advertised_message_size);
597 return GNUNET_OK;
598}
599
600
624int
626 const struct sockaddr *sender_addr,
627 size_t sender_addr_len,
628 const void *data,
629 size_t data_size)
630{
631 struct GNUNET_MQ_Envelope *env;
633 char *buf;
634
636 return GNUNET_NO;
637 if (NULL == nh->mq)
638 return GNUNET_SYSERR;
640 data_size + sender_addr_len,
642 hsn->sender_addr_size = htons ((uint16_t) sender_addr_len);
643 hsn->payload_size = htons ((uint16_t) data_size);
644 buf = (char *) &hsn[1];
645 GNUNET_memcpy (buf, sender_addr, sender_addr_len);
646 buf += sender_addr_len;
649 return GNUNET_OK;
650}
651
652
666int
668 const void *addr,
669 socklen_t addrlen)
670{
671 struct AddrEntry *ae;
672
673 if ((addrlen != sizeof(struct sockaddr_in)) &&
674 (addrlen != sizeof(struct sockaddr_in6)))
675 {
676 GNUNET_break (0);
677 return GNUNET_SYSERR;
678 }
679 for (ae = nh->ae_head; NULL != ae; ae = ae->next)
680 if ((addrlen == ae->addrlen) && (0 == memcmp (addr, &ae[1], addrlen)))
681 return GNUNET_YES;
682 return GNUNET_NO;
683}
684
685
698int
700 const struct sockaddr_in *local_sa,
701 const struct sockaddr_in *remote_sa)
702{
703 struct GNUNET_MQ_Envelope *env;
705 char *buf;
706
707 if (NULL == nh->mq)
708 return GNUNET_SYSERR;
709 GNUNET_break (AF_INET == local_sa->sin_family);
710 GNUNET_break (AF_INET == remote_sa->sin_family);
711 env =
713 2 * sizeof(struct sockaddr_in),
715 req->local_addr_size = htons (sizeof(struct sockaddr_in));
716 req->remote_addr_size = htons (sizeof(struct sockaddr_in));
717 buf = (char *) &req[1];
718 GNUNET_memcpy (buf, local_sa, sizeof(struct sockaddr_in));
719 buf += sizeof(struct sockaddr_in);
720 GNUNET_memcpy (buf, remote_sa, sizeof(struct sockaddr_in));
722 return GNUNET_OK;
723}
724
725
726void
728{
729 struct AddrEntry *ae;
730 struct AddrEntry *next;
731
732 if (NULL != nh->mq)
733 {
735 nh->mq = NULL;
736 }
737 if (NULL != nh->reconnect_task)
738 {
740 nh->reconnect_task = NULL;
741 }
742 next = nh->ae_head;
743 while (NULL != next)
744 {
745 ae = next;
746 next = next->next;
748 GNUNET_free (ae);
749 }
750 GNUNET_free (nh->reg);
751 GNUNET_free (nh);
752}
753
754
755/* end of nat_api.c */
struct GNUNET_MQ_MessageHandlers handlers[]
Definition: 003.c:1
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:109
static char * address
GNS address for this phone.
static char * data
The data to insert into the dht.
static size_t data_size
Number of bytes in data.
static uint8_t proto
Protocol to use.
static void reversal_callback(void *cls, const struct sockaddr_in *ra)
We got a connection reversal request from another peer.
struct GNUNET_NAT_Handle * nh
Handle for connect to the NAT service.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1057
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strndup(a, length)
Wrapper around GNUNET_xstrndup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_MQ_Envelope * GNUNET_MQ_msg_copy(const struct GNUNET_MessageHeader *hdr)
Create a new envelope by copying an existing message.
Definition: mq.c:533
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:304
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:63
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:683
int GNUNET_NAT_request_reversal(struct GNUNET_NAT_Handle *nh, const struct sockaddr_in *local_sa, const struct sockaddr_in *remote_sa)
We learned about a peer (possibly behind NAT) so run the gnunet-nat-client to send dummy ICMP respons...
Definition: nat_api.c:699
void(* GNUNET_NAT_ReversalCallback)(void *cls, const struct sockaddr *remote_addr, socklen_t remote_addrlen)
Signature of the callback passed to GNUNET_NAT_register().
struct GNUNET_NAT_Handle * GNUNET_NAT_register(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *config_section, uint8_t proto, unsigned int num_addrs, const struct sockaddr **addrs, const socklen_t *addrlens, GNUNET_NAT_AddressCallback address_callback, GNUNET_NAT_ReversalCallback reversal_callback, void *callback_cls)
Attempt to enable port redirection and detect public IP address contacting UPnP or NAT-PMP routers on...
Definition: nat_api.c:366
void GNUNET_NAT_unregister(struct GNUNET_NAT_Handle *nh)
Stop port redirection and public IP address detection for the given handle.
Definition: nat_api.c:727
void GNUNET_NAT_add_global_address(struct GNUNET_NAT_Handle *nh, char *addr, unsigned int address_length)
Add global address to the list of addresses and notify clients.
Definition: nat_api.c:484
void(* GNUNET_NAT_AddressCallback)(void *cls, void **app_ctx, int add_remove, enum GNUNET_NAT_AddressClass ac, const struct sockaddr *addr, socklen_t addrlen)
Signature of the callback passed to GNUNET_NAT_register() for a function to call whenever our set of ...
int GNUNET_NAT_stun_handle_packet(struct GNUNET_NAT_Handle *nh, const struct sockaddr *sender_addr, size_t sender_addr_len, const void *data, size_t data_size)
Handle an incoming STUN message.
Definition: nat_api.c:625
GNUNET_NAT_AddressClass
Some addresses contain sensitive information or are not suitable for global distribution.
int GNUNET_NAT_test_address(struct GNUNET_NAT_Handle *nh, const void *addr, socklen_t addrlen)
Test if the given address is (currently) a plausible IP address for this peer.
Definition: nat_api.c:667
#define GNUNET_MESSAGE_TYPE_NAT_ADD_GLOBAL_ADDRESS
Message to ask NAT service to notify all clients about a new global address.
#define GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE
Message to from NAT service notifying us that one of our addresses changed.
#define GNUNET_MESSAGE_TYPE_NAT_CONNECTION_REVERSAL_REQUESTED
Message to from NAT service notifying us that connection reversal was requested by another peer.
#define GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL
Message to ask NAT service to request connection reversal.
#define GNUNET_MESSAGE_TYPE_NAT_REGISTER
Message to ask NAT service to register a client.
#define GNUNET_MESSAGE_TYPE_NAT_HANDLE_STUN
Message to ask NAT service to handle a STUN packet.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:981
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:1278
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
@ GNUNET_NAT_RF_ADDRESSES
This client wants to be informed about changes to our applicable addresses.
Definition: nat.h:82
@ GNUNET_NAT_RF_NONE
This client does not want any notifications.
Definition: nat.h:76
@ GNUNET_NAT_RF_REVERSAL
This client supports address reversal.
Definition: nat.h:87
static int check_connection_reversal_request(void *cls, const struct GNUNET_NAT_ConnectionReversalRequestedMessage *crm)
Check connection reversal request.
Definition: nat_api.c:174
static enum GNUNET_GenericReturnValue test_stun_packet(const void *data, size_t len)
Check if an incoming message is a STUN message.
Definition: nat_api.c:521
static void handle_address_change_notification(void *cls, const struct GNUNET_NAT_AddressChangeNotificationMessage *acn)
Handle connection reversal request.
Definition: nat_api.c:257
static void do_connect(void *cls)
Task to connect to the NAT service.
Definition: nat_api.c:329
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Handle queue errors by reconnecting to NAT.
Definition: nat_api.c:314
static void reconnect(struct GNUNET_NAT_Handle *nh)
Task to connect to the NAT service.
Definition: nat_api.c:140
static int check_address_change_notification(void *cls, const struct GNUNET_NAT_AddressChangeNotificationMessage *acn)
Check address change notification.
Definition: nat_api.c:214
static void handle_connection_reversal_request(void *cls, const struct GNUNET_NAT_ConnectionReversalRequestedMessage *crm)
Handle connection reversal request.
Definition: nat_api.c:194
static char * get_address_without_port(const char *address)
Get the IP address without the port number.
Definition: nat_api.c:467
Message types for STUN server resolution.
#define STUN_MAGIC_COOKIE
Definition: nat_stun.h:34
Entry in DLL of addresses of this peer.
Definition: nat_api.c:39
struct AddrEntry * next
DLL.
Definition: nat_api.c:43
struct AddrEntry * prev
DLL.
Definition: nat_api.c:48
enum GNUNET_NAT_AddressClass ac
Address class of the address.
Definition: nat_api.c:59
void * app_ctx
Place where the application can store data (on add, and retrieve on remove).
Definition: nat_api.c:54
socklen_t addrlen
Number of bytes that follow.
Definition: nat_api.c:64
Handle to a message queue.
Definition: mq.c:87
Message handler for a specific message type.
Header for all communications.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
Message sent by client to add a global address.
Definition: nat.h:225
unsigned int address_length
Length of the address following the struct, in NBO.
Definition: nat.h:234
Service notifying the client about changes in the set of addresses it has.
Definition: nat.h:202
int32_t add_remove
GNUNET_YES to add, GNUNET_NO to remove the address from the list.
Definition: nat.h:211
struct GNUNET_MessageHeader header
Header with type GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE.
Definition: nat.h:206
uint32_t addr_class
Type of the address, an enum GNUNET_NAT_AddressClass in NBO.
Definition: nat.h:216
Service telling a client that connection reversal was requested.
Definition: nat.h:187
struct GNUNET_MessageHeader header
Header with type GNUNET_MESSAGE_TYPE_NAT_CONNECTION_REVERSAL_REQUESTED.
Definition: nat.h:191
Client telling the service to (possibly) handle a STUN message.
Definition: nat.h:135
uint16_t payload_size
Number of bytes of payload included, in NBO.
Definition: nat.h:149
uint16_t sender_addr_size
Size of the sender address included, in NBO.
Definition: nat.h:144
Handle for active NAT registrations.
Definition: nat_api.c:72
struct GNUNET_TIME_Relative reconnect_delay
How long to wait until we reconnect.
Definition: nat_api.c:121
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.
Definition: nat_api.c:76
void * callback_cls
Closure for the various callbacks.
Definition: nat_api.c:111
struct AddrEntry * ae_head
Head of address DLL.
Definition: nat_api.c:91
struct GNUNET_MQ_Handle * mq
Message queue for communicating with the NAT service.
Definition: nat_api.c:81
struct GNUNET_SCHEDULER_Task * reconnect_task
Task scheduled to reconnect to the service.
Definition: nat_api.c:116
struct GNUNET_MessageHeader * reg
Our registration message.
Definition: nat_api.c:86
struct AddrEntry * ae_tail
Tail of address DLL.
Definition: nat_api.c:96
GNUNET_NAT_ReversalCallback reversal_callback
Function to call when another peer requests connection reversal.
Definition: nat_api.c:106
GNUNET_NAT_AddressCallback address_callback
Function to call when our addresses change.
Definition: nat_api.c:101
Message sent by a client to register with its addresses.
Definition: nat.h:95
uint16_t num_addrs
Number of addresses that this service is bound to that follow.
Definition: nat.h:122
uint16_t str_len
Number of bytes in the string that follow which specifies a section name in the configuration.
Definition: nat.h:115
struct GNUNET_MessageHeader header
Header with type GNUNET_MESSAGE_TYPE_NAT_REGISTER.
Definition: nat.h:99
uint8_t flags
An enum GNUNET_NAT_RegisterFlags.
Definition: nat.h:104
uint8_t proto
Client's IPPROTO, e.g.
Definition: nat.h:109
Client asking the service to initiate connection reversal.
Definition: nat.h:161
uint16_t local_addr_size
Size of the local address included, in NBO.
Definition: nat.h:170
uint16_t remote_addr_size
Size of the remote address included, in NBO.
Definition: nat.h:175
Entry in list of pending tasks.
Definition: scheduler.c:136
Time for relative time used by GNUnet, in microseconds.
uint16_t len
Definition: nat_stun.h:54
uint16_t attr
Definition: nat_stun.h:53
uint16_t msglen
Definition: nat_stun.h:45
uint16_t msgtype
Definition: nat_stun.h:44
uint32_t magic
Definition: nat_stun.h:46