Packets: Really fix WLANPacket desaster
[senf.git] / Packets / 80211Bundle / WLANPacket.hh
index 52c71b5..046bed9 100644 (file)
@@ -40,10 +40,11 @@ namespace senf
     {
     #   include SENF_FIXED_PARSER()
         
-        SENF_PARSER_PRIVATE_BITFIELD ( subtype, 4,  unsigned                );
-        SENF_PARSER_SKIP_BITS        (          4                           ); //skip type and version
+        SENF_PARSER_PRIVATE_BITFIELD ( subtype, 4,  unsigned                ); //<pkgdraw: hide
+       //skip type and version
+        SENF_PARSER_SKIP_BITS        (          4                           ); //<pkgdraw: hide
         //jump to fist address field
-        SENF_PARSER_SKIP             ( 3                                    );
+        SENF_PARSER_SKIP             ( 3                                    ); //<pkgdraw: hide
         SENF_PARSER_FIELD            ( destinationAddress, MACAddressParser );
         SENF_PARSER_FIELD            ( sourceAddress,      MACAddressParser );
         SENF_PARSER_FIELD            ( bssid,              MACAddressParser );
@@ -58,7 +59,9 @@ namespace senf
         //this is needed due to the goto in the WLANPacketParser. Don't know exactly why yet.
         SENF_PARSER_INIT() {}
 
-        boost::uint16_t sequenceNumber() const;
+        boost::uint16_t sequenceNumber() const {
+            return (uint16_t)(seqNumber_2()) << 4 | seqNumber_1();
+        };
     };
 
     /** \brief Control frame parser
@@ -71,10 +74,11 @@ namespace senf
     {
     #   include SENF_PARSER()
         
-        SENF_PARSER_PRIVATE_BITFIELD ( subtype,  4,  unsigned            );
-        SENF_PARSER_SKIP_BITS        (           4                       ); //skip type and version
+        SENF_PARSER_PRIVATE_BITFIELD ( subtype,  4,  unsigned            ); //<pkgdraw: hide
+       //skip type and version
+        SENF_PARSER_SKIP_BITS        (           4                       ); //<pkgdraw: hide
         //jump to fist address field
-        SENF_PARSER_SKIP             ( 3, 3                              );
+        SENF_PARSER_SKIP             ( 3, 3                              ); //<pkgdraw: hide
         SENF_PARSER_FIELD            ( receiverAddress, MACAddressParser );
 
         //only RTS frame contains a source address field
@@ -97,16 +101,16 @@ namespace senf
     struct WLANPacket_DataFrameParser : public senf::PacketParserBase
     {
     #   include SENF_PARSER()
-        SENF_PARSER_PRIVATE_BITFIELD ( subtype,  4,  unsigned  );
+        SENF_PARSER_PRIVATE_BITFIELD ( subtype,  4,  unsigned  ); //<pkgdraw: hide
         //jump to 'toDS' and 'fromDS' bits
         //skip type and version
-        SENF_PARSER_SKIP_BITS        ( 4                       );
+        SENF_PARSER_SKIP_BITS        ( 4                       ); //<pkgdraw: hide
         //skip other flags
-        SENF_PARSER_SKIP_BITS        ( 6                       );
+        SENF_PARSER_SKIP_BITS        ( 6                       ); //<pkgdraw: hide
         //needed in data frames due to the variable address fields
-        SENF_PARSER_PRIVATE_BITFIELD ( dsBits,  2,  unsigned   );
+        SENF_PARSER_PRIVATE_BITFIELD ( dsBits,  2,  unsigned   ); //<pkgdraw: hide
         //skip duration field
-        SENF_PARSER_SKIP             ( 2, 0                    );
+        SENF_PARSER_SKIP             ( 2, 2                    ); //<pkgdraw: hide
 
         SENF_PARSER_PRIVATE_FIELD    ( addr1, MACAddressParser );
         SENF_PARSER_PRIVATE_FIELD    ( addr2, MACAddressParser );
@@ -136,7 +140,9 @@ namespace senf
         //this is needed to due to the goto in the WLANPacketParser. Don't know exactly why yet.
         SENF_PARSER_INIT() {}
 
-        boost::uint16_t sequenceNumber() const;
+        boost::uint16_t sequenceNumber() const {
+            return (uint16_t)(seqNumber_2()) << 4 | seqNumber_1();
+        };
 
         MACAddressParser receiverAddress() const    { return addr1(); }; //ra is always addr1
         MACAddressParser transmitterAddress() const { return addr2(); }; //ta is always addr2
@@ -202,6 +208,7 @@ namespace senf
 
         \par Fields:
             \ref WLANPacketParser
+           \image html WLANPacket.png
 
         \ingroup protocolbundle_80211
      */