21#include "ns3/arp-l3-protocol.h"
22#include "ns3/boolean.h"
23#include "ns3/icmpv4-l4-protocol.h"
24#include "ns3/inet-socket-address.h"
25#include "ns3/internet-stack-helper.h"
26#include "ns3/ipv4-l3-protocol.h"
27#include "ns3/ipv4-list-routing.h"
28#include "ns3/ipv4-raw-socket-factory.h"
29#include "ns3/ipv4-static-routing.h"
32#include "ns3/simple-channel.h"
33#include "ns3/simple-net-device.h"
34#include "ns3/simulator.h"
35#include "ns3/socket-factory.h"
36#include "ns3/socket.h"
38#include "ns3/traffic-control-layer.h"
41#include "ns3/win32-internet.h"
43#include <netinet/in.h>
44#include <sys/socket.h>
89 void DoRun()
override;
121 availableData = socket->GetRxAvailable();
125 "Received packet size is not equal to 2");
129 "Received packet size is not equal to Rx buffer size");
140 socket->SetAttribute(
"IpHeaderInclude",
BooleanValue(
true));
150 p->AddHeader(ipHeader);
153 socket->SetAttribute(
"IpHeaderInclude",
BooleanValue(
false));
180 internet.SetIpv6StackInstall(
false);
184 internet.Install(rxNode);
189 rxDev1 = CreateObject<SimpleNetDevice>();
191 rxNode->AddDevice(rxDev1);
193 uint32_t netdev_idx = ipv4->AddInterface(rxDev1);
196 ipv4->AddAddress(netdev_idx, ipv4Addr);
197 ipv4->SetUp(netdev_idx);
202 internet.Install(txNode);
205 txDev1 = CreateObject<SimpleNetDevice>();
207 txNode->AddDevice(txDev1);
209 uint32_t netdev_idx = ipv4->AddInterface(txDev1);
212 ipv4->AddAddress(netdev_idx, ipv4Addr);
213 ipv4->SetUp(netdev_idx);
218 rxDev1->SetChannel(channel1);
219 txDev1->SetChannel(channel1);
223 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket();
230 Ptr<Socket> txSocket = txSocketFactory->CreateSocket();
235 std::cout <<
"Dscp Test\n";
237 std::vector<Ipv4Header::DscpType> vDscpTypes;
260 for (
uint32_t i = 0; i < vDscpTypes.size(); i++)
266 std::cout << std::endl;
272 std::cout <<
"Ecn Test\n";
273 std::vector<Ipv4Header::EcnType> vEcnTypes;
279 for (
uint32_t i = 0; i < vEcnTypes.size(); i++)
285 std::cout << std::endl;
a polymophic address class
AttributeValue implementation for Boolean.
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, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
#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...