//
// Copyright (C) 2008
// Fraunhofer Institute for Open Communication Systems (FOKUS)
-// Competence Center NETwork research (NET), St. Augustin, GERMANY
-// Christian Niephaus <cni@berlios.de>
//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
+// The contents of this file are subject to the Fraunhofer FOKUS Public License
+// Version 1.0 (the "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+// http://senf.berlios.de/license.html
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// The Fraunhofer FOKUS Public License Version 1.0 is based on,
+// but modifies the Mozilla Public License Version 1.1.
+// See the full license text for the amendments.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the
-// Free Software Foundation, Inc.,
-// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+// for the specific language governing rights and limitations under the License.
+//
+// The Original Code is Fraunhofer FOKUS code.
+//
+// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
+// (registered association), Hansastraße 27 c, 80686 Munich, Germany.
+// All Rights Reserved.
+//
+// Contributor(s):
+// Christian Niephaus <cni@berlios.de>
/** \file
\brief WLANPacket unit tests */
#include <senf/Utils/auto_unit_test.hh>
#include <boost/test/test_tools.hpp>
-///////////////////////////////cc.p////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
/* test parser with a data frame */
-BOOST_AUTO_UNIT_TEST(WLANPacket_dataFrame_packet)
+SENF_AUTO_UNIT_TEST(WLANPacket_dataFrame_packet)
{
unsigned char data[] = {
0x88, 0x01, 0x00, 0x00, 0x00, 0x1a, //header
/* test parser with creating a data frame*/
-BOOST_AUTO_UNIT_TEST(WLANPacket_dataFrame_create)
+SENF_AUTO_UNIT_TEST(WLANPacket_dataFrame_create)
{
senf::WLANPacket_DataFrame p (senf::WLANPacket_DataFrame::create());
SENF_CHECK_NO_THROW( p->bssid() = senf::MACAddress::from_string("00:1a:4d:3e:c7:5c") );
+ SENF_CHECK_NO_THROW(p->sequenceNumber(4095u));
+
BOOST_CHECK_EQUAL( p->type(), 2u );
+ BOOST_CHECK_EQUAL( p->sequenceNumber(), 4095u );
}
/* test parser with a beacon frame */
-BOOST_AUTO_UNIT_TEST(WLANPacket_beaconFrame_packet)
+SENF_AUTO_UNIT_TEST(WLANPacket_beaconFrame_packet)
{
unsigned char data[] = {
0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
0xa3, 0x40, 0x00, 0x27, 0xa4, 0x00, 0x00, 0x42,
0x43, 0x5e, 0x00, 0x62, 0x32, 0x2f, 0x00, 0xa0,
0x00, 0xdd, 0x09, 0x00, 0x03, 0x7f, 0x01, 0x01,
- 0x00, 0x24, 0xff, 0x7f,
+ 0x00, 0x24, 0xff, 0x7f,
};
senf::WLANPacket_MgtFrame p (senf::WLANPacket_MgtFrame::create(data));
/* test parser with creating a beacon frame*/
-BOOST_AUTO_UNIT_TEST(WLANPacket_mgtFrame_create)
+SENF_AUTO_UNIT_TEST(WLANPacket_mgtFrame_create)
{
senf::WLANPacket_MgtFrame p (senf::WLANPacket_MgtFrame::create());
SENF_CHECK_NO_THROW(
p->bssid() = senf::MACAddress::from_string("00:1a:4d:3e:c7:5c")
);
+ SENF_CHECK_NO_THROW(
+ p->sequenceNumber(2);
+ p->sequenceNumber(p->sequenceNumber()+1);
+ );
BOOST_CHECK_EQUAL( p->type(), 0u );
+ BOOST_CHECK_EQUAL( p->sequenceNumber(), 3u );
}
/* test parser with an ACK frame*/
-BOOST_AUTO_UNIT_TEST(WLANPacket_ctrlFrame_packet)
+SENF_AUTO_UNIT_TEST(WLANPacket_ctrlFrame_packet)
{
unsigned char data[] = {
- 0xd4, 0x00, 0x00, 0x00,
- 0x00, 0x0b, 0x6b, 0x57, 0x06, 0xb0,
+ 0xd4, 0x00, 0x00, 0x00,
+ 0x00, 0x0b, 0x6b, 0x57, 0x06, 0xb0,
0x4f, 0xda, // What is this ?
};
}
/* test parser with creating an ACK frame*/
-BOOST_AUTO_UNIT_TEST(WLANPacket_ctrlFrame_create)
+SENF_AUTO_UNIT_TEST(WLANPacket_ctrlFrame_create)
{
senf::WLANPacket_CtrlFrame p (senf::WLANPacket_CtrlFrame::create()) ;
p->receiverAddress() = senf::MACAddress::from_string("00:1a:4d:3e:c7:5c");
p->set_ack();
+
BOOST_CHECK_EQUAL( p->type(), 1u);
BOOST_CHECK_EQUAL( p->subtype(), 13u);
}
-///////////////////////////////cc.e////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
\f
// Local Variables: