completed RadiotapPacket::dump()
tho [Thu, 11 Dec 2008 09:10:41 +0000 (09:10 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1014 270642c3-0616-0410-b53a-bc976706d245

Packets/80211Bundle/RadiotapPacket.cc
Packets/80211Bundle/RadiotapPacket.hh

index a67514c..021cfb6 100644 (file)
 prefix_ void senf::RadiotapPacketType::dump(packet p, std::ostream &os)
 {
     boost::io::ios_all_saver ias(os);
-    os             << "Radiotap:\n"
-            << "  Version             : " << unsigned (p->version()) << "\n"
-            << "  Length              : " << unsigned (p->length()) << "\n";
-    if (p->has_dbmAntennaSignal())
-        os  << "  Signal              : " << signed (p-> dbmAntennaSignal()) << "\n";
+    os << "Radiotap:\n"
+       << "  Version             : " << unsigned( p->version()) << "\n"
+       << "  Length              : " << unsigned( p->length()) << "\n";
+    if (p->has_tsft())
+        os  << "  MAC timestamp       : " << unsigned( p->tsft()) << "\n";
+    // TODO: flags
     if (p->has_tsft())
-        os  << "  MAC timestamp       : " << unsigned (p->tsft()) << "\n";
+        os  << "  Rate                : " << unsigned( p->rate()) << "\n";
+    // TODO: channelOptions
+    if (p->has_fhss())
+        os  << "  FHSS                : " << unsigned( p->fhss()) << "\n";
+    if (p->has_dbmAntennaSignal())
+        os  << "  Antenna Signal (dBm): " << signed( p->dbmAntennaSignal()) << "\n";
     if (p->has_dbmAntennaNoise())
-        os  << "  Noise               : " << signed (p-> dbmAntennaNoise()) << "\n";
-
-
-
+        os  << "  Antenna Noise (dBm) : " << signed( p->dbmAntennaNoise()) << "\n";
+    if (p->has_lockQuality())
+        os  << "  Lock Quality        : " << unsigned( p->lockQuality()) << "\n";
+    if (p->has_txAttenuation())
+        os  << "  txAttenuation       : " << unsigned( p->txAttenuation()) << "\n";
+    if (p->has_dbTxAttenuation())
+        os  << "  dbTxAttenuation     : " << unsigned( p->dbTxAttenuation()) << "\n";
+    if (p->has_dbmTxAttenuation())
+        os  << "  dbmTxAttenuation    : " << signed( p->dbmTxAttenuation()) << "\n";
+    if (p->has_antenna())
+        os  << "  Antenna             : " << unsigned( p->antenna()) << "\n";
+    if (p->has_dbAntennaSignal())
+        os  << "  Antenna Signal (dB) : " << unsigned( p->dbAntennaSignal()) << "\n";
+    if (p->has_dbAntennaNoise())
+        os  << "  Antenna Noise (dB)  : " << unsigned( p->dbAntennaNoise()) << "\n";
+    if (p->has_fcs())
+        os  << "  FCS                 : " << unsigned( p->fcs()) << "\n";
 }
 
 prefix_ void senf::RadiotapPacketType::finalize(packet p)
 {
-    //TODO
-    p->length() << p.size();
+    p->length() << senf::bytes( p.parser());
 }
 
 prefix_ senf::PacketInterpreterBase::factory_t senf::RadiotapPacketType::nextPacketType(packet p)
index 28f1beb..e36308e 100644 (file)
@@ -21,9 +21,7 @@
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief Radiotap header \n
-        <b>Radiotap uses least significant bit byte order</b>
-    */
+    \brief Radiotap header */
 
 #ifndef HH_SENF_Packets_80211Bundle_RadiotapPacket_
 #define HH_SENF_Packets_80211Bundle_RadiotapPacket_ 1
@@ -34,9 +32,8 @@ namespace senf
 {
 
     /** \brief Parse Flag field in Radiotap header
-     * <b>Re-ordering of bits due to LSB byte order</b>
-     * (see http://www.radiotap.org/)
 
+        <b>Re-ordering of bits due to LSB byte order</b>
      */
     struct RadiotapPacketParser_Flags : public senf::PacketParserBase
     {
@@ -154,27 +151,27 @@ namespace senf
                     (cond ? (size - (parser##__offset() + \
                             senf::bytes(parser##_())) % size) % size : 0) , 0  );
 
-        OPTIONAL_FIELD          ( tsft,                     UInt64LSBParser                     );
-        OPTIONAL_FIELD          ( flags,                    RadiotapPacketParser_Flags          );
-        OPTIONAL_FIELD          ( rate,                     UInt8Parser                         );
-        SKIP_OPTIONAL_PADDING   ( channelOptionsPresent(),  rate, 2                             );
-        OPTIONAL_FIELD          ( channelOptions,           RadiotapPacketParser_ChannelOptions ) ;
-        SKIP_OPTIONAL_PADDING   ( fhssPresent(),            channelOptions, 2                   );
-        OPTIONAL_FIELD          ( fhss,                     UInt16LSBParser                     );
-        OPTIONAL_FIELD          ( dbmAntennaSignal,         Int8Parser                          );
-        OPTIONAL_FIELD          ( dbmAntennaNoise,          Int8Parser                          );
-        SKIP_OPTIONAL_PADDING   ( lockQualityPresent(),     dbmAntennaNoise, 2                  );
-        OPTIONAL_FIELD          ( lockQuality,              UInt16LSBParser                     );
-        SKIP_OPTIONAL_PADDING   ( txAttenuationPresent(),   lockQuality, 2                      );
-        OPTIONAL_FIELD          ( txAttenuation,            UInt16LSBParser                     );
-        SKIP_OPTIONAL_PADDING   ( dbTxAttenuationPresent(), txAttenuation, 2                    );
-        OPTIONAL_FIELD          ( dbTxAttenuation,          UInt16LSBParser                     );
-        OPTIONAL_FIELD          ( dbmTxAttenuation,         Int8Parser                          );
-        OPTIONAL_FIELD          ( antenna,                  UInt8Parser                         );
-        OPTIONAL_FIELD          ( dbAntennaSignal,          UInt8Parser                         );
-        OPTIONAL_FIELD          ( dbAntennaNoise,           UInt8Parser                         );
-        SKIP_OPTIONAL_PADDING   ( fcsPresent(),             dbAntennaNoise, 4                   );
-        OPTIONAL_FIELD          ( fcs,                      UInt32Parser                        );
+        OPTIONAL_FIELD        ( tsft,                     UInt64LSBParser                     );
+        OPTIONAL_FIELD        ( flags,                    RadiotapPacketParser_Flags          );
+        OPTIONAL_FIELD        ( rate,                     UInt8Parser                         );
+        SKIP_OPTIONAL_PADDING ( channelOptionsPresent(),  rate, 2                             );
+        OPTIONAL_FIELD        ( channelOptions,           RadiotapPacketParser_ChannelOptions );
+        SKIP_OPTIONAL_PADDING ( fhssPresent(),            channelOptions, 2                   );
+        OPTIONAL_FIELD        ( fhss,                     UInt16LSBParser                     );
+        OPTIONAL_FIELD        ( dbmAntennaSignal,         Int8Parser                          );
+        OPTIONAL_FIELD        ( dbmAntennaNoise,          Int8Parser                          );
+        SKIP_OPTIONAL_PADDING ( lockQualityPresent(),     dbmAntennaNoise, 2                  );
+        OPTIONAL_FIELD        ( lockQuality,              UInt16LSBParser                     );
+        SKIP_OPTIONAL_PADDING ( txAttenuationPresent(),   lockQuality, 2                      );
+        OPTIONAL_FIELD        ( txAttenuation,            UInt16LSBParser                     );
+        SKIP_OPTIONAL_PADDING ( dbTxAttenuationPresent(), txAttenuation, 2                    );
+        OPTIONAL_FIELD        ( dbTxAttenuation,          UInt16LSBParser                     );
+        OPTIONAL_FIELD        ( dbmTxAttenuation,         Int8Parser                          );
+        OPTIONAL_FIELD        ( antenna,                  UInt8Parser                         );
+        OPTIONAL_FIELD        ( dbAntennaSignal,          UInt8Parser                         );
+        OPTIONAL_FIELD        ( dbAntennaNoise,           UInt8Parser                         );
+        SKIP_OPTIONAL_PADDING ( fcsPresent(),             dbAntennaNoise, 4                   );
+        OPTIONAL_FIELD        ( fcs,                      UInt32Parser                        );
 
         SENF_PARSER_INIT() {
             version() = 0;
@@ -190,7 +187,9 @@ namespace senf
 
         \par Fields:
             \ref RadiotapPacketParser
-
+        
+        \see http://www.radiotap.org/
+        
         \ingroup protocolbundle_80211
      */
     struct RadiotapPacketType
@@ -208,7 +207,6 @@ namespace senf
         static void dump(packet p, std::ostream &os);
         static void finalize(packet p);
         static factory_t nextPacketType(packet p);
-
     };
 
     typedef senf::ConcretePacket<RadiotapPacketType> RadiotapPacket;