A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::Ipv6L3Protocol Class Reference

IPv6 layer implementation. More...

#include <ipv6-l3-protocol.h>

+ Inheritance diagram for ns3::Ipv6L3Protocol:
+ Collaboration diagram for ns3::Ipv6L3Protocol:

Public Types

enum  DropReason {
  DROP_TTL_EXPIRED = 1, DROP_NO_ROUTE, DROP_INTERFACE_DOWN, DROP_ROUTE_ERROR,
  DROP_UNKNOWN_PROTOCOL
}
 Reason why a packet has been dropped. More...

Public Member Functions

 Ipv6L3Protocol ()
 Constructor.
virtual ~Ipv6L3Protocol ()
 Destructor.
bool AddAddress (uint32_t i, Ipv6InterfaceAddress address)
 Add an address on interface.
void AddAutoconfiguredAddress (uint32_t interface, Ipv6Address network, Ipv6Prefix mask, uint8_t flags, uint32_t validTime, uint32_t preferredTime, Ipv6Address defaultRouter=Ipv6Address::GetZero())
 Add an autoconfigured address with RA information.
uint32_t AddInterface (Ptr< NetDevice > device)
 Add IPv6 interface for a device.
Ptr< SocketCreateRawSocket ()
 Create raw IPv6 socket.
void DeleteRawSocket (Ptr< Socket > socket)
 Remove raw IPv6 socket.
Ipv6InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const
 Get an address.
Ptr< Icmpv6L4ProtocolGetIcmpv6 () const
 Get ICMPv6 protocol.
Ptr< Ipv6InterfaceGetInterface (uint32_t i) const
 Get an interface.
int32_t GetInterfaceForAddress (Ipv6Address addr) const
 Get interface index which has specified IPv6 address.
int32_t GetInterfaceForDevice (Ptr< const NetDevice > device) const
 Get interface index which is on a specified net device.
int32_t GetInterfaceForPrefix (Ipv6Address addr, Ipv6Prefix mask) const
 Get interface index which match specified address/prefix.
uint16_t GetMetric (uint32_t i) const
 Get metric for an interface.
uint16_t GetMtu (uint32_t i) const
 Get MTU for an interface.
uint32_t GetNAddresses (uint32_t interface) const
 Get number of address for an interface.
Ptr< NetDeviceGetNetDevice (uint32_t i)
 Get device by index.
uint32_t GetNInterfaces () const
 Get current number of interface on this stack.
Ptr< IpL4ProtocolGetProtocol (int protocolNumber) const
 Get L4 protocol by protocol number.
Ptr< Ipv6RoutingProtocolGetRoutingProtocol () const
 Get current routing protocol used.
void Insert (Ptr< IpL4Protocol > protocol)
 Add an L4 protocol.
bool IsForwarding (uint32_t i) const
 Is interface allows forwarding ?
bool IsUp (uint32_t i) const
 Is specified interface up ?
void Receive (Ptr< NetDevice > device, Ptr< const Packet > p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
 Receive method when a packet arrive in the stack. This method removes IPv6 header and forward up to L4 protocol.
virtual void RegisterExtensions ()
 Register the IPv6 Extensions.
virtual void RegisterOptions ()
 Register the IPv6 Options.
void Remove (Ptr< IpL4Protocol > protocol)
 Remove an L4 protocol.
bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex)
 Remove an address from an interface.
void RemoveAutoconfiguredAddress (uint32_t interface, Ipv6Address network, Ipv6Prefix mask, Ipv6Address defaultRouter)
 Remove an autoconfigured address.
void Send (Ptr< Packet > packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr< Ipv6Route > route)
 Higher-level layers call this method to send a packet down the stack to the MAC and PHY layers.
void SetDefaultTtl (uint8_t ttl)
 Set the default TTL.
void SetDown (uint32_t i)
 set an interface down.
void SetForwarding (uint32_t i, bool val)
 Enable or disable forwarding on interface.
void SetMetric (uint32_t i, uint16_t metric)
 Set metric for an interface.
void SetNode (Ptr< Node > node)
 Set node for this stack.
void SetRoutingProtocol (Ptr< Ipv6RoutingProtocol > routingProtocol)
 Set routing protocol for this stack.
void SetUp (uint32_t i)
 Set an interface up.
- Public Member Functions inherited from ns3::Ipv6
 Ipv6 ()
 Constructor.
virtual ~Ipv6 ()
 Destructor.
- Public Member Functions inherited from ns3::Object
 Object ()
virtual ~Object ()
void AggregateObject (Ptr< Object > other)
void Dispose (void)
AggregateIterator GetAggregateIterator (void) const
virtual TypeId GetInstanceTypeId (void) const
template<typename T >
Ptr< T > GetObject (void) const
template<typename T >
Ptr< T > GetObject (TypeId tid) const
void Start (void)
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
void GetAttribute (std::string name, AttributeValue &value) const
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
void SetAttribute (std::string name, const AttributeValue &value)
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID of this class.

