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"
68 ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0);
90 ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
111 virtual void DoRun (
void);
124 uint32_t availableData;
133 Ptr<Node> rxNode = CreateObject<Node> ();
144 Simulator::Destroy ();
152 virtual void DoRun (
void);
165 uint32_t availableData;
171 (void) availableData;
177 Ptr<Node> rxNode = CreateObject<Node> ();
188 Simulator::Destroy ();
200 virtual void DoRun (
void);
210 :
TestCase (
"UDP socket implementation")
226 uint32_t availableData;
234 uint32_t availableData;
253 Simulator::ScheduleWithContext (socket->
GetNode ()->
GetId (), Seconds (0),
264 Ptr<Node> rxNode = CreateObject<Node> ();
268 rxDev1 = CreateObject<SimpleNetDevice> ();
269 rxDev1->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
275 ipv4->
SetUp (netdev_idx);
279 rxDev2 = CreateObject<SimpleNetDevice> ();
280 rxDev2->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
286 ipv4->
SetUp (netdev_idx);
290 Ptr<Node> txNode = CreateObject<Node> ();
294 txDev1 = CreateObject<SimpleNetDevice> ();
295 txDev1->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
301 ipv4->
SetUp (netdev_idx);
305 txDev2 = CreateObject<SimpleNetDevice> ();
306 txDev2->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
312 ipv4->
SetUp (netdev_idx);
351 SendData (txSocket,
"255.255.255.255");
368 SendData (txSocket,
"255.255.255.255");
377 txSocket->BindToNetDevice (txDev1);
379 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");
382 m_receivedPacket->RemoveAllByteTags ();
385 Simulator::Destroy ();
397 virtual void DoRun (
void);
407 :
TestCase (
"UDP6 socket implementation")
423 uint32_t availableData;
429 (void) availableData;
434 uint32_t availableData;
440 (void) availableData;
456 Simulator::ScheduleWithContext (socket->
GetNode ()->
GetId (), Seconds (0),
467 Ptr<Node> rxNode = CreateObject<Node> ();
471 rxDev1 = CreateObject<SimpleNetDevice> ();
472 rxDev1->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
478 ipv6->
SetUp (netdev_idx);
481 rxDev2 = CreateObject<SimpleNetDevice> ();
482 rxDev2->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
488 ipv6->
SetUp (netdev_idx);
492 Ptr<Node> txNode = CreateObject<Node> ();
496 txDev1 = CreateObject<SimpleNetDevice> ();
497 txDev1->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
503 ipv6->
SetUp (netdev_idx);
507 txDev2 = CreateObject<SimpleNetDevice> ();
508 txDev2->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
514 ipv6->
SetUp (netdev_idx);
543 SendData (txSocket,
"2001:0100::1");
560 txSocket->BindToNetDevice (txDev1);
568 Simulator::Destroy ();