23 #include "ns3/packet.h"
25 #include "ipv6-interface.h"
26 #include "ns3/net-device.h"
27 #include "loopback-net-device.h"
28 #include "ipv6-l3-protocol.h"
29 #include "icmpv6-l4-protocol.h"
30 #include "ndisc-cache.h"
37 NS_OBJECT_ENSURE_REGISTERED (Ipv6Interface);
55 m_baseReachableTime (0),
86 if (!DynamicCast<LoopbackNetDevice> (
m_device))
97 NS_ASSERT_MSG (
false,
"IPv6 autoconf for this kind of address not implemented.");
193 if ((*it).GetAddress () == addr)
206 if (icmpv6 && icmpv6->IsAlwaysDad ())
226 if ((*it).GetAddress ().IsLinkLocal ())
231 NS_ASSERT_MSG (
false,
"No link-local address on interface " <<
this);
271 NS_ASSERT_MSG (
false,
"Try to remove index that don't exist in Ipv6Interface::RemoveAddress");
321 if (DynamicCast<LoopbackNetDevice> (
m_device))
333 if (dest == (*it).GetAddress ())
357 NS_ASSERT_MSG (
m_device->IsMulticast (),
"Ipv6Interface::SendTo (): Sending multicast packet over non-multicast device");
359 hardwareDestination =
m_device->GetMulticast (dest);
435 if ((*it).GetAddress () == address)
437 (*it).SetState (state);
450 if ((*it).GetAddress () == address)
452 (*it).SetNsDadUid (uid);
bool IsMatch(Ipv6Address a, Ipv6Address b) const
If the Address match the type.
Ipv6InterfaceAddressList m_addresses
The addresses assigned to this interface.
bool IsAny() const
If the IPv6 address is the "Any" address.
static bool IsMatchingType(const Address &address)
bool m_ifup
The state of this interface.
bool AddAddress(Ipv6InterfaceAddress iface)
Add an IPv6 address.
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
void SetState(Ipv6Address address, Ipv6InterfaceAddress::State_e state)
Update state of an interface address.
void SetUp()
Enable this interface.
uint16_t GetRetransTimer() const
Get the retransmission timer.
bool m_forwarding
Forwarding state.
IPv6 layer implementation.
#define NS_ASSERT(condition)
Ipv6InterfaceAddress GetAddress(uint32_t index) const
Get an address from IPv6 interface.
#define NS_LOG_COMPONENT_DEFINE(name)
IPv6 address associated with an interface.
Ptr< NetDevice > m_device
NetDevice associated with this interface.
void SetDevice(Ptr< NetDevice > device)
Set the NetDevice.
void SetReachableTime(uint16_t reachableTime)
Set the reachable time.
virtual void DoDispose(void)
#define NS_LOG_FUNCTION_NOARGS()
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
bool IsUp() const
Is the interface UP ?
bool IsDown() const
Is the interface DOWN ?
a polymophic address class
void SetBaseReachableTime(uint16_t baseReachableTime)
Set the base reachable time.
static void FunctionDadTimeout(Ptr< Icmpv6L4Protocol > icmpv6, Ipv6Interface *interface, Ipv6Address addr)
Function called when DAD timeout.
uint16_t m_baseReachableTime
Base value used for computing the random reachable time value (in millisecond).
uint16_t GetBaseReachableTime() const
Get the base reachable time.
Ipv6Address GetAddress() const
Get the IPv6 address.
uint32_t GetNAddresses(void) const
Get number of addresses on this IPv6 interface.
void SetMetric(uint16_t metric)
Set the metric.
Ptr< Node > m_node
Node associated with this interface.
virtual ~Ipv6Interface()
Destructor.
void SetRetransTimer(uint16_t retransTimer)
Set the retransmission timer.
uint16_t m_retransTimer
Retransmission timer (in millisecond). Time between retransmission of NS.
static TypeId GetTypeId()
Get the type ID.
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
Ipv6Prefix GetPrefix() const
Get the IPv6 prefix.
void Send(Ptr< Packet > p, Ipv6Address dest)
Send a packet through this interface.
#define NS_LOG_LOGIC(msg)
void SetNsDadUid(Ipv6Address address, uint32_t uid)
Update NS DAD packet UID of an interface address.
static Mac48Address ConvertFrom(const Address &address)
void SetNode(Ptr< Node > node)
Set node associated with interface.
void SetForwarding(bool forward)
Set forwarding enabled or not.
uint8_t m_curHopLimit
Current hop limit.
void SetCurHopLimit(uint8_t curHopLimit)
Set the current hop limit.
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
#define NS_ASSERT_MSG(condition, message)
void DoDAD(Ipv6Address target, Ptr< Ipv6Interface > interface)
Do the Duplication Address Detection (DAD). It consists in sending a NS with our IPv6 as target...
Ipv6InterfaceAddress GetLinkLocalAddress() const
Get link-local address from IPv6 interface.
uint8_t GetCurHopLimit() const
Get the current hop limit value.
Describes an IPv6 address.
uint16_t GetMetric() const
Get the metric.
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
State_e
State of an address associated with an interface.
void DoSetup()
Initialize interface.
uint16_t m_reachableTime
Reachable time (in millisecond). The time a neighbor is considered reachable after receiving a reacha...
bool IsForwarding() const
If the interface allows forwarding packets.
Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
uint16_t GetReachableTime() const
Get the reachable time.
Ipv6InterfaceAddress RemoveAddress(uint32_t index)
Remove an address from interface.
a base class which provides memory management and object aggregation
virtual void DoDispose()
Dispose this object.
uint16_t m_metric
The metric.
bool IsLocalhost() const
If the IPv6 address is localhost (::1).
Ptr< T > GetObject(void) const
void SetDown()
Disable this interface.
a unique identifier for an interface.
Ipv6InterfaceAddress GetAddressMatchingDestination(Ipv6Address dst)
Get an address which is in the same network prefix as destination.
static Ipv6Address MakeAutoconfiguredLinkLocalAddress(Mac48Address mac)
Make the autoconfigured link-local IPv6 address with Mac48Address.
TypeId SetParent(TypeId tid)
Ptr< NdiscCache > m_ndCache
Neighbor cache.
static const uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
Ipv6Interface()
Constructs an Ipv6Interface.