Static Public Attributes

static const uint16_t PROT_NUMBER = 0x86DD
 The protocol number for IPv6 (0x86DD).
- Static Public Attributes inherited from ns3::Ipv6
static const uint32_t IF_ANY = 0xffffffff
 Any interface magic number.

Protected Member Functions

virtual void DoDispose ()
 Dispose object.
virtual void NotifyNewAggregate ()
 Notify other components connected to the node that a new stack member is now connected.

Private Types

typedef std::list< Ptr
< Ipv6AutoconfiguredPrefix > > 
Ipv6AutoconfiguredPrefixList
typedef std::list< Ptr
< Ipv6AutoconfiguredPrefix >
>::iterator 
Ipv6AutoconfiguredPrefixListI
typedef std::list< Ptr
< Ipv6Interface > > 
Ipv6InterfaceList
typedef std::list< Ptr
< IpL4Protocol > > 
L4List_t
typedef std::list< Ptr
< Ipv6RawSocketImpl > > 
SocketList

Private Member Functions

 Ipv6L3Protocol (const Ipv6L3Protocol &o)
 Copy constructor.
uint32_t AddIpv6Interface (Ptr< Ipv6Interface > interface)
 Add an IPv6 interface to the stack.
Ipv6Header BuildHeader (Ipv6Address src, Ipv6Address dst, uint8_t protocol, uint16_t payloadSize, uint8_t ttl)
 Construct an IPv6 header.
virtual bool GetIpForward () const
 Get IPv6 forwarding state.
virtual bool GetSendIcmpv6Redirect () const
 Get the ICMPv6 Redirect sending state.
void IpForward (Ptr< Ipv6Route > rtentry, Ptr< const Packet > p, const Ipv6Header &header)
 Forward a packet.
void IpMulticastForward (Ptr< Ipv6MulticastRoute > mrtentry, Ptr< const Packet > p, const Ipv6Header &header)
 Forward a packet in multicast.
void LocalDeliver (Ptr< const Packet > p, Ipv6Header const &ip, uint32_t iif)
 Deliver a packet.
Ipv6L3Protocoloperator= (const Ipv6L3Protocol &o)
 Copy constructor.
void RouteInputError (Ptr< const Packet > p, const Ipv6Header &ipHeader, Socket::SocketErrno sockErrno)
 Fallback when no route is found.
void SendRealOut (Ptr< Ipv6Route > route, Ptr< Packet > packet, Ipv6Header const &ipHeader)
 Send packet with route.
virtual void SetIpForward (bool forward)
 Set IPv6 forwarding state.
virtual void SetSendIcmpv6Redirect (bool sendIcmpv6Redirect)
 Set the ICMPv6 Redirect sending state.
void SetupLoopback ()
 Setup loopback interface.

Private Attributes

uint8_t m_defaultTtl
 Default TTL for outgoing packets.
TracedCallback< const
Ipv6Header &, Ptr< const
Packet >, DropReason, Ptr
< Ipv6 >, uint32_t > 
m_dropTrace
 Callback to trace drop packets.
Ipv6InterfaceList m_interfaces
 List of IPv6 interfaces.
bool m_ipForward
 Forwarding packets (i.e. router mode) state.
uint32_t m_nInterfaces
 Number of IPv6 interfaces managed by the stack.
Ptr< Nodem_node
 Node attached to stack.
Ipv6AutoconfiguredPrefixList m_prefixes
 List of IPv6 prefix received from RA.
L4List_t m_protocols
 List of transport protocol.
Ptr< Ipv6RoutingProtocolm_routingProtocol
 Routing protocol.
TracedCallback< Ptr< const
Packet >, Ptr< Ipv6 >
, uint32_t > 
m_rxTrace
 Callback to trace RX (reception) packets.
bool m_sendIcmpv6Redirect
 Allow ICMPv6 Redirect sending state.
SocketList m_sockets
 List of IPv6 raw sockets.
TracedCallback< Ptr< const
Packet >, Ptr< Ipv6 >
, uint32_t > 
m_txTrace
 Callback to trace TX (transmission) packets.

Friends

class Ipv6ExtensionLooseRouting
class Ipv6L3ProtocolTestCase

Detailed Description

IPv6 layer implementation.

This class contains two distinct groups of trace sources. The trace sources 'Rx' and 'Tx' are called, respectively, immediately after receiving from the NetDevice and immediately before sending to a NetDevice for transmitting a packet. These are low level trace sources that include the Ipv6Header already serialized into the packet. In contrast, the Drop, SendOutgoing, UnicastForward, and LocalDeliver trace sources are slightly higher-level and pass around the Ipv6Header as an explicit parameter and not as part of the packet.

