6LoWPAN Fragmentation Test More...
Public Member Functions | |
SixlowpanFragmentationTest () | |
~SixlowpanFragmentationTest () override | |
void | DoRun () override |
Implementation to actually run this TestCase. | |
void | HandleReadClient (Ptr< Socket > socket) |
Handles incoming packets in the client. | |
void | HandleReadIcmpClient (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo) |
Handles incoming ICMP packets in the client. | |
void | HandleReadServer (Ptr< Socket > socket) |
Handles incoming packets in the server. | |
Ptr< Packet > | SendClient () |
Send a packet to the server. | |
void | SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize) |
Set the packet optional content. | |
void | StartClient (Ptr< Node > clientNode) |
Start the client node. | |
void | StartServer (Ptr< Node > serverNode) |
Start the server node. | |
Public Member Functions inherited from ns3::TestCase | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Attributes | |
uint8_t * | m_data |
Data to be carried in the packet. | |
uint32_t | m_dataSize |
Size of the data (if any). | |
uint8_t | m_icmpCode |
ICMP code. | |
uint8_t | m_icmpType |
ICMP type. | |
Ptr< Packet > | m_receivedPacketClient |
Packet received by the client. | |
Ptr< Packet > | m_receivedPacketServer |
packet received by the server. | |
Ptr< Packet > | m_sentPacketClient |
Packet sent by client. | |
uint32_t | m_size |
Size of the packet if no data has been provided. | |
Ptr< Socket > | m_socketClient |
Socket on the client. | |
Ptr< Socket > | m_socketServer |
Socket on the server. | |
Additional Inherited Members | |
Public Types inherited from ns3::TestCase | |
enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
Static Public Attributes inherited from ns3::TestCase | |
static constexpr auto | QUICK = Duration::QUICK |
Deprecated test duration simple enums. | |
static constexpr auto | EXTENSIVE = Duration::EXTENSIVE |
static constexpr auto | TAKES_FOREVER = Duration::TAKES_FOREVER |
Protected Member Functions inherited from ns3::TestCase | |
TestCase (std::string name) | |
Constructor. | |
void | AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK) |
Add an individual child TestCase to this test suite. | |
TestCase * | GetParent () const |
Get the parent of this TestCase. | |
bool | IsStatusFailure () const |
Check if any tests failed. | |
bool | IsStatusSuccess () const |
Check if all tests passed. | |
void | SetDataDir (std::string directory) |
Set the data directory where reference trace files can be found. | |
void | ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line) |
Log the failure of this TestCase. | |
bool | MustAssertOnFailure () const |
Check if this run should assert on failure. | |
bool | MustContinueOnFailure () const |
Check if this run should continue on failure. | |
std::string | CreateDataDirFilename (std::string filename) |
Construct the full path to a file in the data directory. | |
std::string | CreateTempDirFilename (std::string filename) |
Construct the full path to a file in a temporary directory. | |
6LoWPAN Fragmentation Test
Definition at line 43 of file sixlowpan-fragmentation-test.cc.
SixlowpanFragmentationTest::SixlowpanFragmentationTest | ( | ) |
Definition at line 114 of file sixlowpan-fragmentation-test.cc.
References m_data, m_dataSize, m_icmpCode, m_icmpType, m_size, and m_socketServer.
|
override |
Definition at line 125 of file sixlowpan-fragmentation-test.cc.
References m_data, and m_dataSize.
|
overridevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 257 of file sixlowpan-fragmentation-test.cc.
References ns3::Mac48Address::Allocate(), ns3::Mac48Address::ConvertFrom(), ns3::Packet::CopyData(), ns3::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), ns3::Packet::EnablePrinting(), ns3::Node::GetId(), ns3::Socket::GetNode(), ns3::Packet::GetSize(), m_data, m_icmpCode, m_icmpType, m_receivedPacketServer, m_socketClient, NS_TEST_EXPECT_MSG_EQ, packetSize, ns3::Simulator::Run(), ns3::Simulator::ScheduleWithContext(), ns3::Seconds(), SendClient(), SetFill(), StartClient(), and StartServer().
Handles incoming packets in the client.
socket | The receiving socket. |
Definition at line 187 of file sixlowpan-fragmentation-test.cc.
References ns3::Inet6SocketAddress::IsMatchingType(), and m_receivedPacketClient.
Referenced by StartClient().
void SixlowpanFragmentationTest::HandleReadIcmpClient | ( | Ipv6Address | icmpSource, |
uint8_t | icmpTtl, | ||
uint8_t | icmpType, | ||
uint8_t | icmpCode, | ||
uint32_t | icmpInfo ) |
Handles incoming ICMP packets in the client.
icmpSource | ICMP sender address. |
icmpTtl | ICMP TTL. |
icmpType | ICMP type. |
icmpCode | ICMP code. |
icmpInfo | ICMP info. |
Definition at line 201 of file sixlowpan-fragmentation-test.cc.
References m_icmpCode, and m_icmpType.
Referenced by StartClient().
Handles incoming packets in the server.
socket | The receiving socket. |
Definition at line 152 of file sixlowpan-fragmentation-test.cc.
References ns3::Inet6SocketAddress::IsMatchingType(), and m_receivedPacketServer.
Referenced by StartServer().
Send a packet to the server.
Definition at line 240 of file sixlowpan-fragmentation-test.cc.
References ns3::Create(), m_data, m_dataSize, m_size, m_socketClient, and ns3::Socket::Send().
Referenced by DoRun().
Set the packet optional content.
fill | Pointer to an array of data. |
fillSize | Size of the array of data. |
dataSize | Size of the packet - if fillSize is less than dataSize, the data is repeated. |
Definition at line 212 of file sixlowpan-fragmentation-test.cc.
References m_data, m_dataSize, and m_size.
Referenced by DoRun().
Start the client node.
clientNode | The client node. |
Definition at line 169 of file sixlowpan-fragmentation-test.cc.
References ns3::Socket::Bind(), ns3::Socket::Connect(), ns3::Socket::CreateSocket(), ns3::Ipv6Address::GetAny(), HandleReadClient(), HandleReadIcmpClient(), ns3::TypeId::LookupByName(), m_socketClient, ns3::MakeCallback(), ns3::ObjectBase::SetAttribute(), and ns3::Socket::SetRecvCallback().
Referenced by DoRun().
Start the server node.
serverNode | The server node. |
Definition at line 136 of file sixlowpan-fragmentation-test.cc.
References ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::DynamicCast(), HandleReadServer(), ns3::TypeId::LookupByName(), m_socketServer, ns3::MakeCallback(), and ns3::Socket::SetRecvCallback().
Referenced by DoRun().
|
private |
Data to be carried in the packet.
Definition at line 52 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), ~SixlowpanFragmentationTest(), DoRun(), SendClient(), and SetFill().
|
private |
Size of the data (if any).
Definition at line 51 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), ~SixlowpanFragmentationTest(), SendClient(), and SetFill().
|
private |
ICMP code.
Definition at line 55 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), DoRun(), and HandleReadIcmpClient().
|
private |
ICMP type.
Definition at line 54 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), DoRun(), and HandleReadIcmpClient().
Packet received by the client.
Definition at line 46 of file sixlowpan-fragmentation-test.cc.
Referenced by HandleReadClient().
packet received by the server.
Definition at line 47 of file sixlowpan-fragmentation-test.cc.
Referenced by DoRun(), and HandleReadServer().
Packet sent by client.
Definition at line 45 of file sixlowpan-fragmentation-test.cc.
|
private |
Size of the packet if no data has been provided.
Definition at line 53 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), SendClient(), and SetFill().
Socket on the client.
Definition at line 50 of file sixlowpan-fragmentation-test.cc.
Referenced by DoRun(), SendClient(), and StartClient().
Socket on the server.
Definition at line 49 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), and StartServer().