10#include "ns3/arp-l3-protocol.h"
11#include "ns3/boolean.h"
12#include "ns3/icmpv4-l4-protocol.h"
13#include "ns3/inet-socket-address.h"
14#include "ns3/internet-stack-helper.h"
15#include "ns3/ipv4-l3-protocol.h"
16#include "ns3/ipv4-list-routing.h"
17#include "ns3/ipv4-raw-socket-factory.h"
18#include "ns3/ipv4-static-routing.h"
21#include "ns3/simple-channel.h"
22#include "ns3/simple-net-device.h"
23#include "ns3/simulator.h"
24#include "ns3/socket-factory.h"
25#include "ns3/socket.h"
27#include "ns3/traffic-control-layer.h"
30#include "ns3/win32-internet.h"
32#include <netinet/in.h>
33#include <sys/socket.h>
78 void DoRun()
override;
110 availableData = socket->GetRxAvailable();
114 "Received packet size is not equal to 2");
118 "Received packet size is not equal to Rx buffer size");
129 socket->SetAttribute(
"IpHeaderInclude",
BooleanValue(
true));
139 p->AddHeader(ipHeader);
142 socket->SetAttribute(
"IpHeaderInclude",
BooleanValue(
false));
169 internet.SetIpv6StackInstall(
false);
173 internet.Install(rxNode);
180 rxNode->AddDevice(rxDev1);
182 uint32_t netdev_idx = ipv4->AddInterface(rxDev1);
185 ipv4->AddAddress(netdev_idx, ipv4Addr);
186 ipv4->SetUp(netdev_idx);
191 internet.Install(txNode);
196 txNode->AddDevice(txDev1);
198 uint32_t netdev_idx = ipv4->AddInterface(txDev1);
201 ipv4->AddAddress(netdev_idx, ipv4Addr);
202 ipv4->SetUp(netdev_idx);
207 rxDev1->SetChannel(channel1);
208 txDev1->SetChannel(channel1);
212 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket();
219 Ptr<Socket> txSocket = txSocketFactory->CreateSocket();
224 std::cout <<
"Dscp Test\n";
226 std::vector<Ipv4Header::DscpType> vDscpTypes;
249 for (
uint32_t i = 0; i < vDscpTypes.size(); i++)
255 std::cout << std::endl;
261 std::cout <<
"Ecn Test\n";
262 std::vector<Ipv4Header::EcnType> vEcnTypes;
268 for (
uint32_t i = 0; i < vEcnTypes.size(); i++)
274 std::cout << std::endl;
a polymophic address class
aggregate IP/TCP/UDP functionality to existing Nodes.
Ipv4 addresses are stored in host order in this class.
Access to the IPv4 forwarding table, interfaces, and configuration.
a class to store IPv4 address information on an interface
a class to represent an Ipv4 address mask
API to create RAW socket instances.
static Mac48Address ConvertFrom(const Address &address)
static Mac48Address Allocate()
Allocate a new Mac48Address.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void RemoveAllByteTags()
Remove all byte tags stored in this packet.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
static void Run()
Run the simulation.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static constexpr auto UNIT
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...