Definition at line 58 of file ipv6-l3-protocol.h.

Member Typedef Documentation

Definition at line 363 of file ipv6-l3-protocol.h.

Definition at line 362 of file ipv6-l3-protocol.h.

Member Enumeration Documentation

Reason why a packet has been dropped.

Enumerator:
DROP_TTL_EXPIRED 

Packet TTL has expired

DROP_NO_ROUTE 

No route to host

DROP_INTERFACE_DOWN 

Interface is down so can not send packet

DROP_ROUTE_ERROR 

Route error

DROP_UNKNOWN_PROTOCOL 

Unknown L4 protocol

Definition at line 76 of file ipv6-l3-protocol.h.

Constructor & Destructor Documentation

ns3::Ipv6L3Protocol::Ipv6L3Protocol ( )

Constructor.

Definition at line 81 of file ipv6-l3-protocol.cc.

References NS_LOG_FUNCTION_NOARGS.

ns3::Ipv6L3Protocol::~Ipv6L3Protocol ( )
virtual

Destructor.

Definition at line 87 of file ipv6-l3-protocol.cc.

References NS_LOG_FUNCTION_NOARGS.

ns3::Ipv6L3Protocol::Ipv6L3Protocol ( const Ipv6L3Protocol o)
private

Copy constructor.

Parameters
oobject to copy

Member Function Documentation

bool ns3::Ipv6L3Protocol::AddAddress ( uint32_t  i,
Ipv6InterfaceAddress  address 
)
virtual

Add an address on interface.

Parameters
iinterface index
addressto add

Implements ns3::Ipv6.

Definition at line 333 of file ipv6-l3-protocol.cc.

References ns3::Ipv6Interface::AddAddress(), GetInterface(), m_routingProtocol, ns3::Ipv6RoutingProtocol::NotifyAddAddress(), and NS_LOG_FUNCTION.

Referenced by AddAutoconfiguredAddress().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::AddAutoconfiguredAddress ( uint32_t  interface,
Ipv6Address  network,
Ipv6Prefix  mask,
uint8_t  flags,
uint32_t  validTime,
uint32_t  preferredTime,
Ipv6Address  defaultRouter = Ipv6Address::GetZero () 
)

Add an autoconfigured address with RA information.

Parameters
interfaceinterface index
networknetwork prefix
masknetwork mask
flagsflags of the prefix information option (home agent, ...)
validTimevalid time of the prefix
preferredTimepreferred time of the prefix
defaultRouterdefault router address

Definition at line 253 of file ipv6-l3-protocol.cc.

References AddAddress(), ns3::Mac48Address::ConvertFrom(), ns3::Ipv6InterfaceAddress::GetAddress(), ns3::NetDevice::GetAddress(), ns3::Ipv6Address::GetAny(), ns3::Ipv6Interface::GetDevice(), GetInterface(), GetRoutingProtocol(), ns3::Mac48Address::IsMatchingType(), m_node, m_prefixes, ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6RoutingProtocol::NotifyAddRoute(), NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::Ipv6AutoconfiguredPrefix::StartPreferredTimer().

+ Here is the call graph for this function:

uint32_t ns3::Ipv6L3Protocol::AddInterface ( Ptr< NetDevice device)
virtual

Add IPv6 interface for a device.

Parameters
devicenet device
Returns
interface index

Implements ns3::Ipv6.

Definition at line 144 of file ipv6-l3-protocol.cc.

References AddIpv6Interface(), ns3::CreateObject(), m_ipForward, m_node, ns3::MakeCallback(), NS_LOG_FUNCTION, PROT_NUMBER, Receive(), and ns3::Node::RegisterProtocolHandler().

+ Here is the call graph for this function:

uint32_t ns3::Ipv6L3Protocol::AddIpv6Interface ( Ptr< Ipv6Interface interface)
private

Add an IPv6 interface to the stack.

Parameters
interfaceinterface to add
Returns
index of newly added interface

Definition at line 157 of file ipv6-l3-protocol.cc.

References m_interfaces, m_nInterfaces, and NS_LOG_FUNCTION.

Referenced by AddInterface(), and SetupLoopback().

+ Here is the caller graph for this function:

Ipv6Header ns3::Ipv6L3Protocol::BuildHeader ( Ipv6Address  src,
Ipv6Address  dst,
uint8_t  protocol,
uint16_t  payloadSize,
uint8_t  ttl 
)
private

Construct an IPv6 header.

Parameters
srcsource IPv6 address
dstdestination IPv6 address
protocolL4 protocol
payloadSizepayload size
ttlTTL
Returns
newly created IPv6 header

Definition at line 1070 of file ipv6-l3-protocol.cc.

