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.";
132 Ptr<Node> rxNode = CreateObject<Node> ();
136 rxDev = CreateObject<SimpleNetDevice> ();
137 rxDev->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
150 ipv6->
SetUp (netdev_idx);
154 Ptr<Node> txNode = CreateObject<Node> ();
158 txDev = CreateObject<SimpleNetDevice> ();
159 txDev->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
172 ipv6->
SetUp (netdev_idx);
192 SendData (txSocket,
"2001:0100::1");
194 uint8_t rxBuffer [180];
195 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.";
201 Simulator::Destroy ();
void SendData(Ptr< Socket > socket, std::string to)
void DoSendData(Ptr< Socket > socket, std::string to)
Access to the IPv6 forwarding table, interfaces, and configuration.
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
void ReceivePacket(Ptr< Socket > socket)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
void ReceivePkt(Ptr< Socket > socket)
IPv6 address associated with an interface.
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.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
virtual Ptr< Socket > CreateSocket(void)=0
void SetNetDevice(Ptr< NetDevice > device)
Setup SixLowPan to be a proxy for the specified NetDevice.
virtual void DoRun(void)
Implementation to actually run this TestCase.
a polymophic address class
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void AggregateObject(Ptr< Object > other)
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.
SixlowpanIphcTestSuite g_sixlowpanIphcTestSuite
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)
Associate a NetDevice to this node.
uint32_t GetId(void) const
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
virtual void SetAddress(Address address)
Set the address of this interface.
Ptr< Packet > m_receivedPacket
Time Seconds(double value)
Construct a Time in the indicated unit.
void RemoveAllByteTags(void)
Remove all byte tags stored in this packet.
virtual void RegisterOptions()
Register the IPv6 Options.
Describes an IPv6 prefix.
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 ReceivePacket(Ptr< Socket > socket, Ptr< Packet > packet, const Address &from)
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
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.