6LoWPAN Fragmentation Test More...
Public Member Functions | |
SixlowpanFragmentationTest () | |
~SixlowpanFragmentationTest () override | |
void | DoRun () override |
Implementation to actually run this TestCase. More... | |
void | HandleReadClient (Ptr< Socket > socket) |
Handles incoming packets in the client. More... | |
void | HandleReadIcmpClient (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo) |
Handles incoming ICMP packets in the client. More... | |
void | HandleReadServer (Ptr< Socket > socket) |
Handles incoming packets in the server. More... | |
Ptr< Packet > | SendClient () |
Send a packet to the server. More... | |
void | SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize) |
Set the packet optional content. More... | |
void | StartClient (Ptr< Node > clientNode) |
Start the client node. More... | |
void | StartServer (Ptr< Node > serverNode) |
Start the server node. More... | |
Public Member Functions inherited from ns3::TestCase | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. More... | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Attributes | |
uint8_t * | m_data |
Data to be carried in the packet. More... | |
uint32_t | m_dataSize |
Size of the data (if any). More... | |
uint8_t | m_icmpCode |
ICMP code. More... | |
uint8_t | m_icmpType |
ICMP type. More... | |
Ptr< Packet > | m_receivedPacketClient |
Packet received by the client. More... | |
Ptr< Packet > | m_receivedPacketServer |
packet received by the server. More... | |
Ptr< Packet > | m_sentPacketClient |
Packet sent by client. More... | |
uint32_t | m_size |
Size of the packet if no data has been provided. More... | |
Ptr< Socket > | m_socketClient |
Socket on the client. More... | |
Ptr< Socket > | m_socketServer |
Socket on the server. More... | |
Additional Inherited Members | |
Public Types inherited from ns3::TestCase | |
enum | TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
Protected Member Functions inherited from ns3::TestCase | |
TestCase (std::string name) | |
Constructor. More... | |
void | AddTestCase (TestCase *testCase, TestDuration duration=QUICK) |
Add an individual child TestCase to this test suite. More... | |
TestCase * | GetParent () const |
Get the parent of this TestCase. More... | |
bool | IsStatusFailure () const |
Check if any tests failed. More... | |
bool | IsStatusSuccess () const |
Check if all tests passed. More... | |
void | SetDataDir (std::string directory) |
Set the data directory where reference trace files can be found. More... | |
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. More... | |
bool | MustAssertOnFailure () const |
Check if this run should assert on failure. More... | |
bool | MustContinueOnFailure () const |
Check if this run should continue on failure. More... | |
std::string | CreateDataDirFilename (std::string filename) |
Construct the full path to a file in the data directory. More... | |
std::string | CreateTempDirFilename (std::string filename) |
Construct the full path to a file in a temporary directory. More... | |
6LoWPAN Fragmentation Test
Definition at line 54 of file sixlowpan-fragmentation-test.cc.
SixlowpanFragmentationTest::SixlowpanFragmentationTest | ( | ) |
Definition at line 125 of file sixlowpan-fragmentation-test.cc.
References m_data, m_dataSize, m_icmpCode, m_icmpType, m_size, and m_socketServer.
|
override |
Definition at line 136 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 268 of file sixlowpan-fragmentation-test.cc.
References ns3::Node::AddDevice(), third::channel, ns3::Packet::CopyData(), ns3::Node::GetId(), ns3::Socket::GetNode(), ns3::Object::GetObject(), ns3::Packet::GetSize(), nsclick-simple-lan::internet, two-ray-to-three-gpp-ch-calibration::k, m_data, m_icmpCode, m_icmpType, m_receivedPacketServer, m_socketClient, NS_TEST_EXPECT_MSG_EQ, packetSize, ns3::Seconds(), SendClient(), SetFill(), StartClient(), and StartServer().
Handles incoming packets in the client.
socket | The receiving socket. |
Definition at line 198 of file sixlowpan-fragmentation-test.cc.
References ns3::Packet::Copy(), m_receivedPacketClient, and ns3::Socket::RecvFrom().
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 212 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 163 of file sixlowpan-fragmentation-test.cc.
References ns3::Packet::Copy(), m_receivedPacketServer, ns3::Socket::RecvFrom(), ns3::Packet::RemoveAllByteTags(), and ns3::Packet::RemoveAllPacketTags().
Referenced by StartServer().
Send a packet to the server.
Definition at line 251 of file sixlowpan-fragmentation-test.cc.
References m_data, m_dataSize, m_size, m_socketClient, and ns3::Socket::Send().
Referenced by DoRun().
void SixlowpanFragmentationTest::SetFill | ( | uint8_t * | fill, |
uint32_t | fillSize, | ||
uint32_t | dataSize | ||
) |
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 223 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 180 of file sixlowpan-fragmentation-test.cc.
References ns3::Socket::Bind(), ns3::Socket::Connect(), HandleReadClient(), HandleReadIcmpClient(), 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 147 of file sixlowpan-fragmentation-test.cc.
References ns3::Socket::Bind(), HandleReadServer(), m_socketServer, ns3::MakeCallback(), and ns3::Socket::SetRecvCallback().
Referenced by DoRun().
|
private |
Data to be carried in the packet.
Definition at line 63 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), ~SixlowpanFragmentationTest(), DoRun(), SendClient(), and SetFill().
|
private |
Size of the data (if any).
Definition at line 62 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), ~SixlowpanFragmentationTest(), SendClient(), and SetFill().
|
private |
ICMP code.
Definition at line 66 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), DoRun(), and HandleReadIcmpClient().
|
private |
ICMP type.
Definition at line 65 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), DoRun(), and HandleReadIcmpClient().
Packet received by the client.
Definition at line 57 of file sixlowpan-fragmentation-test.cc.
Referenced by HandleReadClient().
packet received by the server.
Definition at line 58 of file sixlowpan-fragmentation-test.cc.
Referenced by DoRun(), and HandleReadServer().
Packet sent by client.
Definition at line 56 of file sixlowpan-fragmentation-test.cc.
|
private |
Size of the packet if no data has been provided.
Definition at line 64 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), SendClient(), and SetFill().
Socket on the client.
Definition at line 61 of file sixlowpan-fragmentation-test.cc.
Referenced by DoRun(), SendClient(), and StartClient().
Socket on the server.
Definition at line 60 of file sixlowpan-fragmentation-test.cc.
Referenced by SixlowpanFragmentationTest(), and StartServer().