References NS_LOG_FUNCTION, ns3::Ipv6Header::SetDestinationAddress(), ns3::Ipv6Header::SetHopLimit(), ns3::Ipv6Header::SetNextHeader(), ns3::Ipv6Header::SetPayloadLength(), and ns3::Ipv6Header::SetSourceAddress().

Referenced by Send().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Ptr< Socket > ns3::Ipv6L3Protocol::CreateRawSocket ( void  )

Create raw IPv6 socket.

Returns
newly raw socket

Definition at line 564 of file ipv6-l3-protocol.cc.

References m_node, m_sockets, NS_LOG_FUNCTION_NOARGS, and ns3::Ipv6RawSocketImpl::SetNode().

+ Here is the call graph for this function:

void ns3::Ipv6L3Protocol::DeleteRawSocket ( Ptr< Socket socket)

Remove raw IPv6 socket.

Parameters
socketsocket to remove

Definition at line 573 of file ipv6-l3-protocol.cc.

References m_sockets, and NS_LOG_FUNCTION.

void ns3::Ipv6L3Protocol::DoDispose ( void  )
protectedvirtual

Dispose object.

Reimplemented from ns3::Object.

Definition at line 92 of file ipv6-l3-protocol.cc.

References m_interfaces, m_node, m_prefixes, m_protocols, m_routingProtocol, m_sockets, and NS_LOG_FUNCTION_NOARGS.

Ipv6InterfaceAddress ns3::Ipv6L3Protocol::GetAddress ( uint32_t  interfaceIndex,
uint32_t  addressIndex 
) const
virtual

Get an address.

Parameters
interfaceIndexinterface index
addressIndexaddress index on the interface
Returns
Ipv6InterfaceAddress or assert if not found

Implements ns3::Ipv6.

Definition at line 353 of file ipv6-l3-protocol.cc.

