From: tho Date: Thu, 11 Dec 2008 09:36:34 +0000 (+0000) Subject: WLANPacket: one line is better than five ;) X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=acffdb583e9130b451bf52018a39d62b49621042;p=senf.git WLANPacket: one line is better than five ;) git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1015 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Packets/80211Bundle/WLANPacket.cc b/Packets/80211Bundle/WLANPacket.cc index c4c6512..2f1c148 100644 --- a/Packets/80211Bundle/WLANPacket.cc +++ b/Packets/80211Bundle/WLANPacket.cc @@ -81,27 +81,6 @@ prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::bssid() return addr1(); } -//shift some bits to read the 12bit sequence number bit field in LSB byte order -prefix_ boost::uint16_t senf::WLANPacket_MgtFrameParser::sequenceNumber() - const -{ - boost::uint16_t seqN = 0; - seqN |= seqNumber_2(); - seqN <<= 4; - seqN |= seqNumber_1(); - return seqN; -} - -//shift some bits to read the 12bit sequence number bit field in LSB byte order -prefix_ boost::uint16_t senf::WLANPacket_DataFrameParser::sequenceNumber() - const -{ - boost::uint16_t seqN = 0; - seqN |= seqNumber_2(); - seqN <<= 4; - seqN |= seqNumber_1(); - return seqN; -} prefix_ void senf::WLANPacketType::dump(packet p, std::ostream &os) { diff --git a/Packets/80211Bundle/WLANPacket.hh b/Packets/80211Bundle/WLANPacket.hh index 52c71b5..3138826 100644 --- a/Packets/80211Bundle/WLANPacket.hh +++ b/Packets/80211Bundle/WLANPacket.hh @@ -58,7 +58,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 @@ -136,7 +138,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