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"
177main(
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");
250 Ipv4RoutingHelper::PrintNeighborCacheAllAt(
Seconds(0), outputStream);
251 Ipv4RoutingHelper::PrintNeighborCacheAllAt(
Seconds(1), outputStream);
252 Ipv4RoutingHelper::PrintNeighborCacheAllAt(
Seconds(2), outputStream);
270 Ipv6RoutingHelper::PrintNeighborCacheAllAt(
Seconds(0), outputStream);
271 Ipv6RoutingHelper::PrintNeighborCacheAllAt(
Seconds(1), outputStream);
272 Ipv6RoutingHelper::PrintNeighborCacheAllAt(
Seconds(2), outputStream);
275 Simulator::Stop(
Seconds(10.0));
277 Simulator::Destroy();
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.
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.
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.
Hold variables of type string.
AttributeValue implementation for Time.
#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)