21 #include "ns3/assert.h"
25 #include "ns3/net-device.h"
26 #include "ns3/loopback-net-device.h"
27 #include "ns3/mac16-address.h"
28 #include "ns3/mac48-address.h"
29 #include "ns3/mac64-address.h"
31 #include "ns3/ipv6-address-generator.h"
32 #include "ns3/traffic-control-helper.h"
33 #include "ns3/traffic-control-layer.h"
91 NS_FATAL_ERROR (
"Did not pass in a valid Mac Address (16, 48 or 64 bits)");
121 for (uint32_t i = 0; i < c.
GetN (); ++i)
126 NS_ASSERT_MSG (node,
"Ipv6AddressHelper::Allocate (): Bad node");
129 NS_ASSERT_MSG (ipv6,
"Ipv6AddressHelper::Allocate (): Bad ipv6");
132 ifIndex = ipv6->GetInterfaceForDevice (device);
135 ifIndex = ipv6->AddInterface (device);
137 NS_ASSERT_MSG (ifIndex >= 0,
"Ipv6AddressHelper::Allocate (): "
138 "Interface index not found");
141 ipv6->SetMetric (ifIndex, 1);
142 ipv6->AddAddress (ifIndex, ipv6Addr);
143 ipv6->SetUp (ifIndex);
145 retval.
Add (ipv6, ifIndex);
151 if (tc && DynamicCast<LoopbackNetDevice> (device) == 0 && tc->GetRootQueueDiscOnDevice (device) == 0)
153 NS_LOG_LOGIC (
"Installing default traffic control configuration");
165 for (uint32_t i = 0; i < c.
GetN (); ++i)
170 NS_ASSERT_MSG (node,
"Ipv6AddressHelper::Allocate (): Bad node");
173 NS_ASSERT_MSG (ipv6,
"Ipv6AddressHelper::Allocate (): Bad ipv6");
175 int32_t ifIndex = ipv6->GetInterfaceForDevice (device);
178 ifIndex = ipv6->AddInterface (device);
180 NS_ASSERT_MSG (ifIndex >= 0,
"Ipv6AddressHelper::Allocate (): "
181 "Interface index not found");
183 ipv6->SetMetric (ifIndex, 1);
185 if (withConfiguration.at (i))
188 ipv6->AddAddress (ifIndex, ipv6Addr);
191 ipv6->SetUp (ifIndex);
192 retval.
Add (ipv6, ifIndex);
198 if (tc && DynamicCast<LoopbackNetDevice> (device) == 0 && tc->GetRootQueueDiscOnDevice (device) == 0)
200 NS_LOG_LOGIC (
"Installing default traffic control configuration");
212 std::vector<bool> withConfiguration;
213 for (uint32_t i = 0; i < c.
GetN (); ++i)
215 withConfiguration.push_back (
false);
217 return Assign (c, withConfiguration);
static bool IsMatchingType(const Address &address)
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
QueueDiscContainer Install(NetDeviceContainer c)
Keep track of a set of IPv6 interfaces.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Access to the IPv6 forwarding table, interfaces, and configuration.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Traffic control layer definition.
static Mac16Address ConvertFrom(const Address &address)
static bool IsMatchingType(const Address &address)
void Add(Ptr< Ipv6 > ipv6, uint32_t interface)
Add a couple IPv6/interface.
static Ipv6Address MakeAutoconfiguredAddress(Mac16Address addr, Ipv6Address prefix)
Make the autoconfigured IPv6 address with Mac16Address.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
IPv6 address associated with an interface.
static Ipv6Address NextNetwork(const Ipv6Prefix prefix)
Get the next network according to the given Ipv6Prefix.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
a polymophic address class
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
static void Init(const Ipv6Address net, const Ipv6Prefix prefix, const Ipv6Address interfaceId="::1")
Initialise the base network and interfaceId for the generator.
holds a vector of ns3::NetDevice pointers
Build a set of QueueDisc objects.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
static Mac48Address ConvertFrom(const Address &address)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Describes an IPv6 address.
static Mac64Address ConvertFrom(const Address &address)
Describes an IPv6 prefix.
static bool AddAllocated(const Ipv6Address addr)
Add the Ipv6Address to the list of IPv6 entries.
static TrafficControlHelper Default(void)
static bool IsMatchingType(const Address &address)
Ipv6InterfaceContainer AssignWithoutAddress(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer but do not assign any IPv6 addresses.
static Ipv6Address NextAddress(const Ipv6Prefix prefix)
Allocate the next Ipv6Address for the configured network and prefix.
Ipv6AddressHelper()
Constructor.
void NewNetwork(void)
Allocate a new network.
static Ipv6Address GetNetwork(const Ipv6Prefix prefix)
Get the current network of the given Ipv6Prefix.
Ipv6Address NewAddress(void)
Allocate a new Ipv6Address with interface ID equal to the next one in the underlying generator...