26 #include "ns3/socket-factory.h"
27 #include "ns3/udp-socket-factory.h"
28 #include "ns3/simulator.h"
29 #include "ns3/simple-channel.h"
30 #include "ns3/simple-net-device.h"
31 #include "ns3/drop-tail-queue.h"
32 #include "ns3/socket.h"
36 #include "ns3/inet-socket-address.h"
37 #include "ns3/inet6-socket-address.h"
39 #include "ns3/arp-l3-protocol.h"
40 #include "ns3/ipv4-l3-protocol.h"
41 #include "ns3/ipv6-l3-protocol.h"
42 #include "ns3/icmpv4-l4-protocol.h"
43 #include "ns3/icmpv6-l4-protocol.h"
44 #include "ns3/udp-l4-protocol.h"
45 #include "ns3/tcp-l4-protocol.h"
46 #include "ns3/ipv4-list-routing.h"
47 #include "ns3/ipv4-static-routing.h"
48 #include "ns3/ipv6-list-routing.h"
49 #include "ns3/ipv6-static-routing.h"
67 ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0);
89 ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
110 virtual void DoRun (
void);
123 uint32_t availableData;
132 Ptr<Node> rxNode = CreateObject<Node> ();
136 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
140 Ptr<Socket> txSocket = rxSocketFactory->CreateSocket ();
151 virtual void DoRun (
void);
164 uint32_t availableData;
170 (void) availableData;
176 Ptr<Node> rxNode = CreateObject<Node> ();
180 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
184 Ptr<Socket> txSocket = rxSocketFactory->CreateSocket ();
199 virtual void DoRun (
void);
209 :
TestCase (
"UDP socket implementation")
225 uint32_t availableData;
233 uint32_t availableData;
263 Ptr<Node> rxNode = CreateObject<Node> ();
267 rxDev1 = CreateObject<SimpleNetDevice> ();
274 ipv4->
SetUp (netdev_idx);
278 rxDev2 = CreateObject<SimpleNetDevice> ();
285 ipv4->
SetUp (netdev_idx);
289 Ptr<Node> txNode = CreateObject<Node> ();
293 txDev1 = CreateObject<SimpleNetDevice> ();
300 ipv4->
SetUp (netdev_idx);
304 txDev2 = CreateObject<SimpleNetDevice> ();
311 ipv4->
SetUp (netdev_idx);
326 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
330 Ptr<Socket> rxSocket2 = rxSocketFactory->CreateSocket ();
350 SendData (txSocket,
"255.255.255.255");
363 rxSocket2 = rxSocketFactory->CreateSocket ();
367 SendData (txSocket,
"255.255.255.255");
376 txSocket->BindToNetDevice (txDev1);
378 NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 0,
"first socket should not receive it (it is bound specifically to the second interface's address");
381 m_receivedPacket->RemoveAllByteTags ();
396 virtual void DoRun (
void);
406 :
TestCase (
"UDP6 socket implementation")
422 uint32_t availableData;
428 (void) availableData;
433 uint32_t availableData;
439 (void) availableData;
466 Ptr<Node> rxNode = CreateObject<Node> ();
470 rxDev1 = CreateObject<SimpleNetDevice> ();
477 ipv6->
SetUp (netdev_idx);
480 rxDev2 = CreateObject<SimpleNetDevice> ();
487 ipv6->
SetUp (netdev_idx);
491 Ptr<Node> txNode = CreateObject<Node> ();
495 txDev1 = CreateObject<SimpleNetDevice> ();
502 ipv6->
SetUp (netdev_idx);
506 txDev2 = CreateObject<SimpleNetDevice> ();
513 ipv6->
SetUp (netdev_idx);
528 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
532 Ptr<Socket> rxSocket2 = rxSocketFactory->CreateSocket ();
542 SendData (txSocket,
"2001:0100::1");
555 rxSocket2 = rxSocketFactory->CreateSocket ();
559 txSocket->BindToNetDevice (txDev1);