- fix error messages
[oweals/gnunet.git] / src / transport / plugin_transport_udp.h
index 6f78a4169b9d635c0459c8583ee5fa4df1b9918e..8f78ed4bc3b839dbe4734343275f16482e2e114e 100644 (file)
@@ -57,6 +57,11 @@ GNUNET_NETWORK_STRUCT_BEGIN
  */
 struct IPv4UdpAddress
 {
+  /**
+   * Optional options and flags for this address
+   */
+  uint32_t options GNUNET_PACKED;
+
   /**
    * IPv4 address, in network byte order.
    */
@@ -74,6 +79,10 @@ struct IPv4UdpAddress
  */
 struct IPv6UdpAddress
 {
+  /**
+   * Optional options and flags for this address
+   */
+  uint32_t options GNUNET_PACKED;
 
   /**
    * IPv6 address.
@@ -126,7 +135,7 @@ struct Plugin
    * Session of peers with whom we are currently connected,
    * map of peer identity to 'struct PeerSession'.
    */
-  struct GNUNET_CONTAINER_MultiHashMap *sessions;
+  struct GNUNET_CONTAINER_MultiPeerMap *sessions;
 
   /**
    * Heap with all of our defragmentation activities.
@@ -137,6 +146,7 @@ struct Plugin
    * ID of select task
    */
   GNUNET_SCHEDULER_TaskIdentifier select_task;
+  GNUNET_SCHEDULER_TaskIdentifier select_task_v6;
 
   /**
    * Tokenizer for inbound messages.
@@ -158,6 +168,12 @@ struct Plugin
    */
   char *bind6_address;
 
+
+  /**
+   * Bytes currently in buffer
+   */
+  int64_t bytes_in_buffer;
+
   /**
    * Handle to NAT traversal support.
    */
@@ -166,43 +182,44 @@ struct Plugin
   /**
    * FD Read set
    */
-  struct GNUNET_NETWORK_FDSet *rs;
+  struct GNUNET_NETWORK_FDSet *rs_v4;
 
   /**
    * FD Write set
    */
-  struct GNUNET_NETWORK_FDSet *ws;
+  struct GNUNET_NETWORK_FDSet *ws_v4;
+
 
   /**
    * The read socket for IPv4
    */
   struct GNUNET_NETWORK_Handle *sockv4;
 
+
   /**
-   * The read socket for IPv6
+   * FD Read set
    */
-  struct GNUNET_NETWORK_Handle *sockv6;
+  struct GNUNET_NETWORK_FDSet *rs_v6;
 
   /**
-   * Beacon broadcasting
-   * -------------------
+   * FD Write set
    */
+  struct GNUNET_NETWORK_FDSet *ws_v6;
 
   /**
-   * Broadcast interval
+   * The read socket for IPv6
    */
-  struct GNUNET_TIME_Relative broadcast_interval;
+  struct GNUNET_NETWORK_Handle *sockv6;
 
   /**
-   * Broadcast with IPv4
+   * Beacon broadcasting
+   * -------------------
    */
-  int broadcast_ipv4;
 
   /**
-   * Broadcast with IPv6
+   * Broadcast interval
    */
-  int broadcast_ipv6;
-
+  struct GNUNET_TIME_Relative broadcast_interval;
 
   /**
    * Tokenizer for inbound messages.
@@ -211,30 +228,35 @@ struct Plugin
   struct GNUNET_SERVER_MessageStreamTokenizer *broadcast_ipv4_mst;
 
   /**
-   * ID of select broadcast task
+   * IPv6 multicast address
    */
-  GNUNET_SCHEDULER_TaskIdentifier send_ipv4_broadcast_task;
+  struct sockaddr_in6 ipv6_multicast_address;
 
   /**
-   * ID of select broadcast task
+   * DLL of broadcast addresses
    */
-  GNUNET_SCHEDULER_TaskIdentifier send_ipv6_broadcast_task;
+  struct BroadcastAddress *broadcast_tail;
+  struct BroadcastAddress *broadcast_head;
 
   /**
-   * IPv6 multicast address
+   * Is IPv6 enabled: GNUNET_YES or GNUNET_NO
    */
-  struct sockaddr_in6 ipv6_multicast_address;
+  int enable_ipv6;
 
   /**
-   * DLL of IPv4 broadcast addresses
+   * Is IPv4 enabled: GNUNET_YES or GNUNET_NO
    */
-  struct BroadcastAddress *ipv4_broadcast_tail;
-  struct BroadcastAddress *ipv4_broadcast_head;
+  int enable_ipv4;
 
   /**
-   * Enable IPv6
+   * Is broadcasting enabled: GNUNET_YES or GNUNET_NO
    */
-  int enable_ipv6;
+  int enable_broadcasting;
+
+  /**
+   * Is receiving broadcasts enabled: GNUNET_YES or GNUNET_NO
+   */
+  int enable_broadcasting_receiving;
 
   /**
    * Port we broadcasting on.
@@ -251,11 +273,11 @@ struct Plugin
    */
   uint16_t aport;
 
-  struct UDPMessageWrapper *ipv4_queue_head;
-  struct UDPMessageWrapper *ipv4_queue_tail;
+  struct UDP_MessageWrapper *ipv4_queue_head;
+  struct UDP_MessageWrapper *ipv4_queue_tail;
 
-  struct UDPMessageWrapper *ipv6_queue_head;
-  struct UDPMessageWrapper *ipv6_queue_tail;
+  struct UDP_MessageWrapper *ipv6_queue_head;
+  struct UDP_MessageWrapper *ipv6_queue_tail;
 };
 
 
@@ -263,10 +285,16 @@ const char *
 udp_address_to_string (void *cls, const void *addr, size_t addrlen);
 
 void
-udp_broadcast_receive ();
+udp_broadcast_receive (struct Plugin *plugin,
+                       const char * buf,
+                       ssize_t size,
+                       const struct sockaddr *addr,
+                       size_t addrlen);
 
 void
-setup_broadcast (struct Plugin *plugin, struct sockaddr_in6 *serverAddrv6, struct sockaddr_in *serverAddrv4);
+setup_broadcast (struct Plugin *plugin,
+                 struct sockaddr_in6 *server_addrv6,
+                 struct sockaddr_in *server_addrv4);
 
 void
 stop_broadcast (struct Plugin *plugin);