138 #include "ns3/core-module.h"
139 #include "ns3/csma-module.h"
140 #include "ns3/internet-module.h"
141 #include "ns3/network-module.h"
151 std::cout <<
"\nArp caches after add address 10.1.1.4 to n1" << std::endl;
158 std::cout <<
"\nNdisc caches after add address 2001:1::200:ff:fe00:4 n1" << std::endl;
165 std::cout <<
"\nArp caches after remove the first address (10.1.1.1) from n1" << std::endl;
172 std::cout <<
"\nNdisc caches after remove the second address (2001:1::200:ff:fe00:1) from n1"
177 main(
int argc,
char* argv[])
179 bool useIpv6 =
false;
180 bool enableLog =
false;
183 cmd.AddValue(
"useIPv6",
"Use IPv6 instead of IPv4", useIpv6);
184 cmd.AddValue(
"enableLog",
"Enable ArpL3Protocol and Icmpv6L4Protocol logging", enableLog);
185 cmd.Parse(argc, argv);
207 stack.SetIpv6StackInstall(
false);
211 stack.SetIpv4StackInstall(
false);
218 address.SetBase(
"10.1.1.0",
"255.255.255.0");
239 uint32_t ipv4ifIndex = 1;
246 uint32_t addressIndex = 0;
258 uint32_t ipv6ifIndex = 1;
266 uint32_t addressIndex = 1;
Parse command-line arguments.
build a set of CsmaNetDevice objects
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
a class to store IPv4 address information on an interface
holds a vector of std::pair of Ptr<Ipv4> and interface index.
bool AddAddress(Ipv4InterfaceAddress address)
Ipv4InterfaceAddress RemoveAddress(uint32_t index)
Implement the IPv4 layer.
static void PrintNeighborCacheAllAt(Time printTime, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of all nodes at a particular time.
Helper class to auto-assign global IPv6 unicast addresses.
Describes an IPv6 address.
IPv6 address associated with an interface.
Keep track of a set of IPv6 interfaces.
Ipv6InterfaceAddress RemoveAddress(uint32_t index)
Remove an address from interface.
bool AddAddress(Ipv6InterfaceAddress iface)
Add an IPv6 address.
IPv6 layer implementation.
Describes an IPv6 prefix.
static void PrintNeighborCacheAllAt(Time printTime, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of all nodes at a particular time.
A helper class to populate neighbor cache.
void PopulateNeighborCache()
Populate neighbor ARP and NDISC caches for all devices.
void SetDynamicNeighborCache(bool enable)
Enable/disable dynamic neighbor cache, auto-generated neighbor cache will update by IP addresses chan...
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
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.
@ LOG_LEVEL_LOGIC
LOG_LOGIC and above.
void RemoveIpv6Address(Ptr< Ipv6Interface > ipv6Interface, uint32_t index)
void AddIpv6Address(Ptr< Ipv6Interface > ipv6Interface, Ipv6InterfaceAddress ifaceAddr)
void RemoveIpv4Address(Ptr< Ipv4Interface > ipv4Interface, uint32_t index)
void AddIpv4Address(Ptr< Ipv4Interface > ipv4Interface, Ipv4InterfaceAddress ifaceAddr)