11#include "ns3/arp-l3-protocol.h"
12#include "ns3/config.h"
13#include "ns3/icmpv4-l4-protocol.h"
14#include "ns3/icmpv6-l4-protocol.h"
15#include "ns3/inet-socket-address.h"
16#include "ns3/inet6-socket-address.h"
17#include "ns3/ipv4-l3-protocol.h"
18#include "ns3/ipv4-list-routing.h"
19#include "ns3/ipv4-static-routing.h"
20#include "ns3/ipv6-l3-protocol.h"
21#include "ns3/ipv6-list-routing.h"
22#include "ns3/ipv6-static-routing.h"
25#include "ns3/simple-channel.h"
26#include "ns3/simple-net-device.h"
27#include "ns3/simulator.h"
28#include "ns3/socket-factory.h"
29#include "ns3/tcp-l4-protocol.h"
30#include "ns3/tcp-socket-factory.h"
32#include "ns3/traffic-control-layer.h"
33#include "ns3/udp-l4-protocol.h"
34#include "ns3/uinteger.h"
53 void DoRun()
override;
112 node->AggregateObject(tc);
116 node->AggregateObject(arp);
117 arp->SetTrafficControl(tc);
123 ipv4->SetRoutingProtocol(ipv4Routing);
125 ipv4Routing->AddRoutingProtocol(ipv4staticRouting, 0);
126 node->AggregateObject(ipv4);
130 node->AggregateObject(icmp);
134 node->AggregateObject(udp);
138 node->AggregateObject(tcp);
145 ipv6->SetRoutingProtocol(ipv6Routing);
147 ipv6Routing->AddRoutingProtocol(ipv6staticRouting, 0);
148 node->AggregateObject(ipv6);
152 node->AggregateObject(icmp6);
155 ipv6->RegisterExtensions();
156 ipv6->RegisterOptions();
170 node->AddDevice(dev);
173 uint32_t ndid = ipv4->AddInterface(dev);
175 ipv4->AddAddress(ndid, ipv4Addr);
179 ndid = ipv6->AddInterface(dev);
181 ipv6->AddAddress(ndid, ipv6Addr);
205 dev0->SetChannel(channel);
206 dev1->SetChannel(channel);
211 server1 = sockFactory0->CreateSocket();
212 server2 = sockFactory0->CreateSocket();
213 server3 = sockFactory0->CreateSocket();
214 server4 = sockFactory0->CreateSocket();
260 uint16_t port1 = 5000;
261 uint16_t port2 = 5001;
262 uint16_t port3 = 5002;
263 uint16_t port4 = 5003;
310 "Accepted address is of proper type");
313 "Accepted address is correct");
318 "IPv4 socket correctly ignored IPv6 connection");
323 "Accepted address is of proper type");
326 "Accepted address is correct");
331 "Accepted address is of proper type");
334 "Accepted address is correct");
void SetUpSim()
Setup the test.
void ServerHandleConnectionCreated1(Ptr< Socket > s, const Address &addr)
Handle connection created (1).
Ptr< Socket > server4
Server socket (4).
Ptr< Socket > server2
Server socket (2).
void ServerHandleConnectionCreated3(Ptr< Socket > s, const Address &addr)
Handle connection created (3).
Address receivedAddr3
Received address (3).
Ptr< Socket > server3
Server socket (3).
void ServerHandleConnectionCreated4(Ptr< Socket > s, const Address &addr)
Handle connection created (4).
Address receivedAddr4
Received address (4).
Ptr< Socket > source1
Sending socket (1).
void ServerHandleConnectionCreated2(Ptr< Socket > s, const Address &addr)
Handle connection created (2).
Ptr< Socket > source2
Sending socket (2).
Ptr< Socket > server1
Server socket (1).
Address receivedAddr2
Received address (2).
void DoRun() override
Implementation to actually run this TestCase.
Address receivedAddr1
Received address (1).
Ptr< Socket > source3
Sending socket (3).
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
Ptr< Socket > source4
Sending socket (4).
IPv6 dual stack TestSuite.
a polymophic address class
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
static bool IsMatchingType(const Address &addr)
If the address match.
static bool IsMatchingType(const Address &address)
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Ipv4 addresses are stored in host order in this class.
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
a class to store IPv4 address information on an interface
a class to represent an Ipv4 address mask
Describes an IPv6 address.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
Access to the IPv6 forwarding table, interfaces, and configuration.
IPv6 address associated with an interface.
Describes an IPv6 prefix.
static Mac48Address ConvertFrom(const Address &address)
static Mac48Address Allocate()
Allocate a new Mac48Address.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
void SetAcceptCallback(Callback< bool, Ptr< Socket >, const Address & > connectionRequest, Callback< void, Ptr< Socket >, const Address & > newConnectionCreated)
Accept connection requests from remote hosts.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
virtual int Listen()=0
Listen for incoming connections.
API to create TCP socket instances.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static constexpr auto UNIT
Callback< R, Args... > MakeNullCallback()
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Ptr< SimpleNetDevice > AddSimpleNetDevice(Ptr< Node > node, Ipv4Address v4Addr, Ipv4Mask v4Mask, Ipv6Address v6Addr, Ipv6Prefix v6Prefix)
Ptr< Node > CreateDualStackNode()
static Ipv6DualStackTestSuite g_ipv6DualStackTestSuite
Static variable for test initialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...