22 #include "ns3/socket-factory.h"
23 #include "ns3/udp-socket-factory.h"
24 #include "ns3/simulator.h"
25 #include "ns3/simple-channel.h"
26 #include "ns3/simple-net-device.h"
27 #include "ns3/drop-tail-queue.h"
28 #include "ns3/socket.h"
29 #include "ns3/boolean.h"
33 #include "ns3/inet6-socket-address.h"
35 #include "ns3/ipv6-l3-protocol.h"
36 #include "ns3/icmpv6-l4-protocol.h"
37 #include "ns3/udp-l4-protocol.h"
38 #include "ns3/ipv6-list-routing.h"
39 #include "ns3/ipv6-static-routing.h"
41 #include "ns3/sixlowpan-net-device.h"
57 ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
74 void DoSendData (
Ptr<Socket> socket, std::string to);
78 virtual void DoRun (
void);
86 :
TestCase (
"Sixlowpan implementation")
97 uint32_t availableData;
103 (void) availableData;
110 uint8_t buffer [] =
"\"Can you tell me where my country lies?\" \\ said the unifaun to his true love's eyes. \\ \"It lies with me!\" cried the Queen of Maybe \\ - for her merchandise, he traded in his prize.";
121 Simulator::ScheduleWithContext (socket->
GetNode ()->
GetId (), Seconds (0),
132 Ptr<Node> rxNode = CreateObject<Node> ();
136 rxDev = CreateObject<SimpleNetDevice> ();
137 rxDev->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
151 ipv6->
SetUp (netdev_idx);
155 Ptr<Node> txNode = CreateObject<Node> ();
159 txDev = CreateObject<SimpleNetDevice> ();
160 txDev->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
174 ipv6->
SetUp (netdev_idx);
194 SendData (txSocket,
"2001:0100::1");
196 uint8_t rxBuffer [180];
197 uint8_t txBuffer [180] =
"\"Can you tell me where my country lies?\" \\ said the unifaun to his true love's eyes. \\ \"It lies with me!\" cried the Queen of Maybe \\ - for her merchandise, he traded in his prize.";
203 Simulator::Destroy ();
Access to the IPv6 forwarding table, interfaces, and configuration.
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
void DoSendData(Ptr< Socket > socket, std::string to)
virtual void DoRun(void)
Implementation to actually run this TestCase.
void ReceivePacket(Ptr< Socket > socket)
#define NS_ASSERT(condition)
IPv6 address associated with an interface.
uint32_t GetSize(void) const
virtual Ptr< Socket > CreateSocket(void)=0
void SetNetDevice(Ptr< NetDevice > device)
Setup SixLowPan to be a proxy for the specified NetDevice.
a polymophic address class
static void AddInternetStack6(Ptr< Node > node)
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void AggregateObject(Ptr< Object > other)
SixlowpanHc1TestSuite g_sixlowpanHc1TestSuite
void SendData(Ptr< Socket > socket, std::string to)
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
Add a NetDevice interface.
virtual void RegisterExtensions()
Register the IPv6 Extensions.
Describes an IPv6 address.
void SetRoutingProtocol(Ptr< Ipv6RoutingProtocol > routingProtocol)
Set routing protocol for this stack.
uint32_t AddDevice(Ptr< NetDevice > device)
uint32_t GetId(void) const
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
void ReceivePacket(Ptr< Socket > socket, Ptr< Packet > packet, const Address &from)
virtual void SetAddress(Address address)
Set the address of this interface.
void RemoveAllByteTags(void)
Remove all byte tags stored in this packet.
virtual void RegisterOptions()
Register the IPv6 Options.
Describes an IPv6 prefix.
void ReceivePkt(Ptr< Socket > socket)
virtual bool AddAddress(uint32_t interface, Ipv6InterfaceAddress address)=0
Add an address on the specified IPv6 interface.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
API to create UDP socket instances.
This test suite implements a Unit Test.
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
Ptr< Packet > m_receivedPacket
virtual void SetUp(uint32_t interface)=0
Set the interface into the "up" state.
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.