23 #include "ns3/packet.h"
27 #include "ns3/net-device.h"
29 #include "ns3/mac16-address.h"
30 #include "ns3/mac64-address.h"
34 #include "ns3/traffic-control-layer.h"
47 .SetGroupName (
"Internet")
61 m_baseReachableTime (0),
93 if (!DynamicCast<LoopbackNetDevice> (
m_device))
117 NS_ASSERT_MSG (
false,
"IPv6 autoconf for this kind of address not implemented.");
230 if (it->first.GetAddress () == addr)
237 m_addresses.push_back (std::make_pair (iface, solicited));
249 if (icmpv6 && icmpv6->IsAlwaysDad ())
277 if (it->second == address)
321 NS_ASSERT_MSG (
false,
"Try to remove index that don't exist in Ipv6Interface::RemoveAddress");
354 if(it->first.GetAddress () ==
address)
396 if (DynamicCast<LoopbackNetDevice> (
m_device))
411 if (dest == it->first.GetAddress ())
435 NS_ASSERT_MSG (
m_device->IsMulticast (),
"Ipv6Interface::SendTo (): Sending multicast packet over non-multicast device");
437 hardwareDestination =
m_device->GetMulticast (dest);
513 if (it->first.GetAddress () ==
address)
515 it->first.SetState (state);
528 if (it->first.GetAddress () ==
address)
530 it->first.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)
static Ipv6Address GetLoopback()
Get the loopback address.
bool m_ifup
The state of this interface.
bool AddAddress(Ipv6InterfaceAddress iface)
Add an IPv6 address.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
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.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Access to the IPv6 forwarding table, interfaces, and configuration.
static Mac16Address ConvertFrom(const Address &address)
static bool IsMatchingType(const Address &address)
IPv6 layer implementation.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Ipv6InterfaceAddress GetAddress(uint32_t index) const
Get an address from IPv6 interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific 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)
Destructor implementation.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
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.
bool IsSolicitedMulticastAddress(Ipv6Address address) const
Checks if the address is a Solicited Multicast address for this interface.
static void FunctionDadTimeout(Ptr< Icmpv6L4Protocol > icmpv6, Ipv6Interface *interface, Ipv6Address addr)
Function called when DAD timeout.
Ptr< NdiscCache > GetNdiscCache() const
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.
void Send(Ptr< Packet > p, const Ipv6Header &hdr, Ipv6Address dest)
Send a packet through this interface.
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.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
virtual ~Ipv6Interface()
Destructor.
void SetRetransTimer(uint16_t retransTimer)
Set the retransmission timer.
void Flush()
Flush the cache.
uint16_t m_retransTimer
Retransmission timer (in millisecond).
An implementation of the ICMPv6 protocol.
static TypeId GetTypeId()
Get the type ID.
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
Ipv6Prefix GetPrefix() const
Get the IPv6 prefix.
Ipv6InterfaceAddress m_linkLocalAddress
The link-local addresses assigned to this interface.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
void SetTrafficControl(Ptr< TrafficControlLayer > tc)
Set the TrafficControlLayer.
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.
static uint16_t GetStaticProtocolNumber()
Get ICMPv6 protocol number.
void SetCurHopLimit(uint8_t curHopLimit)
Set the current hop limit.
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > >::const_iterator Ipv6InterfaceAddressListCI
Const Container Iterator for the Ipv6InterfaceAddresses.
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > >::iterator Ipv6InterfaceAddressListI
Container Iterator for the Ipv6InterfaceAddresses.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void DoDAD(Ipv6Address target, Ptr< Ipv6Interface > interface)
Do the Duplication Address Detection (DAD).
static Ipv6Address MakeAutoconfiguredLinkLocalAddress(Mac16Address mac)
Make the autoconfigured link-local IPv6 address with Mac16Address.
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.
State_e
State of an address associated with an interface.
static Mac64Address ConvertFrom(const Address &address)
void DoSetup()
Initialize interface.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
uint16_t m_reachableTime
Reachable time (in millisecond).
Time Seconds(double value)
Construct a Time in the indicated unit.
bool IsForwarding() const
If the interface allows forwarding packets.
Describes an IPv6 prefix.
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.
static bool IsMatchingType(const Address &address)
uint16_t m_metric
The metric.
Ptr< TrafficControlLayer > m_tc
TrafficControlLayer associated with this interface.
bool IsLocalhost() const
If the IPv6 address is localhost (::1).
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.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< NdiscCache > m_ndCache
Neighbor cache.
static const uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
void AddHeader(const Header &header)
Add header to this packet.
static Ipv6Address MakeSolicitedAddress(Ipv6Address addr)
Make the solicited IPv6 address.
Ipv6Interface()
Constructs an Ipv6Interface.