|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
23 #include "ns3/packet.h"
24 #include "ns3/net-device.h"
25 #include "ns3/mac16-address.h"
26 #include "ns3/mac64-address.h"
27 #include "ns3/traffic-control-layer.h"
48 .SetGroupName (
"Internet")
62 m_baseReachableTime (0),
93 if (!DynamicCast<LoopbackNetDevice> (
m_device))
204 if (it->first.GetAddress () == addr)
211 m_addresses.push_back (std::make_pair (iface, solicited));
222 if (icmpv6->IsAlwaysDad ())
301 NS_FATAL_ERROR (
"Removing index that does not exist in Ipv6Interface::RemoveAddress");
333 if(it->first.GetAddress () ==
address)
375 if (DynamicCast<LoopbackNetDevice> (
m_device))
390 if (dest == it->first.GetAddress ())
495 if (it->first.GetAddress () ==
address)
497 it->first.SetState (state);
510 if (it->first.GetAddress () ==
address)
512 it->first.SetNsDadUid (uid);
bool IsLocalhost() const
If the IPv6 address is localhost (::1).
a unique identifier for an interface.
bool IsMatch(Ipv6Address a, Ipv6Address b) const
If the Address match the type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ipv6Prefix GetPrefix() const
Get the IPv6 prefix.
virtual bool IsMulticast(void) const =0
IPv6 address associated with an interface.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void SetNsDadUid(Ipv6Address address, uint32_t uid)
Update NS DAD packet UID of an interface address.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void Flush()
Flush the cache.
static uint16_t GetStaticProtocolNumber()
Get ICMPv6 protocol number.
void SetCurHopLimit(uint8_t curHopLimit)
Set the current hop limit.
void AddHeader(const Header &header)
Add header to this packet.
virtual Address GetAddress(void) const =0
void SetTrafficControl(Ptr< TrafficControlLayer > tc)
Set the TrafficControlLayer.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ipv6Address GetAddress() const
Get the IPv6 address.
uint16_t GetReachableTime() const
Get the reachable time.
static Ipv6Address MakeSolicitedAddress(Ipv6Address addr)
Make the solicited IPv6 address.
void SetNode(Ptr< Node > node)
Set node associated with interface.
uint8_t m_curHopLimit
Current hop limit.
uint16_t m_reachableTime
Reachable time (in millisecond).
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > >::iterator Ipv6InterfaceAddressListI
Container Iterator for the Ipv6InterfaceAddresses.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
uint16_t GetBaseReachableTime() const
Get the base reachable time.
IPv6 layer implementation.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Describes an IPv6 address.
@ PACKET_HOST
Packet addressed oo us.
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > >::const_iterator Ipv6InterfaceAddressListCI
Const Container Iterator for the Ipv6InterfaceAddresses.
Ipv6InterfaceAddress GetAddress(uint32_t index) const
Get an address from IPv6 interface.
State_e
State of an address associated with an interface.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
void DoSetup()
Initialize interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ipv6InterfaceAddress GetAddressMatchingDestination(Ipv6Address dst)
Get an address which is in the same network prefix as destination.
void FunctionDadTimeout(Ipv6Interface *interface, Ipv6Address addr)
Function called when DAD timeout.
uint8_t GetCurHopLimit() const
Get the current hop limit value.
void DoDAD(Ipv6Address target, Ptr< Ipv6Interface > interface)
Do the Duplication Address Detection (DAD).
Ipv6InterfaceAddress RemoveAddress(uint32_t index)
Remove an address from interface.
virtual void DoDispose()
Dispose this object.
Smart pointer class similar to boost::intrusive_ptr.
uint16_t GetMetric() const
Get the metric.
Ptr< NdiscCache > GetNdiscCache() const
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
uint16_t m_metric
The metric.
void SetDown()
Disable this interface.
Ptr< TrafficControlLayer > m_tc
TrafficControlLayer associated with this interface.
Ptr< NdiscCache > m_ndCache
Neighbor cache.
bool IsDown() const
Is the interface DOWN ?
a polymophic address class
void SetUp()
Enable this interface.
A base class which provides memory management and object aggregation.
Ipv6Interface()
Constructs an Ipv6Interface.
virtual bool NeedsArp(void) const =0
uint16_t GetRetransTimer() const
Get the retransmission timer.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)=0
bool AddAddress(Ipv6InterfaceAddress iface)
Add an IPv6 address.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
static const uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
bool IsForwarding() const
If the interface allows forwarding packets.
virtual Address GetMulticast(Ipv4Address multicastGroup) const =0
Make and return a MAC multicast address using the provided multicast group.
Ipv6InterfaceAddress GetLinkLocalAddress() const
Get link-local address from IPv6 interface.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Ipv6InterfaceAddressList m_addresses
The addresses assigned to this interface.
bool m_ifup
The state of this interface.
void SetState(Ipv6Address address, Ipv6InterfaceAddress::State_e state)
Update state of an interface address.
void SetBaseReachableTime(uint16_t baseReachableTime)
Set the base reachable time.
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
Ptr< NetDevice > m_device
NetDevice associated with this interface.
void SetDevice(Ptr< NetDevice > device)
Set the NetDevice.
static Ipv6Address MakeAutoconfiguredLinkLocalAddress(Address mac)
Make the autoconfigured link-local IPv6 address from a Mac address.
bool m_forwarding
Forwarding state.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetMetric(uint16_t metric)
Set the metric.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
void SetReachableTime(uint16_t reachableTime)
Set the reachable time.
void SetRetransTimer(uint16_t retransTimer)
Set the retransmission timer.
Access to the IPv6 forwarding table, interfaces, and configuration.
uint16_t m_retransTimer
Retransmission timer (in millisecond).
void Send(Ptr< Packet > p, const Ipv6Header &hdr, Ipv6Address dest)
Send a packet through this interface.
virtual Address GetBroadcast(void) const =0
uint16_t m_baseReachableTime
Base value used for computing the random reachable time value (in millisecond).
bool IsUp() const
Is the interface UP ?
bool IsAny() const
If the IPv6 address is the "Any" address.
bool IsSolicitedMulticastAddress(Ipv6Address address) const
Checks if the address is a Solicited Multicast address for this interface.
virtual Ptr< IpL4Protocol > GetProtocol(int protocolNumber) const =0
Get L4 protocol by protocol number.
virtual ~Ipv6Interface()
Destructor.
Describes an IPv6 prefix.
static TypeId GetTypeId()
Get the type ID.
void SetForwarding(bool forward)
Set forwarding enabled or not.
Ptr< Node > m_node
Node associated with this interface.
virtual void DoDispose(void)
Destructor implementation.
Ipv6InterfaceAddress m_linkLocalAddress
The link-local addresses assigned to this interface.
uint32_t GetNAddresses(void) const
Get number of addresses on this IPv6 interface.