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/socket.h" 
   28#include "ns3/boolean.h" 
   32#include "ns3/inet6-socket-address.h" 
   33#include "ns3/internet-stack-helper.h" 
   35#include "ns3/sixlowpan-net-device.h" 
   68  virtual void DoRun (
void);
 
   88  : 
TestCase (
"Sixlowpan implementation")
 
  105  (void) availableData;
 
  112  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.";
 
  136  Ptr<Node> rxNode = CreateObject<Node> ();
 
  140    rxDev = CreateObject<SimpleNetDevice> ();
 
  141    rxDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
 
  145    rxSix->SetAttribute (
"ForceEtherType", 
BooleanValue (
true) );
 
  148    rxSix->SetNetDevice (rxDev);
 
  151    ipv6->AddInterface (rxDev);
 
  152    uint32_t netdev_idx = ipv6->AddInterface (rxSix);
 
  154    ipv6->AddAddress (netdev_idx, ipv6Addr);
 
  155    ipv6->SetUp (netdev_idx);
 
  159  Ptr<Node> txNode = CreateObject<Node> ();
 
  163    txDev = CreateObject<SimpleNetDevice> ();
 
  164    txDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
 
  168    txSix->SetAttribute (
"ForceEtherType", 
BooleanValue (
true) );
 
  171    txSix->SetNetDevice (txDev);
 
  174    ipv6->AddInterface (txDev);
 
  175    uint32_t netdev_idx = ipv6->AddInterface (txSix);
 
  177    ipv6->AddAddress (netdev_idx, ipv6Addr);
 
  178    ipv6->SetUp (netdev_idx);
 
  183  rxDev->SetChannel (channel1);
 
  184  txDev->SetChannel (channel1);
 
  188  Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
 
  193  Ptr<Socket> txSocket = txSocketFactory->CreateSocket ();
 
  194  txSocket->SetAllowBroadcast (
true);
 
  198  SendData (txSocket, 
"2001:0100::1");
 
  200  uint8_t rxBuffer [180];
 
  201  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.";
 
  207  Simulator::Destroy ();
 
void ReceivePkt(Ptr< Socket > socket)
Packet receive function.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void SendData(Ptr< Socket > socket, std::string to)
Send data function.
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
AttributeValue implementation for Boolean.
aggregate IP/TCP/UDP functionality to existing Nodes.
void SetIpv4StackInstall(bool enable)
Enable/disable IPv4 stack install.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Describes an IPv6 address.
Access to the IPv6 forwarding table, interfaces, and configuration.
IPv6 address associated with an interface.
Describes an IPv6 prefix.
uint32_t GetId(void) const
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void RemoveAllByteTags(void)
Remove all byte tags stored in this packet.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this 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,...
#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, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static SixlowpanHc1TestSuite g_sixlowpanHc1TestSuite
Static variable for test initialization.