-peer review
[oweals/gnunet.git] / src / include / gnunet_tun_lib.h
index 4e824a9f5fc143bfb5023a026d46e7ff6226cbc7..3bb1ea359a97689c435a69210dae09147872c7cb 100644 (file)
@@ -70,12 +70,14 @@ struct GNUNET_TUN_Layer2PacketHeader
  */
 struct GNUNET_TUN_IPv4Header
 {
-#if __BYTE_ORDER == __LITTLE_ENDIAN       
+#if __BYTE_ORDER == __LITTLE_ENDIAN
   unsigned int header_length:4 GNUNET_PACKED;
   unsigned int version:4 GNUNET_PACKED;
 #elif __BYTE_ORDER == __BIG_ENDIAN
   unsigned int version:4 GNUNET_PACKED;
   unsigned int header_length:4 GNUNET_PACKED;
+#else
+  #error byteorder undefined
 #endif
   uint8_t diff_serv;
 
@@ -117,7 +119,7 @@ struct GNUNET_TUN_IPv4Header
    * Destination of the packet.
    */ 
   struct in_addr destination_address GNUNET_PACKED;
-};
+} GNUNET_GCC_STRUCT_LAYOUT;
 
 
 /**
@@ -125,7 +127,7 @@ struct GNUNET_TUN_IPv4Header
  */
 struct GNUNET_TUN_IPv6Header
 {
-#if __BYTE_ORDER == __LITTLE_ENDIAN 
+#if __BYTE_ORDER == __LITTLE_ENDIAN
   unsigned int traffic_class_h:4 GNUNET_PACKED;
   unsigned int version:4 GNUNET_PACKED;
   unsigned int traffic_class_l:4 GNUNET_PACKED;
@@ -134,6 +136,8 @@ struct GNUNET_TUN_IPv6Header
   unsigned int version:4 GNUNET_PACKED;
   unsigned int traffic_class:8 GNUNET_PACKED;
   unsigned int flow_label:20 GNUNET_PACKED;
+#else
+  #error byteorder undefined
 #endif
   /**
    * Length of the payload, excluding this header.
@@ -159,7 +163,7 @@ struct GNUNET_TUN_IPv6Header
    * Destination of the packet.
    */ 
   struct in6_addr destination_address GNUNET_PACKED;
-};
+} GNUNET_GCC_STRUCT_LAYOUT;
 
 
 /**
@@ -179,9 +183,9 @@ struct GNUNET_TUN_TcpHeader
    * Acknowledgement number.
    */
   uint32_t ack GNUNET_PACKED;
-#if __BYTE_ORDER == __LITTLE_ENDIAN       
+#if __BYTE_ORDER == __LITTLE_ENDIAN
   /**
-   * Reserved.
+   * Reserved.  Must be zero.
    */
   unsigned int reserved : 4 GNUNET_PACKED;
   /**
@@ -194,10 +198,16 @@ struct GNUNET_TUN_TcpHeader
    */
   unsigned int off : 4 GNUNET_PACKED;
   /**
-   * Reserved.
+   * Reserved.  Must be zero.
    */
   unsigned int reserved : 4 GNUNET_PACKED;
+#else
+  #error byteorder undefined
 #endif        
+
+  /**
+   * Flags (SYN, FIN, ACK, etc.)
+   */
   uint8_t flags;
 
   /**
@@ -214,7 +224,7 @@ struct GNUNET_TUN_TcpHeader
    * Urgent pointer.
    */
   uint16_t urgent_pointer GNUNET_PACKED;
-};
+} GNUNET_GCC_STRUCT_LAYOUT;
 
 
 /**