RealtimeCompLab2

Dependencies:   mbed

Fork of PPP-Blinky by Nicolas Nackel

Revision:
156:163c23249731
Parent:
155:9c6a1d249e26
Child:
159:4d1bf96a59cd
--- a/PPP-Blinky/ppp-blinky.h	Fri Sep 01 23:04:41 2017 +0000
+++ b/PPP-Blinky/ppp-blinky.h	Sat Sep 02 01:35:21 2017 +0000
@@ -43,30 +43,23 @@
     unsigned int    dstAdrR : 16; // byte reversed
     unsigned int    seqTcpR;      // byte reversed
     unsigned int    ackTcpR;      // byte reversed
-    // a special union for the flag bits
+    unsigned int resvd1  : 4;  // reserved
+    unsigned int offset  : 4; // tcp header length [5..15]
     union {
-        struct {
-            unsigned int resvd1  : 4;  // reserved
-            unsigned int offset  : 4; // tcp header length [5..15]
-            unsigned int flagFin:  1, // fin
-                     flagSyn    :  1, // syn
-                     flagRst    :  1, // rst
-                     flagPsh    :  1, // psh
-                     flagAck    :  1, // ack
-                     flagUrg    :  1, // urg
-                     flagEce    :  1, // ece
-                     flagCwr    :  1; // cwr
-            unsigned int windowR : 16; // byte reversed
+        unsigned char All;  // all 8 flag bits
+        struct {            // individual flag bits
+            unsigned char fin:  1, // fin
+                     syn    :  1, // syn
+                     rst    :  1, // rst
+                     psh    :  1, // psh
+                     ack    :  1, // ack
+                     urg    :  1, // urg
+                     ece    :  1, // ece
+                     cwr    :  1; // cwr
         };
-        struct {
-            unsigned int            : 8; // already dealt with first 8 bits
-            unsigned int flagsTcp   : 8; // second 8 bits are the tcp flags
-        };
-
-    };
-    // end of a special union for the flag bits
+    } flag;
+    unsigned int windowR : 16; // byte reversed
     unsigned int    checksumR : 16; // byte reversed
     unsigned int    urgentPointerR : 16; // byte reversed;
     unsigned int    tcpOptions[10]; // up to 10 words of options possible
 } tcpHeaderType;
-