9#include "ns3/boolean.h"
11#include "ns3/inet6-socket-address.h"
12#include "ns3/internet-stack-helper.h"
15#include "ns3/simple-channel.h"
16#include "ns3/simple-net-device.h"
17#include "ns3/simulator.h"
18#include "ns3/sixlowpan-net-device.h"
19#include "ns3/socket-factory.h"
20#include "ns3/socket.h"
22#include "ns3/udp-socket-factory.h"
55 void DoRun()
override;
75 :
TestCase(
"Sixlowpan implementation")
88 uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable();
97 uint8_t buffer[] =
"\"Can you tell me where my country lies?\" \\ said the unifaun to his true "
98 "love's eyes. \\ \"It lies with me!\" cried the Queen of Maybe \\ - for her "
99 "merchandise, he traded in his prize.";
123 internet.SetIpv4StackInstall(
false);
127 internet.Install(rxNode);
132 rxNode->AddDevice(rxDev);
136 rxNode->AddDevice(rxSix);
137 rxSix->SetNetDevice(rxDev);
140 ipv6->AddInterface(rxDev);
141 uint32_t netdev_idx = ipv6->AddInterface(rxSix);
144 ipv6->AddAddress(netdev_idx, ipv6Addr);
145 ipv6->SetUp(netdev_idx);
150 internet.Install(txNode);
155 txNode->AddDevice(txDev);
159 txNode->AddDevice(txSix);
160 txSix->SetNetDevice(txDev);
163 ipv6->AddInterface(txDev);
164 uint32_t netdev_idx = ipv6->AddInterface(txSix);
167 ipv6->AddAddress(netdev_idx, ipv6Addr);
168 ipv6->SetUp(netdev_idx);
173 rxDev->SetChannel(channel1);
174 txDev->SetChannel(channel1);
178 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket();
185 Ptr<Socket> txSocket = txSocketFactory->CreateSocket();
186 txSocket->SetAllowBroadcast(
true);
192 uint8_t rxBuffer[180];
193 uint8_t txBuffer[180] =
"\"Can you tell me where my country lies?\" \\ said the unifaun to his "
194 "true love's eyes. \\ \"It lies with me!\" cried the Queen of Maybe \\ "
195 "- for her merchandise, he traded in his prize.";
void ReceivePkt(Ptr< Socket > socket)
Packet receive function.
void SendData(Ptr< Socket > socket, std::string to)
Send data function.
void DoRun() override
Implementation to actually run this TestCase.
void DoSendData(Ptr< Socket > socket, std::string to)
Send data function.
void ReceivePacket(Ptr< Socket > socket, Ptr< Packet > packet, const Address &from)
Packet receive function.
Ptr< Packet > m_receivedPacket
received packet
a polymophic address class
Hold variables of type enum.
aggregate IP/TCP/UDP functionality to existing Nodes.
Describes an IPv6 address.
Access to the IPv6 forwarding table, interfaces, and configuration.
IPv6 address associated with an interface.
Describes an IPv6 prefix.
static Mac48Address ConvertFrom(const Address &address)
static Mac48Address Allocate()
Allocate a new Mac48Address.
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.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
API to create UDP socket instances.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
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...
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_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.
static SixlowpanHc1TestSuite g_sixlowpanHc1TestSuite
Static variable for test initialization.