21 #include "ns3/assert.h"
25 #include "ns3/net-device.h"
26 #include "ns3/mac48-address.h"
28 #include "ns3/ipv6-address-generator.h"
30 #include "ipv6-address-helper.h"
108 for (uint32_t i = 0; i < c.
GetN (); ++i)
113 NS_ASSERT_MSG (node,
"Ipv6AddressHelper::Allocate (): Bad node");
116 NS_ASSERT_MSG (ipv6,
"Ipv6AddressHelper::Allocate (): Bad ipv6");
119 ifIndex = ipv6->GetInterfaceForDevice (device);
122 ifIndex = ipv6->AddInterface (device);
124 NS_ASSERT_MSG (ifIndex >= 0,
"Ipv6AddressHelper::Allocate (): "
125 "Interface index not found");
128 ipv6->SetMetric (ifIndex, 1);
129 ipv6->AddAddress (ifIndex, ipv6Addr);
130 ipv6->SetUp (ifIndex);
132 retval.
Add (ipv6, ifIndex);
141 for (uint32_t i = 0; i < c.
GetN (); ++i)
146 NS_ASSERT_MSG (node,
"Ipv6AddressHelper::Allocate (): Bad node");
149 NS_ASSERT_MSG (ipv6,
"Ipv6AddressHelper::Allocate (): Bad ipv6");
151 int32_t ifIndex = ipv6->GetInterfaceForDevice (device);
154 ifIndex = ipv6->AddInterface (device);
156 NS_ASSERT_MSG (ifIndex >= 0,
"Ipv6AddressHelper::Allocate (): "
157 "Interface index not found");
159 ipv6->SetMetric (ifIndex, 1);
161 if (withConfiguration.at (i))
164 ipv6->AddAddress (ifIndex, ipv6Addr);
167 ipv6->SetUp (ifIndex);
168 retval.
Add (ipv6, ifIndex);
177 std::vector<bool> withConfiguration;
178 for (uint32_t i = 0; i < c.
GetN (); ++i)
180 withConfiguration.push_back (
false);
182 return Assign (c, withConfiguration);
static bool IsMatchingType(const Address &address)
static Ipv6Address MakeAutoconfiguredAddress(Mac48Address addr, Ipv6Address prefix)
Make the autoconfigured IPv6 address with Mac48Address.
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
Keep track of a set of IPv6 interfaces.
Access to the IPv6 forwarding table, interfaces, and configuration.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
void Add(Ptr< Ipv6 > ipv6, uint32_t interface)
Add a couple IPv6/interface.
#define NS_LOG_COMPONENT_DEFINE(name)
IPv6 address associated with an interface.
static Ipv6Address NextNetwork(const Ipv6Prefix prefix)
Get the next network acoording 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)
fatal error handling
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<NetDevice> 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
static Mac48Address ConvertFrom(const Address &address)
#define NS_ASSERT_MSG(condition, message)
Describes an IPv6 address.
Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
static bool AddAllocated(const Ipv6Address addr)
Add the Ipv6Address to the list of IPv6 entries.
Ipv6InterfaceContainer AssignWithoutAddress(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer but do not assign any IPv6 addresses.
Ptr< T > GetObject(void) const
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...