References ns3::Ipv6Interface::GetAddress(), GetInterface(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Ptr< Icmpv6L4Protocol > ns3::Ipv6L3Protocol::GetIcmpv6 ( ) const

Get ICMPv6 protocol.

Returns
Icmpv6L4Protocol pointer

Definition at line 587 of file ipv6-l3-protocol.cc.

References ns3::Object::GetObject(), GetProtocol(), ns3::Icmpv6L4Protocol::GetStaticProtocolNumber(), and NS_LOG_FUNCTION_NOARGS.

Referenced by IpForward(), LocalDeliver(), and SendRealOut().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Ptr< Ipv6Interface > ns3::Ipv6L3Protocol::GetInterface ( uint32_t  i) const

Get an interface.

Parameters
iinterface index
Returns
IPv6 interface pointer

Definition at line 167 of file ipv6-l3-protocol.cc.

References m_interfaces, and NS_LOG_FUNCTION.

Referenced by AddAddress(), AddAutoconfiguredAddress(), GetAddress(), GetMetric(), GetMtu(), GetNAddresses(), GetNetDevice(), IsForwarding(), IsUp(), LocalDeliver(), RemoveAddress(), RemoveAutoconfiguredAddress(), SendRealOut(), SetDown(), SetForwarding(), SetMetric(), and SetUp().

+ Here is the caller graph for this function:

int32_t ns3::Ipv6L3Protocol::GetInterfaceForAddress ( Ipv6Address  addr) const
virtual

Get interface index which has specified IPv6 address.

Parameters
addrIPv6 address
Returns
interface index or -1 if not found

Implements ns3::Ipv6.

Definition at line 189 of file ipv6-l3-protocol.cc.

References m_interfaces, and NS_LOG_FUNCTION.

Referenced by Send().

+ Here is the caller graph for this function:

int32_t ns3::Ipv6L3Protocol::GetInterfaceForDevice ( Ptr< const NetDevice device) const
virtual

Get interface index which is on a specified net device.

Parameters
devicenet device

Implements ns3::Ipv6.

Definition at line 237 of file ipv6-l3-protocol.cc.

References m_interfaces, and NS_LOG_FUNCTION.

Referenced by Send(), and SendRealOut().

+ Here is the caller graph for this function:

int32_t ns3::Ipv6L3Protocol::GetInterfaceForPrefix ( Ipv6Address  addr,
Ipv6Prefix  mask 
) const
virtual

Get interface index which match specified address/prefix.

Parameters
addrIPv6 address
maskIPv6 prefix (mask)
Returns
interface index or -1 if not found

Implements ns3::Ipv6.

Definition at line 211 of file ipv6-l3-protocol.cc.

References ns3::Ipv6Address::CombinePrefix(), m_interfaces, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

bool ns3::Ipv6L3Protocol::GetIpForward ( void  ) const
privatevirtual

Get IPv6 forwarding state.

Returns
forwarding state (enabled or not)

Definition at line 495 of file ipv6-l3-protocol.cc.

References m_ipForward, and NS_LOG_FUNCTION_NOARGS.

uint16_t ns3::Ipv6L3Protocol::GetMetric ( uint32_t  i) const
virtual

Get metric for an interface.

Parameters
iindex
Returns
metric

Implements ns3::Ipv6.

Definition at line 384 of file ipv6-l3-protocol.cc.

References GetInterface(), ns3::Ipv6Interface::GetMetric(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

uint16_t ns3::Ipv6L3Protocol::GetMtu ( uint32_t  i) const
virtual

Get MTU for an interface.

Parameters
iindex
Returns
MTU

Implements ns3::Ipv6.

Definition at line 391 of file ipv6-l3-protocol.cc.

References ns3::Ipv6Interface::GetDevice(), GetInterface(), ns3::NetDevice::GetMtu(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

uint32_t ns3::Ipv6L3Protocol::GetNAddresses ( uint32_t  interface) const
virtual

Get number of address for an interface.

Parameters
interfaceinterface index
Returns
number of address

Implements ns3::Ipv6.

Definition at line 346 of file ipv6-l3-protocol.cc.

References GetInterface(), ns3::Ipv6Interface::GetNAddresses(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Ptr< NetDevice > ns3::Ipv6L3Protocol::GetNetDevice ( uint32_t  i)
virtual

Get device by index.

Parameters
idevice index on this stack
Returns
NetDevice pointer

Implements ns3::Ipv6.

Definition at line 231 of file ipv6-l3-protocol.cc.

References ns3::Ipv6Interface::GetDevice(), GetInterface(), and NS_LOG_FUNCTION.

Referenced by IpMulticastForward(), and Send().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t ns3::Ipv6L3Protocol::GetNInterfaces ( void  ) const
virtual

Get current number of interface on this stack.

Returns
number of interface registered

Implements ns3::Ipv6.

Definition at line 183 of file ipv6-l3-protocol.cc.

References m_nInterfaces, and NS_LOG_FUNCTION_NOARGS.

Ptr< IpL4Protocol > ns3::Ipv6L3Protocol::GetProtocol ( int  protocolNumber) const

Get L4 protocol by protocol number.

Parameters
protocolNumberprotocol number
Returns
corresponding Ipv6L4Protocol or 0 if not found

Definition at line 550 of file ipv6-l3-protocol.cc.

References m_protocols, and NS_LOG_FUNCTION.

Referenced by GetIcmpv6(), and LocalDeliver().

+ Here is the caller graph for this function:

Ptr< Ipv6RoutingProtocol > ns3::Ipv6L3Protocol::GetRoutingProtocol ( void  ) const
virtual

Get current routing protocol used.

Returns
routing protocol

Implements ns3::Ipv6.

Definition at line 138 of file ipv6-l3-protocol.cc.

References m_routingProtocol, and NS_LOG_FUNCTION_NOARGS.

Referenced by AddAutoconfiguredAddress(), and RemoveAutoconfiguredAddress().

+ Here is the caller graph for this function:

bool ns3::Ipv6L3Protocol::GetSendIcmpv6Redirect ( ) const
privatevirtual

Get the ICMPv6 Redirect sending state.

Returns
ICMPv6 Redirect sending state (enabled or not)

Definition at line 507 of file ipv6-l3-protocol.cc.

References m_sendIcmpv6Redirect, and NS_LOG_FUNCTION_NOARGS.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

TypeId ns3::Ipv6L3Protocol::GetTypeId ( void  )
static

Get the type ID of this class.

This method returns the TypeId associated to ns3::Ipv6L3Protocol.

Returns
type ID

Attributes defined for this type:

  • DefaultTtl: The TTL value set by default on all outgoing packets generated on this node.
  • InterfaceList: The set of IPv6 interfaces associated to this IPv6 stack.
  • SendIcmpv6Redirect: Send the ICMPv6 Redirect when appropriate.
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read

Attributes defined in parent class ns3::Ipv6:

  • IpForward: Globally enable or disable IP forwarding for all current and future IPv6 devices.
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: construct write read

TraceSources defined for this type:

  • Tx: Send IPv6 packet to outgoing interface.
  • Rx: Receive IPv6 packet from incoming interface.
  • Drop: Drop IPv6 packet

Reimplemented from ns3::Ipv6.

Definition at line 53 of file ipv6-l3-protocol.cc.

References GetSendIcmpv6Redirect(), m_defaultTtl, m_dropTrace, m_interfaces, m_rxTrace, m_txTrace, ns3::MakeObjectVectorAccessor(), ns3::MakeTraceSourceAccessor(), ns3::TypeId::SetParent(), and SetSendIcmpv6Redirect().

+ Here is the call graph for this function:

void ns3::Ipv6L3Protocol::Insert ( Ptr< IpL4Protocol protocol)

Add an L4 protocol.

Parameters
protocolL4 protocol

Definition at line 538 of file ipv6-l3-protocol.cc.

References m_protocols, and NS_LOG_FUNCTION.

Referenced by ns3::AddInternetStack().

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::IpForward ( Ptr< Ipv6Route rtentry,
Ptr< const Packet p,
const Ipv6Header header 
)
private
void ns3::Ipv6L3Protocol::IpMulticastForward ( Ptr< Ipv6MulticastRoute mrtentry,
Ptr< const Packet p,
const Ipv6Header header 
)
private

Forward a packet in multicast.

Parameters
mrtentryroute
ppacket to forward
headerIPv6 header to add to the packet

Definition at line 932 of file ipv6-l3-protocol.cc.

References ns3::Packet::Copy(), DROP_TTL_EXPIRED, ns3::Ipv6Address::GetAny(), ns3::Ipv6Header::GetDestinationAddress(), ns3::Ipv6Header::GetHopLimit(), ns3::Node::GetId(), GetNetDevice(), ns3::Object::GetObject(), ns3::Ipv6Header::GetSourceAddress(), m_dropTrace, m_node, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, SendRealOut(), and ns3::Ipv6Header::SetHopLimit().

Referenced by Receive().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::Ipv6L3Protocol::IsForwarding ( uint32_t  i) const
virtual

Is interface allows forwarding ?

Parameters
iinterface index

Implements ns3::Ipv6.

Definition at line 468 of file ipv6-l3-protocol.cc.

References GetInterface(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

bool ns3::Ipv6L3Protocol::IsUp ( uint32_t  i) const
virtual

Is specified interface up ?

Parameters
iinterface index

Implements ns3::Ipv6.

Definition at line 398 of file ipv6-l3-protocol.cc.

References GetInterface(), ns3::Ipv6Interface::IsUp(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::Ipv6L3Protocol::NotifyNewAggregate ( void  )
protectedvirtual

Notify other components connected to the node that a new stack member is now connected.

This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.

Reimplemented from ns3::Object.

Definition at line 513 of file ipv6-l3-protocol.cc.

References m_node, NS_LOG_FUNCTION_NOARGS, and SetNode().

+ Here is the call graph for this function:

Ipv6L3Protocol& ns3::Ipv6L3Protocol::operator= ( const Ipv6L3Protocol o)
private

Copy constructor.

Parameters
oobject to copy
void ns3::Ipv6L3Protocol::Receive ( Ptr< NetDevice device,
Ptr< const Packet p,
uint16_t  protocol,
const Address from,
const Address to,
NetDevice::PacketType  packetType 
)

Receive method when a packet arrive in the stack. This method removes IPv6 header and forward up to L4 protocol.

Parameters
devicenetwork device
pthe packet
protocolnext header value
fromaddress of the correspondant
toaddress of the destination
packetTypetype of the packet

Definition at line 680 of file ipv6-l3-protocol.cc.

References ns3::Packet::Copy(), DROP_INTERFACE_DOWN, DROP_NO_ROUTE, ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::Ipv6Header::GetDestinationAddress(), ns3::Ipv6Interface::GetDevice(), ns3::Node::GetId(), ns3::Ipv6Header::GetNextHeader(), ns3::Object::GetObject(), ns3::Ipv6Header::GetPayloadLength(), IpForward(), IpMulticastForward(), ns3::Ipv6Header::IPV6_EXT_HOP_BY_HOP, ns3::Ipv6Interface::IsUp(), LocalDeliver(), m_dropTrace, m_interfaces, m_node, m_routingProtocol, m_rxTrace, m_sockets, ns3::MakeCallback(), NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::Ipv6RoutingProtocol::RouteInput(), and RouteInputError().

Referenced by AddInterface(), and SetupLoopback().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::RegisterExtensions ( )
virtual

Register the IPv6 Extensions.

Implements ns3::Ipv6.

Definition at line 1083 of file ipv6-l3-protocol.cc.

References ns3::Object::AggregateObject(), m_node, and ns3::Ipv6Extension::SetNode().

Referenced by ns3::AddInternetStack(), ns3::AddInternetStack6(), and ns3::CreateDualStackNode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::RegisterOptions ( )
virtual

Register the IPv6 Options.

Implements ns3::Ipv6.

Definition at line 1116 of file ipv6-l3-protocol.cc.

References ns3::Object::AggregateObject(), and m_node.

Referenced by ns3::AddInternetStack(), ns3::AddInternetStack6(), and ns3::CreateDualStackNode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::Remove ( Ptr< IpL4Protocol protocol)

Remove an L4 protocol.

Parameters
protocolL4 protocol to remove

Definition at line 544 of file ipv6-l3-protocol.cc.

References m_protocols, and NS_LOG_FUNCTION.

bool ns3::Ipv6L3Protocol::RemoveAddress ( uint32_t  interfaceIndex,
uint32_t  addressIndex 
)
virtual

Remove an address from an interface.

Parameters
interfaceIndexinterface index
addressIndexaddress index on the interface

Implements ns3::Ipv6.

Definition at line 360 of file ipv6-l3-protocol.cc.

References GetInterface(), m_routingProtocol, ns3::Ipv6RoutingProtocol::NotifyRemoveAddress(), and NS_LOG_FUNCTION.

Referenced by RemoveAutoconfiguredAddress().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::RemoveAutoconfiguredAddress ( uint32_t  interface,
Ipv6Address  network,
Ipv6Prefix  mask,
Ipv6Address  defaultRouter 
)

Remove an autoconfigured address.

Typically it is used when an autoconfigured address expires.

Parameters
interfaceinterface index
networknetwork prefix
masknetwork mask
defaultRoutergateway

Definition at line 301 of file ipv6-l3-protocol.cc.

References ns3::Mac48Address::ConvertFrom(), ns3::Ipv6InterfaceAddress::GetAddress(), ns3::NetDevice::GetAddress(), ns3::Ipv6Interface::GetAddress(), ns3::Ipv6Address::GetAny(), ns3::Ipv6Interface::GetDevice(), GetInterface(), ns3::Ipv6Interface::GetNAddresses(), GetRoutingProtocol(), m_prefixes, ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6RoutingProtocol::NotifyRemoveRoute(), NS_LOG_FUNCTION, and RemoveAddress().

+ Here is the call graph for this function:

void ns3::Ipv6L3Protocol::RouteInputError ( Ptr< const Packet p,
const Ipv6Header ipHeader,
Socket::SocketErrno  sockErrno 
)
private

Fallback when no route is found.

Parameters
ppacket
ipHeaderIPv6 header
sockErrnoerror number

Definition at line 1063 of file ipv6-l3-protocol.cc.

References DROP_ROUTE_ERROR, ns3::Object::GetObject(), m_dropTrace, m_node, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by Receive().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::Send ( Ptr< Packet packet,
Ipv6Address  source,
Ipv6Address  destination,
uint8_t  protocol,
Ptr< Ipv6Route route 
)
void ns3::Ipv6L3Protocol::SendRealOut ( Ptr< Ipv6Route route,
Ptr< Packet packet,
Ipv6Header const &  ipHeader 
)
private
void ns3::Ipv6L3Protocol::SetDefaultTtl ( uint8_t  ttl)

Set the default TTL.

Parameters
ttlTTL to set

Definition at line 602 of file ipv6-l3-protocol.cc.

References m_defaultTtl, and NS_LOG_FUNCTION.

void ns3::Ipv6L3Protocol::SetDown ( uint32_t  i)
virtual

set an interface down.

Parameters
iinterface index

Implements ns3::Ipv6.

Definition at line 418 of file ipv6-l3-protocol.cc.

References GetInterface(), m_routingProtocol, ns3::Ipv6RoutingProtocol::NotifyInterfaceDown(), NS_LOG_FUNCTION, and ns3::Ipv6Interface::SetDown().

+ Here is the call graph for this function:

void ns3::Ipv6L3Protocol::SetForwarding ( uint32_t  i,
bool  val 
)
virtual

Enable or disable forwarding on interface.

Parameters
iinterface index
valtrue = enable forwarding, false = disable

Implements ns3::Ipv6.

Definition at line 477 of file ipv6-l3-protocol.cc.

References GetInterface(), NS_LOG_FUNCTION, and ns3::Ipv6Interface::SetForwarding().

+ Here is the call graph for this function:

void ns3::Ipv6L3Protocol::SetIpForward ( bool  forward)
privatevirtual

Set IPv6 forwarding state.

Parameters
forwardIPv6 forwarding enabled or not

Definition at line 484 of file ipv6-l3-protocol.cc.

References m_interfaces, m_ipForward, and NS_LOG_FUNCTION.

void ns3::Ipv6L3Protocol::SetMetric ( uint32_t  i,
uint16_t  metric 
)
virtual

Set metric for an interface.

Parameters
iindex
metric

Implements ns3::Ipv6.

Definition at line 377 of file ipv6-l3-protocol.cc.

References GetInterface(), NS_LOG_FUNCTION, and ns3::Ipv6Interface::SetMetric().

+ Here is the call graph for this function:

void ns3::Ipv6L3Protocol::SetNode ( Ptr< Node node)

Set node for this stack.

Parameters
nodenode to set

Definition at line 530 of file ipv6-l3-protocol.cc.

References m_node, NS_LOG_FUNCTION, and SetupLoopback().

Referenced by NotifyNewAggregate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::SetRoutingProtocol ( Ptr< Ipv6RoutingProtocol routingProtocol)
virtual

Set routing protocol for this stack.

Parameters
routingProtocolIPv6 routing protocol to set

Implements ns3::Ipv6.

Definition at line 131 of file ipv6-l3-protocol.cc.

References m_routingProtocol, NS_LOG_FUNCTION, and ns3::Ipv6RoutingProtocol::SetIpv6().

Referenced by ns3::AddInternetStack(), ns3::AddInternetStack6(), and ns3::CreateDualStackNode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::SetSendIcmpv6Redirect ( bool  sendIcmpv6Redirect)
privatevirtual

Set the ICMPv6 Redirect sending state.

Parameters
sendIcmpv6RedirectICMPv6 Redirect sending enabled or not

Definition at line 501 of file ipv6-l3-protocol.cc.

References m_sendIcmpv6Redirect, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::Ipv6L3Protocol::SetUp ( uint32_t  i)
virtual

Set an interface up.

Parameters
iinterface index

Implements ns3::Ipv6.

Definition at line 405 of file ipv6-l3-protocol.cc.

References GetInterface(), m_routingProtocol, ns3::Ipv6RoutingProtocol::NotifyInterfaceUp(), NS_LOG_FUNCTION, and ns3::Ipv6Interface::SetUp().

+ Here is the call graph for this function:

void ns3::Ipv6L3Protocol::SetupLoopback ( void  )
private

Friends And Related Function Documentation

friend class Ipv6ExtensionLooseRouting
friend

Definition at line 359 of file ipv6-l3-protocol.h.

friend class Ipv6L3ProtocolTestCase
friend

Definition at line 358 of file ipv6-l3-protocol.h.

Member Data Documentation

uint8_t ns3::Ipv6L3Protocol::m_defaultTtl
private

Default TTL for outgoing packets.

Definition at line 511 of file ipv6-l3-protocol.h.

Referenced by GetTypeId(), Send(), and SetDefaultTtl().

TracedCallback<const Ipv6Header &, Ptr<const Packet>, DropReason, Ptr<Ipv6>, uint32_t> ns3::Ipv6L3Protocol::m_dropTrace
private

Callback to trace drop packets.

Definition at line 381 of file ipv6-l3-protocol.h.

Referenced by GetTypeId(), IpForward(), IpMulticastForward(), LocalDeliver(), Receive(), RouteInputError(), Send(), and SendRealOut().

Ipv6InterfaceList ns3::Ipv6L3Protocol::m_interfaces
private
bool ns3::Ipv6L3Protocol::m_ipForward
private

Forwarding packets (i.e. router mode) state.

Definition at line 491 of file ipv6-l3-protocol.h.

Referenced by AddInterface(), GetIpForward(), SendRealOut(), and SetIpForward().

uint32_t ns3::Ipv6L3Protocol::m_nInterfaces
private

Number of IPv6 interfaces managed by the stack.

Definition at line 506 of file ipv6-l3-protocol.h.

Referenced by AddIpv6Interface(), and GetNInterfaces().

Ipv6AutoconfiguredPrefixList ns3::Ipv6L3Protocol::m_prefixes
private

List of IPv6 prefix received from RA.

Definition at line 526 of file ipv6-l3-protocol.h.

Referenced by AddAutoconfiguredAddress(), DoDispose(), and RemoveAutoconfiguredAddress().

L4List_t ns3::Ipv6L3Protocol::m_protocols
private

List of transport protocol.

Definition at line 496 of file ipv6-l3-protocol.h.

Referenced by DoDispose(), GetProtocol(), Insert(), and Remove().

Ptr<Ipv6RoutingProtocol> ns3::Ipv6L3Protocol::m_routingProtocol
private
TracedCallback<Ptr<const Packet>, Ptr<Ipv6>, uint32_t> ns3::Ipv6L3Protocol::m_rxTrace
private

Callback to trace RX (reception) packets.

Definition at line 376 of file ipv6-l3-protocol.h.

Referenced by GetTypeId(), and Receive().

bool ns3::Ipv6L3Protocol::m_sendIcmpv6Redirect
private

Allow ICMPv6 Redirect sending state.

Definition at line 531 of file ipv6-l3-protocol.h.

Referenced by GetSendIcmpv6Redirect(), IpForward(), and SetSendIcmpv6Redirect().

SocketList ns3::Ipv6L3Protocol::m_sockets
private

List of IPv6 raw sockets.

Definition at line 521 of file ipv6-l3-protocol.h.

Referenced by CreateRawSocket(), DeleteRawSocket(), DoDispose(), and Receive().

TracedCallback<Ptr<const Packet>, Ptr<Ipv6>, uint32_t> ns3::Ipv6L3Protocol::m_txTrace
private

Callback to trace TX (transmission) packets.

Definition at line 371 of file ipv6-l3-protocol.h.

Referenced by GetTypeId(), and SendRealOut().

const uint16_t ns3::Ipv6L3Protocol::PROT_NUMBER = 0x86DD
static

The documentation for this class was generated from the following files: