From: cni Date: Wed, 10 Feb 2010 14:03:09 +0000 (+0000) Subject: senf/Packets/80211Bundle/WLANPacket: fixed bug in set method for sequence number... X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=7d3e85ae9522484ba17161ebc2596c2ee1998cd9;p=senf.git senf/Packets/80211Bundle/WLANPacket: fixed bug in set method for sequence number in WLAN (Data and Mgt) Header git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1576 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/80211Bundle/WLANPacket.cc b/senf/Packets/80211Bundle/WLANPacket.cc index c4e9c67..5e9fd03 100644 --- a/senf/Packets/80211Bundle/WLANPacket.cc +++ b/senf/Packets/80211Bundle/WLANPacket.cc @@ -57,8 +57,8 @@ namespace { prefix_ void senf::WLANPacket_MgtFrameParser::sequenceNumber(boost::uint16_t sn) { - seqNumber_2() = seqNumber_2() | (sn >> 4 ) ; - seqNumber_1() = seqNumber_1() | sn; + seqNumber_2() = 0u | (sn >> 4 ) ; + seqNumber_1() = 0u | sn; } prefix_ void senf::WLANPacket_MgtFrameType::dump(packet p, std::ostream &os) @@ -85,8 +85,8 @@ prefix_ void senf::WLANPacket_CtrlFrameType::dump(packet p, std::ostream &os) prefix_ void senf::WLANPacket_DataFrameParser::sequenceNumber(boost::uint16_t sn) { - seqNumber_2() = seqNumber_2() | (sn >> 4 ) ; - seqNumber_1() = seqNumber_1() | sn; + seqNumber_2() = 0u | (sn >> 4 ) ; + seqNumber_1() = 0u | sn; } diff --git a/senf/Packets/80211Bundle/WLANPacket.test.cc b/senf/Packets/80211Bundle/WLANPacket.test.cc index a47a1a9..c59427e 100644 --- a/senf/Packets/80211Bundle/WLANPacket.test.cc +++ b/senf/Packets/80211Bundle/WLANPacket.test.cc @@ -160,13 +160,12 @@ SENF_AUTO_UNIT_TEST(WLANPacket_mgtFrame_create) p->bssid() = senf::MACAddress::from_string("00:1a:4d:3e:c7:5c") ); SENF_CHECK_NO_THROW( - p->sequenceNumber(555u); + p->sequenceNumber(2); + p->sequenceNumber(p->sequenceNumber()+1); ); - - std::cout << p->sequenceNumber() << "\n"; BOOST_CHECK_EQUAL( p->type(), 0u ); - BOOST_CHECK_EQUAL( p->sequenceNumber(), 555u ); + BOOST_CHECK_EQUAL( p->sequenceNumber(), 3u ); }