IPv6 Fragmentation Test. More...
Public Member Functions | |
Ipv6FragmentationTest () | |
~Ipv6FragmentationTest () override | |
void | DoRun () override |
Implementation to actually run this TestCase. | |
void | HandleClientTx (Ptr< const Packet > packet, Ptr< Ipv6 > ipv6, uint32_t interface) |
Handle Client's transmitting packets. | |
void | HandleReadClient (Ptr< Socket > socket) |
Handle incoming packets. | |
void | HandleReadIcmpClient (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo) |
Handle incoming ICMP packets. | |
void | HandleReadServer (Ptr< Socket > socket) |
Handle incoming packets. | |
void | HandleServerRx (Ptr< const Packet > packet, Ptr< Ipv6 > ipv6, uint32_t interface) |
Handle Server's incoming packets. | |
Ptr< Packet > | SendClient () |
Send a packet. | |
void | SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize) |
Set the packet fill. | |
void | StartClient (Ptr< Node > ClientNode) |
Start the client. | |
void | StartServer (Ptr< Node > ServerNode) |
Start the server. | |
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. | |
uint32_t | m_dataSize |
Data size. | |
uint8_t | m_icmpCode |
ICMP code. | |
uint8_t | m_icmpType |
ICMP type. | |
Ptr< Packet > | m_receivedPacketClient |
Packet received by client. | |
Ptr< Packet > | m_receivedPacketServer |
Packet received by server. | |
Ptr< Packet > | m_sentPacketClient |
Packet sent by client. | |
uint32_t | m_size |
packet size. | |
Ptr< Socket > | m_socketClient |
Client socket. | |
Ptr< Socket > | m_socketServer |
Server socket. | |
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. | |
IPv6 Fragmentation Test.
Definition at line 127 of file ipv6-fragmentation-test.cc.
Ipv6FragmentationTest::Ipv6FragmentationTest | ( | ) |
Definition at line 220 of file ipv6-fragmentation-test.cc.
References m_data, m_dataSize, m_icmpCode, m_icmpType, m_size, and m_socketServer.
|
override |
Definition at line 231 of file ipv6-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 379 of file ipv6-fragmentation-test.cc.
References ns3::Mac48Address::Allocate(), ns3::Mac48Address::ConvertFrom(), ns3::Packet::CopyData(), ns3::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), ns3::Packet::GetByteTagIterator(), ns3::TypeId::GetConstructor(), ns3::ByteTagIterator::Item::GetEnd(), ns3::Node::GetId(), ns3::TypeId::GetName(), ns3::Socket::GetNode(), ns3::Packet::GetSize(), ns3::ByteTagIterator::Item::GetStart(), ns3::ByteTagIterator::Item::GetTag(), IPv6TestTag::GetToken(), ns3::ByteTagIterator::Item::GetTypeId(), HandleClientTx(), HandleServerRx(), ns3::ByteTagIterator::HasNext(), ns3::Icmpv6Header::ICMPV6_ERROR_TIME_EXCEEDED, ns3::Icmpv6Header::ICMPV6_FRAGTIME, m_data, m_icmpCode, m_icmpType, m_receivedPacketServer, m_socketClient, ns3::MakeCallback(), ns3::ByteTagIterator::Next(), NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_NE, packetSize, ns3::Packet::PeekPacketTag(), ns3::Simulator::Run(), ns3::Simulator::ScheduleWithContext(), ns3::Seconds(), SendClient(), SetFill(), StartClient(), and StartServer().
void Ipv6FragmentationTest::HandleClientTx | ( | Ptr< const Packet > | packet, |
Ptr< Ipv6 > | ipv6, | ||
uint32_t | interface ) |
Handle Client's transmitting packets.
Ensure no packet greater than MTU is transmitted
packet | the packet. |
ipv6 | the Ipv6 protocol. |
interface | the IP-level interface index. |
Definition at line 370 of file ipv6-fragmentation-test.cc.
References NS_TEST_EXPECT_MSG_LT_OR_EQ.
Referenced by DoRun().
Handle incoming packets.
socket | The receiving socket. |
Definition at line 287 of file ipv6-fragmentation-test.cc.
References ns3::Inet6SocketAddress::IsMatchingType(), and m_receivedPacketClient.
Referenced by StartClient().
void Ipv6FragmentationTest::HandleReadIcmpClient | ( | Ipv6Address | icmpSource, |
uint8_t | icmpTtl, | ||
uint8_t | icmpType, | ||
uint8_t | icmpCode, | ||
uint32_t | icmpInfo ) |
Handle incoming ICMP packets.
icmpSource | The ICMP sender. |
icmpTtl | The ICMP TTL. |
icmpType | The ICMP Type. |
icmpCode | The ICMP Code. |
icmpInfo | The ICMP Info. |
Definition at line 301 of file ipv6-fragmentation-test.cc.
References m_icmpCode, and m_icmpType.
Referenced by StartClient().
Handle incoming packets.
socket | The receiving socket. |
Definition at line 257 of file ipv6-fragmentation-test.cc.
References ns3::Inet6SocketAddress::IsMatchingType(), and m_receivedPacketServer.
Referenced by StartServer().
void Ipv6FragmentationTest::HandleServerRx | ( | Ptr< const Packet > | packet, |
Ptr< Ipv6 > | ipv6, | ||
uint32_t | interface ) |
Handle Server's incoming packets.
Ensure no packet greater than MTU is received
packet | the packet. |
ipv6 | the Ipv6 protocol. |
interface | the IP-level interface index. |
Definition at line 362 of file ipv6-fragmentation-test.cc.
References NS_TEST_EXPECT_MSG_LT_OR_EQ.
Referenced by DoRun().
Send a packet.
Definition at line 340 of file ipv6-fragmentation-test.cc.
References ns3::Create(), m_data, m_dataSize, m_size, m_socketClient, ns3::Socket::Send(), and IPv6TestTag::SetToken().
Referenced by DoRun().
Set the packet fill.
fill | The fill. |
fillSize | The fill size. |
dataSize | The packet size. |
Definition at line 312 of file ipv6-fragmentation-test.cc.
References m_data, m_dataSize, and m_size.
Referenced by DoRun().
Start the client.
ClientNode | The client. |
Definition at line 271 of file ipv6-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.
ServerNode | The server. |
Definition at line 242 of file ipv6-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.
Definition at line 136 of file ipv6-fragmentation-test.cc.
Referenced by Ipv6FragmentationTest(), ~Ipv6FragmentationTest(), DoRun(), SendClient(), and SetFill().
|
private |
Data size.
Definition at line 135 of file ipv6-fragmentation-test.cc.
Referenced by Ipv6FragmentationTest(), ~Ipv6FragmentationTest(), SendClient(), and SetFill().
|
private |
ICMP code.
Definition at line 139 of file ipv6-fragmentation-test.cc.
Referenced by Ipv6FragmentationTest(), DoRun(), and HandleReadIcmpClient().
|
private |
ICMP type.
Definition at line 138 of file ipv6-fragmentation-test.cc.
Referenced by Ipv6FragmentationTest(), DoRun(), and HandleReadIcmpClient().
Packet received by client.
Definition at line 130 of file ipv6-fragmentation-test.cc.
Referenced by HandleReadClient().
Packet received by server.
Definition at line 131 of file ipv6-fragmentation-test.cc.
Referenced by DoRun(), and HandleReadServer().
Packet sent by client.
Definition at line 129 of file ipv6-fragmentation-test.cc.
|
private |
packet size.
Definition at line 137 of file ipv6-fragmentation-test.cc.
Referenced by Ipv6FragmentationTest(), SendClient(), and SetFill().
Client socket.
Definition at line 134 of file ipv6-fragmentation-test.cc.
Referenced by DoRun(), SendClient(), and StartClient().
Server socket.
Definition at line 133 of file ipv6-fragmentation-test.cc.
Referenced by Ipv6FragmentationTest(), and StartServer().