69#include "ns3/applications-module.h"
70#include "ns3/core-module.h"
71#include "ns3/csma-module.h"
72#include "ns3/internet-apps-module.h"
73#include "ns3/internet-module.h"
74#include "ns3/mobility-module.h"
75#include "ns3/network-module.h"
76#include "ns3/point-to-point-module.h"
78#include "ns3/wifi-helper.h"
79#include "ns3/yans-wifi-helper.h"
88 node->GetObject<
Ipv6>()->SetDown(interface);
94 node->GetObject<
Ipv6>()->
SetUp(interface);
98main(
int argc,
char* argv[])
103 bool enablePcap =
false;
104 cmd.AddValue(
"verbose",
"Turn on the logs",
verbose);
105 cmd.AddValue(
"enablePcap",
"Enable/Disable pcap file generation", enablePcap);
107 cmd.Parse(argc, argv);
133 NS_LOG_INFO(
"Create networks and assign IPv6 Addresses.");
144 NS_LOG_INFO(
"Assign static IP address to the third node.");
146 int32_t ifIndex = ipv6proto->GetInterfaceForDevice(
devices.Get(3));
149 ipv6proto->AddAddress(ifIndex, ipv6Addr);
151 NS_LOG_INFO(
"Assign static IP address to the router node.");
181 serverNetDevices.
Add(nonRouterDevices.
Get(0));
206 csma.EnablePcapAll(
"dhcp6-csma");
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
ApplicationContainer Install(NodeContainer c)
Install an application on each node of the input container configured with all the attributes set wit...
AttributeValue implementation for Boolean.
Parse command-line arguments.
build a set of CsmaNetDevice objects
The helper class used to configure and install DHCPv6 applications on nodes.
void SetServerAttribute(std::string name, const AttributeValue &value)
Set DHCPv6 server attributes.
ApplicationContainer InstallDhcp6Client(NodeContainer clientNodes) const
Install DHCPv6 client on a set of nodes.
ApplicationContainer InstallDhcp6Server(NetDeviceContainer netDevices)
Install DHCPv6 server on a node / NetDevice.
static void Bind(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Helper class to auto-assign global IPv6 unicast addresses.
Ipv6InterfaceContainer AssignWithoutAddress(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer but do not assign any IPv6 addresses.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
Describes an IPv6 address.
Access to the IPv6 forwarding table, interfaces, and configuration.
IPv6 address associated with an interface.
Keep track of a set of IPv6 interfaces.
void SetForwarding(uint32_t i, bool state)
Set the state of the stack (act as a router or as an host) for the specified index.
uint32_t GetInterfaceIndex(uint32_t i) const
Get the interface index for the specified node index.
Describes an IPv6 prefix.
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
Radvd application helper.
void AddAnnouncedPrefix(uint32_t interface, const Ipv6Address &prefix, uint32_t prefixLength, bool slaac=true)
Add a new prefix to be announced through an interface.
Ptr< RadvdInterface > GetRadvdInterface(uint32_t interface)
Get the low-level RadvdInterface specification for an interface.
void SetManagedFlag(bool managedFlag)
Set managed flag.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
void SetInterfaceUp(Ptr< Node > node, uint32_t interface)
void SetInterfaceDown(Ptr< Node > node, uint32_t interface)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
@ LOG_LEVEL_INFO
LOG_INFO and above.
void SetUp(char *deviceName)