43 #define LOG(kind, ...) GNUNET_log_from (kind, "transport-udp", __VA_ARGS__)
48 #define UDP_SESSION_TIME_OUT \
49 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
59 #define UDP_MAX_MESSAGES_IN_DEFRAG 3
68 #define UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG 128
649 return session->
scope;
666 struct sockaddr_in a4;
667 struct sockaddr_in6 a6;
673 addrlen =
address->address_length;
678 memset (&a6, 0,
sizeof(a6));
679 #if HAVE_SOCKADDR_IN_SIN_LEN
680 a6.sin6_len =
sizeof(a6);
682 a6.sin6_family = AF_INET6;
692 memset (&a4, 0,
sizeof(a4));
693 #if HAVE_SOCKADDR_IN_SIN_LEN
694 a4.sin_len =
sizeof(a4);
696 a4.sin_family = AF_INET;
765 if (NULL != min_udpw)
770 "Calculated flow delay for UDPv4 at %s for %s\n",
778 "Calculated flow delay for UDPv4 at %s for %s\n",
821 if (NULL != min_udpw)
826 "Calculated flow delay for UDPv6 at %s for %s\n",
834 "Calculated flow delay for UDPv6 at %s for %s\n",
866 static char rbuf[INET6_ADDRSTRLEN + 10];
867 char buf[INET6_ADDRSTRLEN];
888 port = ntohs (
t6->u6_port);
897 port = ntohs (
t4->u4_port);
898 a4.s_addr =
t4->ipv4_addr;
906 inet_ntop (af, sb,
buf, INET6_ADDRSTRLEN);
909 (af == AF_INET6) ?
"%s.%u.[%s]:%u" :
"%s.%u.%s:%u",
936 struct sockaddr_storage socket_address;
947 if ((NULL == addr) || (0 == addrlen))
952 if (
'\0' != addr[addrlen - 1])
957 if (strlen (addr) != addrlen - 1)
963 optionstr = strchr (
plugin,
'.');
964 if (NULL == optionstr)
973 address = strchr (optionstr,
'.');
992 switch (socket_address.ss_family)
996 const struct sockaddr_in *in4 =
997 (
const struct sockaddr_in *) &socket_address;
1010 const struct sockaddr_in6 *in6 =
1011 (
const struct sockaddr_in6 *) &socket_address;
1098 const struct sockaddr *sb;
1100 struct sockaddr_in a4;
1101 struct sockaddr_in6 a6;
1110 memset (&a6, 0,
sizeof(a6));
1111 a6.sin6_family = AF_INET6;
1112 #if HAVE_SOCKADDR_IN_SIN_LEN
1113 a6.sin6_len =
sizeof(a6);
1119 sb = (
const struct sockaddr *) &a6;
1125 memset (&a4, 0,
sizeof(a4));
1126 a4.sin_family = AF_INET;
1127 #if HAVE_SOCKADDR_IN_SIN_LEN
1128 a4.sin_len =
sizeof(a4);
1134 sb = (
const struct sockaddr *) &a4;
1207 struct sockaddr_in s4;
1212 memset (&s4, 0,
sizeof(s4));
1213 s4.sin_family = AF_INET;
1214 #if HAVE_SOCKADDR_IN_SIN_LEN
1215 s4.sin_len =
sizeof(s4);
1217 s4.sin_port = v4->u4_port;
1218 s4.sin_addr.s_addr = v4->ipv4_addr;
1226 struct sockaddr_in6 s6;
1229 if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr))
1231 memset (&s6, 0,
sizeof(s6));
1232 s6.sin6_family = AF_INET6;
1233 #if HAVE_SOCKADDR_IN_SIN_LEN
1234 s6.sin6_len =
sizeof(s6);
1236 s6.sin6_port = v6->u6_port;
1237 s6.sin6_addr = v6->ipv6_addr;
1241 sizeof(
struct sockaddr_in6)))
1270 const struct sockaddr *addr,
1282 (
GNUNET_YES == add_remove) ?
"NAT notification to add address `%s'\n"
1283 :
"NAT notification to remove address `%s'\n",
1286 switch (addr->sa_family)
1289 const struct sockaddr_in *i4;
1292 i4 = (
const struct sockaddr_in *) addr;
1293 if (0 == ntohs (i4->sin_port))
1295 memset (&u4, 0,
sizeof(u4));
1305 const struct sockaddr_in6 *i6;
1308 i6 = (
const struct sockaddr_in6 *) addr;
1309 if (0 == ntohs (i6->sin6_port))
1311 memset (&u6, 0,
sizeof(u6));
1435 "Looking for existing session for peer `%s' with address `%s'\n",
1444 if (NULL == cctx.
res)
1520 "# UDP, total bytes in send buffers",
1526 "# UDP, total messages in send buffers",
1578 "# UDP, total bytes in send buffers",
1584 "# UDP, total messages in send buffers",
1637 "%p: Fragmented message removed with result %s\n",
1649 "Fragmented message acknowledged after %s (expected at %s)\n",
1656 "Fragmented message acknowledged after %s (expected at %s)\n",
1661 if (NULL != frag_ctx->
cont)
1668 "# UDP, fragmented messages active",
1675 "# UDP, fragmented msgs, messages, sent, success",
1679 "# UDP, fragmented msgs, bytes payload, sent, success",
1684 "# UDP, fragmented msgs, bytes overhead, sent, success",
1688 "# UDP, total, bytes overhead, sent",
1692 "# UDP, total, bytes payload, sent",
1699 "# UDP, fragmented msgs, messages, sent, failure",
1703 "# UDP, fragmented msgs, bytes payload, sent, failure",
1707 "# UDP, fragmented msgs, bytes payload, sent, failure",
1711 "# UDP, fragmented msgs, bytes payload, sent, failure",
1721 while (NULL != udpw)
1735 while (NULL != udpw)
1772 "Fragment of message with %u bytes transmitted to %s\n",
1777 "# UDP, fragmented msgs, fragments, sent, success",
1782 "# UDP, fragmented msgs, fragments bytes, sent, success",
1789 "Failed to transmit fragment of message with %u bytes to %s\n",
1794 "# UDP, fragmented msgs, fragments, sent, failure",
1799 "# UDP, fragmented msgs, fragments bytes, sent, failure",
1822 size_t msg_len = ntohs (
msg->
size);
1825 (
unsigned long) msg_len);
1828 udpw->
msg_buf = (
char *) &udpw[1];
1869 if (NULL != udpw->
cont)
1875 "Message sent via UDP with delay of %s\n",
1881 "Message sent via UDP with delay of %s\n",
1893 "# UDP, unfragmented msgs, messages, sent, success",
1898 "# UDP, unfragmented msgs, bytes payload, sent, success",
1903 "# UDP, unfragmented msgs, bytes overhead, sent, success",
1907 "# UDP, total, bytes overhead, sent",
1911 "# UDP, total, bytes payload, sent",
1918 "# UDP, unfragmented msgs, messages, sent, failure",
1923 "# UDP, unfragmented msgs, bytes payload, sent, failure",
1928 "# UDP, unfragmented msgs, bytes overhead, sent, failure",
1967 unsigned int priority,
1973 size_t udpmlen = msgbuf_size +
sizeof(
struct UDPMessage);
2000 "UDP transmits %lu-byte message to `%s' using address `%s'\n",
2001 (
unsigned long) udpmlen,
2008 udp->header.size = htons (udpmlen);
2010 udp->reserved = htonl (0);
2025 udpw->
msg_buf = (
char *) &udpw[1];
2045 "# UDP, unfragmented messages queued total",
2049 "# UDP, unfragmented bytes payload queued total",
2066 frag_ctx->
cont = cont;
2090 "Enqueued fragments will take %s for transmission to %s (queue size: %u)\n",
2096 "Enqueued fragments will take %s for transmission to %s (queue size: %u)\n",
2102 "# UDP, fragmented messages active",
2106 "# UDP, fragmented messages, total",
2110 "# UDP, fragmented bytes (payload)",
2196 "Session %p to peer `%s' at address %s ended\n",
2235 while (NULL != (udpw = next))
2246 while (NULL != (udpw = next))
2261 "Calling continuation for fragemented message to `%s' with result SYSERR\n",
2272 "# UDP sessions active",
2326 "UDP session of address %s for ACK not found\n",
2336 "Fragmentation context of address %s for ACK (%s) not found\n",
2347 if (UINT32_MAX == ntohl (udp_ack->
delay))
2351 "Asked to disconnect UDP session of %s\n",
2359 "We received a sending delay of %s for %s\n",
2364 "We received a sending delay of %s for %s\n",
2375 "UDP processes %u-byte acknowledgement from `%s' at `%s'\n",
2376 (
unsigned int) ntohs (
msg->
size),
2385 "Message from %s at %s full ACK'ed\n",
2450 "Disconnecting from peer `%s'\n",
2482 "Session %p was idle for %s, disconnecting\n",
2524 s->
scope = network_type;
2527 "Creating new session %p for peer `%s' address `%s'\n",
2539 "# UDP sessions active",
2581 struct sockaddr_in v4;
2584 memset (&v4,
'\0',
sizeof(v4));
2585 v4.sin_family = AF_INET;
2586 #if HAVE_SOCKADDR_IN_SIN_LEN
2587 v4.sin_len =
sizeof(
struct sockaddr_in);
2589 v4.sin_port = udp_v4->u4_port;
2590 v4.sin_addr.s_addr = udp_v4->ipv4_addr;
2592 (
const struct sockaddr *) &v4,
2597 struct sockaddr_in6 v6;
2600 memset (&v6,
'\0',
sizeof(v6));
2601 v6.sin6_family = AF_INET6;
2602 #if HAVE_SOCKADDR_IN_SIN_LEN
2603 v6.sin6_len =
sizeof(
struct sockaddr_in6);
2605 v6.sin6_port = udp_v6->u6_port;
2606 v6.sin6_addr = udp_v6->ipv6_addr;
2608 (
const struct sockaddr *) &v6,
2629 size_t udp_addr_len,
2636 if (0 != ntohl (
msg->reserved))
2641 if (ntohs (
msg->header.
size) <
2663 (
const char *) &
msg[1],
2723 "# UDP, ACK messages sent",
2730 "# UDP, ACK transmissions failed",
2761 "# UDP, fragments discarded without ACK",
2776 "Trying to transmit ACK to peer `%s' but no session found!\n",
2782 "# UDP, ACK transmissions failed",
2793 delay = UINT32_MAX - 1;
2795 "Sending ACK to `%s' including delay of %s\n",
2805 udpw->
msg_buf = (
char *) &udpw[1];
2809 udp_ack->
header.
size = htons ((uint16_t) msize);
2836 size_t udp_addr_len,
2875 "Created new defragmentation context for %u-byte fragment from `%s'\n",
2876 (
unsigned int) ntohs (
msg->
size),
2882 "Found existing defragmentation context for %u-byte fragment from `%s'\n",
2883 (
unsigned int) ntohs (
msg->
size),
2903 "# UDP, Defragmentations aborted",
2920 struct sockaddr_storage addr;
2926 const struct sockaddr *sa;
2927 const struct sockaddr_in *sa4;
2928 const struct sockaddr_in6 *sa6;
2930 size_t int_addr_len;
2933 fromlen =
sizeof(addr);
2934 memset (&addr, 0,
sizeof(addr));
2938 (
struct sockaddr *) &addr,
2940 sa = (
const struct sockaddr *) &addr;
2945 "UDP failed to receive data: %s\n",
2954 (
const struct sockaddr *) &addr,
2963 "UDP got %u bytes from %s, which is not enough for a GNUnet message header\n",
2964 (
unsigned int)
size,
2974 "UDP received %u-byte message from `%s' type %u\n",
2975 (
unsigned int)
size,
2981 "UDP malformed message (size %u) header from %s\n",
2982 (
unsigned int)
size,
2988 "# UDP, total bytes received",
2992 switch (sa->sa_family)
2995 sa4 = (
const struct sockaddr_in *) &addr;
3000 int_addr_len =
sizeof(
v4);
3004 sa6 = (
const struct sockaddr_in6 *) &addr;
3009 int_addr_len =
sizeof(
v6);
3078 while (NULL != udpw)
3105 "# messages discarded due to timeout",
3117 "Message for peer `%s' (%lu bytes) is not delayed \n",
3126 "Message for peer `%s' (%lu bytes) is delayed for %s\n",
3153 const struct sockaddr *sa,
3161 ((ENETUNREACH == errno) || (ENETDOWN == errno)))
3163 if (slen ==
sizeof(
struct sockaddr_in))
3170 _ (
"UDP could not transmit message to `%s': "
3171 "Network seems down, please check your network configuration\n"),
3174 if (slen ==
sizeof(
struct sockaddr_in6))
3183 "UDP could not transmit IPv6 message! "
3184 "Please check your network configuration and disable IPv6 if your "
3185 "connection does not have a global IPv6 address\n"));
3191 "UDP could not transmit message to `%s': `%s'\n",
3210 const struct sockaddr *a;
3212 struct sockaddr_in a4;
3214 struct sockaddr_in6 a6;
3224 memset (&a4, 0,
sizeof(a4));
3225 a4.sin_family = AF_INET;
3226 #if HAVE_SOCKADDR_IN_SIN_LEN
3227 a4.sin_len =
sizeof(a4);
3231 a = (
const struct sockaddr *) &a4;
3238 memset (&a6, 0,
sizeof(a6));
3239 a6.sin6_family = AF_INET6;
3240 #if HAVE_SOCKADDR_IN_SIN_LEN
3241 a6.sin6_len =
sizeof(a6);
3245 a = (
const struct sockaddr *) &a6;
3274 "# UDP, total, bytes, sent, failure",
3278 "# UDP, total, messages, sent, failure",
3286 "UDP transmitted %u-byte message to `%s' `%s' (%d: %s)\n",
3291 (sent < 0) ? strerror (errno) :
"ok");
3293 "# UDP, total, bytes, sent, success",
3297 "# UDP, total, messages, sent, success",
3377 const struct sockaddr_in6 *
bind_v6,
3378 const struct sockaddr_in *
bind_v4)
3381 unsigned int sockets_created = 0;
3382 struct sockaddr_in6 server_addrv6;
3383 struct sockaddr_in server_addrv4;
3384 const struct sockaddr *server_addr;
3385 const struct sockaddr *addrs[2];
3386 socklen_t addrlens[2];
3398 _ (
"Disabling IPv6 since it is not supported on this system!\n"));
3403 memset (&server_addrv6, 0,
sizeof(
struct sockaddr_in6));
3404 #if HAVE_SOCKADDR_IN_SIN_LEN
3405 server_addrv6.sin6_len =
sizeof(
struct sockaddr_in6);
3407 server_addrv6.sin6_family = AF_INET6;
3409 server_addrv6.sin6_addr =
bind_v6->sin6_addr;
3411 server_addrv6.sin6_addr = in6addr_any;
3414 server_addrv6.sin6_port = htons (
3418 server_addrv6.sin6_port = htons (
plugin->
port);
3419 addrlen =
sizeof(
struct sockaddr_in6);
3420 server_addr = (
const struct sockaddr *) &server_addrv6;
3426 "Binding to IPv6 `%s'\n",
3439 server_addrv6.sin6_port = htons (
3452 plugin->
port = ntohs (server_addrv6.sin6_port);
3457 "IPv6 UDP socket created listinging at %s\n",
3459 addrs[sockets_created] = server_addr;
3460 addrlens[sockets_created] = addrlen;
3466 _ (
"Failed to bind UDP socket to %s: %s\n"),
3480 _ (
"Disabling IPv4 since it is not supported on this system!\n"));
3485 memset (&server_addrv4, 0,
sizeof(
struct sockaddr_in));
3486 #if HAVE_SOCKADDR_IN_SIN_LEN
3487 server_addrv4.sin_len =
sizeof(
struct sockaddr_in);
3489 server_addrv4.sin_family = AF_INET;
3491 server_addrv4.sin_addr =
bind_v4->sin_addr;
3493 server_addrv4.sin_addr.s_addr = INADDR_ANY;
3497 server_addrv4.sin_port = htons (
3500 server_addrv4.sin_port = htons (
plugin->
port);
3502 addrlen =
sizeof(
struct sockaddr_in);
3503 server_addr = (
const struct sockaddr *) &server_addrv4;
3509 "Binding to IPv4 `%s'\n",
3524 server_addrv4.sin_port = htons (
3536 plugin->
port = ntohs (server_addrv4.sin_port);
3542 "IPv4 socket created on port %s\n",
3544 addrs[sockets_created] = server_addr;
3545 addrlens[sockets_created] = addrlen;
3551 _ (
"Failed to bind UDP socket to %s: %s\n"),
3557 if (0 == sockets_created)
3573 return sockets_created;
3590 unsigned long long port;
3591 unsigned long long aport;
3592 unsigned long long udp_max_bps;
3595 int enable_broadcasting_recv;
3599 struct sockaddr_in server_addrv4;
3600 struct sockaddr_in6 server_addrv6;
3605 if (NULL ==
env->receive)
3629 _ (
"must be in [0,65535]"));
3642 _ (
"must be in [0,65535]"));
3653 memset (&server_addrv4, 0,
sizeof(server_addrv4));
3660 "Binding UDP plugin to specific address: `%s'\n",
3662 if (1 != inet_pton (AF_INET, bind4_address, &server_addrv4.sin_addr))
3667 _ (
"must be valid IPv4 address"));
3675 memset (&server_addrv6, 0,
sizeof(server_addrv6));
3682 "Binding udp plugin to specific address: `%s'\n",
3684 if (1 != inet_pton (AF_INET6, bind6_address, &server_addrv6.sin6_addr))
3689 _ (
"must be valid IPv6 address"));
3703 enable_broadcasting_recv =
3706 "BROADCAST_RECEIVE");
3713 "BROADCAST_INTERVAL",
3724 udp_max_bps = 1024 * 1024 * 50;
3731 p->enable_ipv6 = enable_v6;
3733 p->enable_broadcasting = enable_broadcasting;
3734 p->enable_broadcasting_receiving = enable_broadcasting_recv;
3743 (uint32_t) udp_max_bps),
3746 (
GNUNET_YES == have_bind6) ? &server_addrv6 : NULL,
3747 (
GNUNET_YES == have_bind4) ? &server_addrv4 : NULL);
3748 if ((0 ==
res) || ((NULL ==
p->sockv4) && (NULL ==
p->sockv6)))
struct GNUNET_GETOPT_CommandLineOption options[]
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static int ret
Return value of the commandline.
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
static struct Experiment * e
static uint16_t port
Port number.
struct Plugin * plugin
The process handle to the testbed service.
static char * address
GNS address for this phone.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_SCHEDULER_Task * t4
Task for IPv4 socket.
static struct GNUNET_SCHEDULER_Task * t6
Task for IPv6 socket.
static struct GNUNET_FS_DownloadContext * dc
static struct GNUNET_NETWORK_Handle * bind_v6()
Create an IPv6 listen socket bound to our port.
static struct GNUNET_NETWORK_Handle * bind_v4()
Create an IPv4 listen socket bound to our port.
static char * value
Value of the record to add/remove.
static struct GNUNET_MQ_Envelope * ac
Handle to current GNUNET_PEERINFO_add_peer() operation.
enum State state
current state of profiling
static int result
Global testing status.
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
static char * hostname
Our hostname; we give this to all the peers we start.
static int numeric
Option -n.
static struct GNUNET_OS_Process * p
Helper process we started.
static int udp
Option -u: UDP requested.
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_log(kind,...)
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_ALIGN
gcc-ism to force alignment; we use this to align char-arrays that may then be cast to 'struct's.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_PACKED
gcc-ism to get packed structs.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
struct GNUNET_BANDWIDTH_Value32NBO GNUNET_BANDWIDTH_value_init(uint32_t bytes_per_second)
Create a new bandwidth value.
void GNUNET_BANDWIDTH_tracker_init(struct GNUNET_BANDWIDTH_Tracker *av, GNUNET_BANDWIDTH_TrackerUpdateCallback update_cb, void *update_cb_cls, struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit, uint32_t max_carry_s)
Initialize bandwidth tracker.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
#define GNUNET_CONSTANTS_LATENCY_WARN
After what amount of latency for a message do we print a warning?
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
@ GNUNET_CRYPTO_QUALITY_STRONG
High-quality operations are desired.
#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.
const char * GNUNET_FRAGMENT_print_ack(const struct GNUNET_MessageHeader *ack)
Convert an ACK message to a printable format suitable for logging.
int GNUNET_DEFRAGMENT_process_fragment(struct GNUNET_DEFRAGMENT_Context *dc, const struct GNUNET_MessageHeader *msg)
We have received a fragment.
void GNUNET_FRAGMENT_context_transmission_done(struct GNUNET_FRAGMENT_Context *fc)
Continuation to call from the 'proc' function after the fragment has been transmitted (and hence the ...
int GNUNET_FRAGMENT_process_ack(struct GNUNET_FRAGMENT_Context *fc, const struct GNUNET_MessageHeader *msg)
Process an acknowledgement message we got from the other side (to control re-transmits).
void GNUNET_DEFRAGMENT_context_destroy(struct GNUNET_DEFRAGMENT_Context *dc)
Destroy the given defragmentation context.
struct GNUNET_DEFRAGMENT_Context * GNUNET_DEFRAGMENT_context_create(struct GNUNET_STATISTICS_Handle *stats, uint16_t mtu, unsigned int num_msgs, void *cls, GNUNET_FRAGMENT_MessageProcessor proc, GNUNET_DEFRAGMENT_AckProcessor ackp)
Create a defragmentation context.
void GNUNET_FRAGMENT_context_destroy(struct GNUNET_FRAGMENT_Context *fc, struct GNUNET_TIME_Relative *msg_delay, struct GNUNET_TIME_Relative *ack_delay)
Destroy the given fragmentation context (stop calling 'proc', free resources).
struct GNUNET_FRAGMENT_Context * GNUNET_FRAGMENT_context_create(struct GNUNET_STATISTICS_Handle *stats, uint16_t mtu, struct GNUNET_BANDWIDTH_Tracker *tracker, struct GNUNET_TIME_Relative msg_delay, struct GNUNET_TIME_Relative ack_delay, const struct GNUNET_MessageHeader *msg, GNUNET_FRAGMENT_MessageProcessor proc, void *proc_cls)
Create a fragmentation context for the given message.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multipeermap_contains_value(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Check if the map contains the given value under the given key.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
int GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
int GNUNET_CONTAINER_multipeermap_get_multiple(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map that match a particular key.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
void * GNUNET_CONTAINER_heap_remove_root(struct GNUNET_CONTAINER_Heap *heap)
Remove root of the heap.
void * GNUNET_CONTAINER_heap_remove_node(struct GNUNET_CONTAINER_HeapNode *node)
Removes a node from the heap.
void GNUNET_CONTAINER_heap_update_cost(struct GNUNET_CONTAINER_HeapNode *node, GNUNET_CONTAINER_HeapCostType new_cost)
Updates the cost of any node in the tree.
struct GNUNET_CONTAINER_HeapNode * GNUNET_CONTAINER_heap_insert(struct GNUNET_CONTAINER_Heap *heap, void *element, GNUNET_CONTAINER_HeapCostType cost)
Inserts a new element into the heap.
unsigned int GNUNET_CONTAINER_heap_get_size(const struct GNUNET_CONTAINER_Heap *heap)
Get the current size of the heap.
void GNUNET_CONTAINER_heap_iterate(const struct GNUNET_CONTAINER_Heap *heap, GNUNET_CONTAINER_HeapIterator iterator, void *iterator_cls)
Iterate over all entries in the heap.
uint64_t GNUNET_CONTAINER_HeapCostType
Cost by which elements in a heap can be ordered.
struct GNUNET_CONTAINER_Heap * GNUNET_CONTAINER_heap_create(enum GNUNET_CONTAINER_HeapOrder order)
Create a new heap.
void GNUNET_CONTAINER_heap_destroy(struct GNUNET_CONTAINER_Heap *heap)
Destroys the heap.
@ GNUNET_CONTAINER_HEAP_ORDER_MIN
Heap with the minimum cost at the root.
struct GNUNET_HELLO_Address * GNUNET_HELLO_address_allocate(const struct GNUNET_PeerIdentity *peer, const char *transport_name, const void *address, size_t address_length, enum GNUNET_HELLO_AddressInfo local_info)
Allocate an address struct.
#define GNUNET_HELLO_address_free(addr)
Free an address.
struct GNUNET_HELLO_Address * GNUNET_HELLO_address_copy(const struct GNUNET_HELLO_Address *address)
Copy an address struct.
int GNUNET_HELLO_address_cmp(const struct GNUNET_HELLO_Address *a1, const struct GNUNET_HELLO_Address *a2)
Compare two addresses.
@ GNUNET_HELLO_ADDRESS_INFO_NONE
No additional information.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
void GNUNET_log_config_invalid(enum GNUNET_ErrorType kind, const char *section, const char *option, const char *required)
Log error message about invalid configuration option value.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
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).
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.
#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.
void GNUNET_NAT_unregister(struct GNUNET_NAT_Handle *nh)
Stop port redirection and public IP address detection for the given handle.
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.
GNUNET_NAT_AddressClass
Some addresses contain sensitive information or are not suitable for global distribution.
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...
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.
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_close(struct GNUNET_NETWORK_Handle *desc)
Close a socket.
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).
struct GNUNET_NETWORK_Handle * GNUNET_NETWORK_socket_create(int domain, int type, int protocol)
Create a new socket.
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_bind(struct GNUNET_NETWORK_Handle *desc, const struct sockaddr *address, socklen_t address_len)
Bind a socket to a particular address.
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).
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.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
@ GNUNET_NT_WAN
Wide area network (i.e.
@ GNUNET_NT_UNSPECIFIED
Category of last resort.
@ GNUNET_NT_LAN
Local area network.
#define GNUNET_MESSAGE_TYPE_FRAGMENT
FRAGMENT of a larger message.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON
Message send by a peer to notify the other to keep the session alive.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK
UDP ACK.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_MESSAGE
Normal UDP message type.
void GNUNET_RESOLVER_request_cancel(struct GNUNET_RESOLVER_RequestHandle *rh)
Cancel a request that is still pending with the resolver.
struct GNUNET_RESOLVER_RequestHandle * GNUNET_RESOLVER_hostname_get(const struct sockaddr *sa, socklen_t salen, int do_resolve, struct GNUNET_TIME_Relative timeout, GNUNET_RESOLVER_HostnameCallback callback, void *cls)
Perform a reverse DNS lookup.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_net(struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when the specified file descriptor is ready f...
const struct GNUNET_SCHEDULER_TaskContext * GNUNET_SCHEDULER_get_task_context(void)
Obtain the reasoning why the current task was started.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
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.
@ GNUNET_SCHEDULER_REASON_READ_READY
The reading socket is ready.
void GNUNET_MST_destroy(struct GNUNET_MessageStreamTokenizer *mst)
Destroys a tokenizer.
struct GNUNET_MessageStreamTokenizer * GNUNET_MST_create(GNUNET_MessageTokenizerCallback cb, void *cb_cls)
Create a message stream tokenizer.
int GNUNET_MST_from_buffer(struct GNUNET_MessageStreamTokenizer *mst, const char *buf, size_t size, int purge, int one_shot)
Add incoming data to the receive buffer and call the callback for all complete messages.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_to_address_ip(const char *addr, uint16_t addrlen, struct sockaddr_storage *r_buf)
Tries to convert addr string to an IP (v4 or v6) address.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
#define GNUNET_TIME_UNIT_SECONDS
One second.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_max(struct GNUNET_TIME_Absolute t1, struct GNUNET_TIME_Absolute t2)
Return the maximum of two absolute time values.
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration)
Add a given relative duration to the given start time.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_divide(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Divide relative time by a given factor.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
void(* GNUNET_TRANSPORT_SessionInfoCallback)(void *cls, struct GNUNET_ATS_Session *session, const struct GNUNET_TRANSPORT_SessionInfo *info)
Function called by the plugin with information about the current sessions managed by the plugin (for ...
void(* GNUNET_TRANSPORT_TransmitContinuation)(void *cls, const struct GNUNET_PeerIdentity *target, int result, size_t size_payload, size_t size_on_wire)
Function called by the GNUNET_TRANSPORT_TransmitFunction upon "completion".
void(* GNUNET_TRANSPORT_AddressStringCallback)(void *cls, const char *address, int res)
Function called by the pretty printer for the resolved address for each human-readable address obtain...
GNUNET_TRANSPORT_SessionState
Possible states of a session in a plugin.
@ GNUNET_TRANSPORT_SS_INIT
The session was created (first call for each session object).
@ GNUNET_TRANSPORT_SS_DONE
Session is being torn down and about to disappear.
@ GNUNET_TRANSPORT_SS_UP
Session is fully UP.
@ GNUNET_TRANSPORT_SS_UPDATE
This is just an update about the session, the state did not change.
static unsigned int size
Size of the "table".
static int udp_plugin_check_address(void *cls, const void *addr, size_t addrlen)
Function that will be called to check if a binary address for this plugin is well-formed and correspo...
static void fragmented_message_done(struct UDP_FragmentationContext *frag_ctx, int result)
We have completed our (attempt) to transmit a message that had to be fragmented – either because we g...
static void fragment_msg_proc(void *cls, const struct GNUNET_MessageHeader *msg)
Process a defragmented message.
#define UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG
We keep a defragmentation queue per sender address.
static void udp_nat_port_map_callback(void *cls, void **app_ctx, int add_remove, enum GNUNET_NAT_AddressClass ac, const struct sockaddr *addr, socklen_t addrlen)
Our external IP address/port mapping has changed.
static void udp_select_read(struct Plugin *plugin, struct GNUNET_NETWORK_Handle *rsock)
Read and process a message from the given socket.
void(* QueueContinuation)(void *cls, struct UDP_MessageWrapper *udpw, int result)
Function called when a message is removed from the transmission queue.
static void read_process_ack(struct Plugin *plugin, const struct GNUNET_MessageHeader *msg, const union UdpAddress *udp_addr, socklen_t udp_addr_len)
Handle a GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK message.
static void analyze_send_error(struct Plugin *plugin, const struct sockaddr *sa, socklen_t slen, int error)
We failed to transmit a message via UDP.
static void udp_plugin_update_session_timeout(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session)
Function that will be called whenever the transport service wants to notify the plugin that a session...
static void session_timeout(void *cls)
Session was idle, so disconnect it.
static void qc_fragment_sent(void *cls, struct UDP_MessageWrapper *udpw, int result)
We are finished with a fragment in the message queue.
static int udp_disconnect_session(void *cls, struct GNUNET_ATS_Session *s)
Functions with this signature are called whenever we need to close a session due to a disconnect or f...
static ssize_t udp_plugin_send(void *cls, struct GNUNET_ATS_Session *s, const char *msgbuf, size_t msgbuf_size, unsigned int priority, struct GNUNET_TIME_Relative to, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
Function that can be used by the transport service to transmit a message using the plugin.
const char * udp_address_to_string(void *cls, const void *addr, size_t addrlen)
Function called for a quick conversion of the binary address to a numeric address.
static void enqueue(struct Plugin *plugin, struct UDP_MessageWrapper *udpw)
Enqueue a message for transmission and update statistics.
static void read_process_fragment(struct Plugin *plugin, const struct GNUNET_MessageHeader *msg, const union UdpAddress *udp_addr, size_t udp_addr_len, enum GNUNET_NetworkType network_type)
We received a fragment, process it.
static enum GNUNET_NetworkType udp_plugin_get_network(void *cls, struct GNUNET_ATS_Session *session)
Function obtain the network type for a session.
static struct GNUNET_ATS_Session * udp_plugin_get_session(void *cls, const struct GNUNET_HELLO_Address *address)
Creates a new outbound session the transport service will use to send data to the peer.
static void ack_message_sent(void *cls, struct UDP_MessageWrapper *udpw, int result)
We finished sending an acknowledgement.
static void reschedule_session_timeout(struct GNUNET_ATS_Session *s)
Increment session timeout due to activity.
static int udp_string_to_address(void *cls, const char *addr, uint16_t addrlen, void **buf, size_t *added)
Function called to convert a string address to a binary address.
static void udp_plugin_select_v4(void *cls)
We have been notified that our readset has something to read.
static void udp_disconnect(void *cls, const struct GNUNET_PeerIdentity *target)
Disconnect from a remote node.
static void udp_plugin_select_v6(void *cls)
We have been notified that our readset has something to read.
static void free_session(struct GNUNET_ATS_Session *s)
Function to free last resources associated with a session.
static void append_port(void *cls, const char *hostname)
Append our port and forward the result.
static int check_port(const struct Plugin *plugin, uint16_t in_port)
Check if the given port is plausible (must be either our listen port or our advertised port).
static struct GNUNET_ATS_Session * udp_plugin_create_session(void *cls, const struct GNUNET_HELLO_Address *address, enum GNUNET_NetworkType network_type)
Allocate a new session for the given endpoint address.
static int heap_cleanup_iterator(void *cls, struct GNUNET_CONTAINER_HeapNode *node, void *element, GNUNET_CONTAINER_HeapCostType cost)
Function called on each entry in the defragmentation heap to clean it up.
static enum GNUNET_NetworkType udp_plugin_get_network_for_address(void *cls, const struct GNUNET_HELLO_Address *address)
Function obtain the network type for an address.
static int disconnect_and_free_it(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Destroy a session, plugin is being unloaded.
static struct UDP_MessageWrapper * remove_timeout_messages_and_select(struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock)
Removes messages from the transmission queue that have timed out, and then selects a message that sho...
static void qc_message_sent(void *cls, struct UDP_MessageWrapper *udpw, int result)
We are finished with a message from the message queue.
void * libgnunet_plugin_transport_udp_done(void *cls)
The exported method.
static unsigned int udp_query_keepalive_factor(void *cls)
Function that is called to get the keepalive factor.
static struct GNUNET_ATS_Session * udp_plugin_lookup_session(void *cls, const struct GNUNET_HELLO_Address *address)
Locate an existing session the transport service is using to send data to another peer.
static void process_udp_message(struct Plugin *plugin, const struct UDPMessage *msg, const union UdpAddress *udp_addr, size_t udp_addr_len, enum GNUNET_NetworkType network_type)
We've received a UDP Message.
static unsigned int setup_sockets(struct Plugin *plugin, const struct sockaddr_in6 *bind_v6, const struct sockaddr_in *bind_v4)
Setup the UDP sockets (for IPv4 and IPv6) for the plugin.
static void udp_plugin_address_pretty_printer(void *cls, const char *type, const void *addr, size_t addrlen, int numeric, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls)
Convert the transports address to a nice, human-readable format.
static void udp_select_send(struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock)
It is time to try to transmit a UDP message.
static void dequeue(struct Plugin *plugin, struct UDP_MessageWrapper *udpw)
Remove the given message from the transmission queue and update all applicable statistics.
static int process_inbound_tokenized_messages(void *cls, const struct GNUNET_MessageHeader *hdr)
Message tokenizer has broken up an incoming message.
static void schedule_select_v6(struct Plugin *plugin)
(re)schedule IPv6-select tasks for this plugin.
static int session_cmp_it(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Find a session with a matching address.
static int send_session_info_iter(void *cls, const struct GNUNET_PeerIdentity *peer, void *value)
Return information about the given session to the monitor callback.
static void enqueue_fragment(void *cls, const struct GNUNET_MessageHeader *msg)
Function that is called with messages created by the fragmentation module.
void * libgnunet_plugin_transport_udp_init(void *cls)
The exported method.
static void udp_plugin_setup_monitor(void *cls, GNUNET_TRANSPORT_SessionInfoCallback sic, void *sic_cls)
Begin monitoring sessions of a plugin.
#define UDP_SESSION_TIME_OUT
After how much inactivity should a UDP session time out?
static void ack_proc(void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg)
Transmit an acknowledgement.
static GNUNET_NETWORK_STRUCT_END void notify_session_monitor(struct Plugin *plugin, struct GNUNET_ATS_Session *session, enum GNUNET_TRANSPORT_SessionState state)
If a session monitor is attached, notify it about the new session state.
#define UDP_MAX_MESSAGES_IN_DEFRAG
Number of messages we can defragment in parallel.
static void schedule_select_v4(struct Plugin *plugin)
(re)schedule IPv4-select tasks for this plugin.
static int find_receive_context(void *cls, struct GNUNET_CONTAINER_HeapNode *node, void *element, GNUNET_CONTAINER_HeapCostType cost)
Scan the heap for a receive context with the given address.
Implementation of the UDP transport protocol.
void stop_broadcast(struct Plugin *plugin)
Stop broadcasting subsystem.
void setup_broadcast(struct Plugin *plugin, struct sockaddr_in6 *server_addrv6, struct sockaddr_in *server_addrv4)
Setup broadcasting subsystem.
#define UDP_MTU
MTU for fragmentation subsystem.
void udp_broadcast_receive(struct Plugin *plugin, const char *buf, ssize_t size, const union UdpAddress *udp_addr, size_t udp_addr_len, enum GNUNET_NetworkType network_type)
We received a broadcast message.
static struct GNUNET_SCHEDULER_TaskContext tc
Task context of the current task.
static struct GNUNET_TIME_Relative interval
Data structure to track defragmentation contexts based on the source of the UDP traffic.
struct GNUNET_DEFRAGMENT_Context * defrag
Defragmentation context.
enum GNUNET_NetworkType network_type
Network type the address belongs to.
struct GNUNET_PeerIdentity sender
Who's message(s) are we defragmenting here? Only initialized once we succeeded and have_sender is set...
int have_sender
Has the sender field been initialized yet?
const union UdpAddress * udp_addr
Source address this receive context is for (allocated at the end of the struct).
struct GNUNET_CONTAINER_HeapNode * hnode
Node in the defrag heap.
struct Plugin * plugin
Reference to master plugin struct.
size_t udp_addr_len
Length of udp_addr.
Closure for find_receive_context().
struct DefragContext * rc
Where to store the result.
size_t udp_addr_len
Number of bytes in udp_addr.
const union UdpAddress * udp_addr
Address to find.
struct GNUNET_ATS_Session * session
Session associated with this context.
Closure for session_cmp_it().
const struct GNUNET_HELLO_Address * address
Address we are looking for.
struct GNUNET_ATS_Session * res
Set to session matching the address.
Session handle for connections.
struct GNUNET_PeerIdentity target
To whom are we talking to.
struct Plugin * plugin
Pointer to the global plugin struct.
unsigned int msgs_in_queue
Number of messages waiting for transmission to this peer.
int in_destroy
Is this session about to be destroyed (sometimes we cannot destroy a session immediately as below us ...
unsigned int rc
Reference counter to indicate that this session is currently being used and must not be destroyed; se...
struct GNUNET_TIME_Absolute timeout
When does this session time out.
struct GNUNET_TIME_Relative flow_delay_from_other_peer
Desired delay for transmissions we received from other peer.
struct GNUNET_HELLO_Address * address
Address.
struct GNUNET_MessageStreamTokenizer * mst
Tokenizer for inbound messages.
struct GNUNET_TIME_Absolute last_transmit_time
What time did we last transmit?
struct UDP_FragmentationContext * frag_ctx
Context for dealing with fragments.
enum GNUNET_NetworkType scope
ATS network type.
unsigned long long bytes_in_queue
Number of bytes waiting for transmission to this peer.
struct GNUNET_TIME_Relative last_expected_msg_delay
desired delay between UDP messages
struct GNUNET_TIME_Relative last_expected_ack_delay
expected delay for ACKs
struct GNUNET_SCHEDULER_Task * timeout_task
Session timeout task.
struct GNUNET_TIME_Relative flow_delay_for_other_peer
Desired delay for next sending we send to other peer.
void * cls
Closure for all of the callbacks.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
void * cls
Closure to use for callbacks.
Defragmentation context (one per connection).
An address for communicating with a peer.
size_t address_length
Number of bytes in address.
const void * address
Binary representation of the address (plugin-specific).
Handle to a message stream tokenizer.
The identity of the host (wraps the signing key of the peer).
Handle to a request given to the resolver.
Context information passed to each scheduler task.
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 ...
enum GNUNET_SCHEDULER_Reason reason
Reason why the task is run now.
Entry in list of pending tasks.
Time for absolute times used by GNUnet, in microseconds.
uint64_t abs_value_us
The actual value.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
The transport service will pass a pointer to a struct of this type as the first and only argument to ...
void * cls
Closure for the various callbacks.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
void * cls
Closure for all of the callbacks.
GNUNET_TRANSPORT_TransmitFunction send
Function that the transport service will use to transmit data to another peer.
GNUNET_TRANSPORT_SessionMonitorSetup setup_monitor
Function to monitor the sessions managed by the plugin.
GNUNET_TRANSPORT_DisconnectPeerFunction disconnect_peer
Function that can be used to force the plugin to disconnect from the given peer and cancel all previo...
GNUNET_TRANSPORT_GetNetworkTypeForAddress get_network_for_address
Function to obtain the network type for an address.
GNUNET_TRANSPORT_DisconnectSessionFunction disconnect_session
Function that can be used to force the plugin to disconnect from the given peer and cancel all previo...
GNUNET_TRANSPORT_QueryKeepaliveFactorFunction query_keepalive_factor
Function that is used to query keepalive factor.
GNUNET_TRANSPORT_AddressPrettyPrinter address_pretty_printer
Function to pretty-print addresses.
GNUNET_TRANSPORT_AddressToString address_to_string
Function that will be called to convert a binary address to a string (numeric conversion only).
GNUNET_TRANSPORT_GetNetworkType get_network
Function to obtain the network type for a session.
GNUNET_TRANSPORT_CreateSession get_session
Function that will be called tell the plugin to create a session object.
GNUNET_TRANSPORT_CheckAddress check_address
Function that will be called to check if a binary address for this plugin is well-formed and correspo...
GNUNET_TRANSPORT_StringToAddress string_to_address
Function that will be called to convert a string address to binary (numeric conversion only).
GNUNET_TRANSPORT_UpdateSessionTimeout update_session_timeout
Function that will be called whenever the transport service wants to notify the plugin that a session...
Information about a plugin's session.
Network format for IPv4 addresses.
uint16_t u4_port
Port number, in network byte order.
uint32_t ipv4_addr
IPv4 address, in network byte order.
uint32_t options
Optional options and flags for this address.
Network format for IPv6 addresses.
uint32_t options
Optional options and flags for this address.
uint16_t u6_port
Port number, in network byte order.
struct in6_addr ipv6_addr
IPv6 address.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
struct UDP_MessageWrapper * ipv4_queue_tail
Tail of messages in IPv4 queue.
void * sic_cls
Closure for sic.
struct UDP_MessageWrapper * ipv4_queue_head
Head of messages in IPv4 queue.
int enable_ipv6
Is IPv6 enabled: GNUNET_YES or GNUNET_NO.
struct GNUNET_CONTAINER_Heap * defrag_ctxs
Heap with all of our defragmentation activities.
struct UDP_MessageWrapper * ipv6_queue_head
Head of messages in IPv6 queue.
struct GNUNET_BANDWIDTH_Tracker tracker
Bandwidth tracker to limit global UDP traffic.
int enable_ipv4
Is IPv4 enabled: GNUNET_YES or GNUNET_NO.
char * bind6_address
Address we were told to bind to exclusively (IPv6).
int enable_broadcasting_receiving
Is receiving broadcasts enabled: GNUNET_YES or GNUNET_NO.
struct GNUNET_ATS_Session * sessions
List of open sessions (or peer map, or...)
struct PrettyPrinterContext * ppc_dll_head
Running pretty printers: head.
struct UDP_MessageWrapper * ipv6_queue_tail
Tail of messages in IPv6 queue.
int64_t bytes_in_buffer
Bytes currently in buffer.
struct GNUNET_DATACACHE_PluginEnvironment * env
Our execution environment.
struct GNUNET_SCHEDULER_Task * select_task_v4
ID of select task for IPv4.
struct GNUNET_NETWORK_Handle * sockv4
The read socket for IPv4.
int enable_broadcasting
Is broadcasting enabled: GNUNET_YES or GNUNET_NO.
struct GNUNET_NAT_Handle * nat
NAT handle & address management.
uint32_t myoptions
Address options.
GNUNET_TRANSPORT_SessionInfoCallback sic
Function to call about session status changes.
uint16_t aport
Port we advertise on.
char * port
Port we bind to.
struct GNUNET_NETWORK_Handle * sockv6
The read socket for IPv6.
char * bind4_address
Address we were told to bind to exclusively (IPv4).
struct GNUNET_SCHEDULER_Task * select_task_v6
ID of select task for IPv6.
struct PrettyPrinterContext * ppc_dll_tail
Running pretty printers: tail.
Closure for append_port().
struct GNUNET_RESOLVER_RequestHandle * resolver_handle
Resolver handle.
struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task.
uint16_t port
Port to add after the IP address.
char * plugin
Plugin String.
void * asc_cls
Clsoure for asc.
GNUNET_TRANSPORT_AddressStringCallback asc
Function to call with the result.
uint32_t options
Address options.
struct PrettyPrinterContext * prev
DLL.
struct PrettyPrinterContext * next
DLL.
UDP Message-Packet header (after defragmentation).
uint32_t reserved
Always zero for now.
struct GNUNET_MessageHeader header
Message header.
struct GNUNET_PeerIdentity sender
What is the identity of the sender.
UDP ACK Message-Packet header.
uint32_t delay
Desired delay for flow control, in us (in NBO).
struct GNUNET_PeerIdentity sender
What is the identity of the sender.
struct GNUNET_MessageHeader header
Message header.
Context to send fragmented messages.
struct GNUNET_TIME_Absolute next_frag_time
Transmission time for the next fragment.
struct UDP_FragmentationContext * next
Next in linked list.
GNUNET_TRANSPORT_TransmitContinuation cont
Function to call upon completion of the transmission.
struct UDP_FragmentationContext * prev
Previous in linked list.
struct GNUNET_TIME_Absolute start_time
Start time.
struct GNUNET_TIME_Relative flow_delay_from_other_peer
Desired delay for transmissions we received from other peer.
struct Plugin * plugin
The plugin.
size_t payload_size
Payload size of original unfragmented message.
void * cont_cls
Closure for cont.
struct GNUNET_FRAGMENT_Context * frag
Handle for fragmentation.
struct GNUNET_ATS_Session * session
The session this fragmentation context belongs to.
struct GNUNET_TIME_Absolute timeout
Message timeout.
size_t on_wire_size
Bytes used to send all fragments on wire including UDP overhead.
Information we track for each message in the queue.
char * msg_buf
Message with msg_size bytes including UDP-specific overhead.
QueueContinuation qc
Function to call once the message wrapper is being removed from the queue (with success or failure).
struct GNUNET_ATS_Session * session
Session this message belongs to.
void * cont_cls
Closure for cont.
size_t payload_size
Payload size of original message.
struct GNUNET_TIME_Absolute start_time
Message enqueue time.
struct UDP_FragmentationContext * frag_ctx
Fragmentation context.
struct UDP_MessageWrapper * next
DLL of messages, next element.
struct GNUNET_TIME_Absolute timeout
Message timeout.
GNUNET_TRANSPORT_TransmitContinuation cont
External continuation to call upon completion of the transmission, NULL if this queue entry is not fo...
struct UDP_MessageWrapper * prev
DLL of messages, previous element.
size_t msg_size
Size of UDP message to send, including UDP-specific overhead.
void * qc_cls
Closure for qc.
struct GNUNET_TIME_Absolute transmission_time
Desired transmission time for this message, based on the flow limiting information we got from the ot...
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
common internal definitions for transport service
Either an IPv4 or IPv6 UDP address.
struct IPv4UdpAddress v4
IPv4 case.
struct IPv6UdpAddress v6
IPv6 case.