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

Access to the IPv6 forwarding table, interfaces, and configuration. More...

#include <ipv6.h>

+ Inheritance diagram for ns3::Ipv6:
+ Collaboration diagram for ns3::Ipv6:

Public Member Functions

 Ipv6 ()
 Constructor. More...
 
virtual ~Ipv6 ()
 Destructor. More...
 
virtual bool AddAddress (uint32_t interface, Ipv6InterfaceAddress address)=0
 Add an address on the specified IPv6 interface. More...
 
virtual uint32_t AddInterface (Ptr< NetDevice > device)=0
 Add a NetDevice interface. More...
 
virtual Ipv6InterfaceAddress GetAddress (uint32_t interface, uint32_t addressIndex) const =0
 Get IPv6 address on specified IPv6 interface. More...
 
virtual int32_t GetInterfaceForAddress (Ipv6Address address) const =0
 Return the interface number of the interface that has been assigned the specified IP address. More...
 
virtual int32_t GetInterfaceForDevice (Ptr< const NetDevice > device) const =0
 Get the interface index of the specified NetDevice. More...
 
virtual int32_t GetInterfaceForPrefix (Ipv6Address address, Ipv6Prefix mask) const =0
 Return the interface number of first interface found that has an IPv6 address within the prefix specified by the input address and mask parameters. More...
 
virtual uint16_t GetMetric (uint32_t interface) const =0
 Get metric for the specified IPv6 interface. More...
 
virtual uint16_t GetMtu (uint32_t interface) const =0
 Get MTU for the specified IPv6 interface. More...
 
virtual uint32_t GetNAddresses (uint32_t interface) const =0
 Get number of addresses on specified IPv6 interface. More...
 
virtual Ptr< NetDeviceGetNetDevice (uint32_t interface)=0
 Get the NetDevice of the specified interface number. More...
 
virtual uint32_t GetNInterfaces (void) const =0
 Get number of interfaces. More...
 
virtual Ptr< Ipv6RoutingProtocolGetRoutingProtocol (void) const =0
 Get the routing protocol to be used by this IPv6 stack. More...
 
virtual bool IsForwarding (uint32_t interface) const =0
 If the specified IPv6 interface has forwarding enabled. More...
 
virtual bool IsUp (uint32_t interface) const =0
 If the specified interface index is in "up" state. More...
 
virtual void RegisterExtensions ()=0
 Register the IPv6 Extensions. More...
 
virtual void RegisterOptions ()=0
 Register the IPv6 Options. More...
 
virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex)=0
 Remove an address on specified IPv6 interface. More...
 
virtual bool RemoveAddress (uint32_t interface, Ipv6Address address)=0
 Remove the given address on named Ipv6 interface. More...
 
virtual void SetDown (uint32_t interface)=0
 Set the interface into the "down" state. More...
 
virtual void SetForwarding (uint32_t interface, bool val)=0
 Set forwarding on specified IPv6 interface. More...
 
virtual void SetMetric (uint32_t interface, uint16_t metric)=0
 Set metric on specified Ipv6 interface. More...
 
virtual void SetPmtu (Ipv6Address dst, uint32_t pmtu)=0
 Set the Path MTU for the specified IPv6 destination address. More...
 
virtual void SetRoutingProtocol (Ptr< Ipv6RoutingProtocol > routingProtocol)=0
 Register a new routing protocol to be used by this IPv6 stack. More...
 
virtual void SetUp (uint32_t interface)=0
 Set the interface into the "up" state. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 
virtual ~Object ()
 
void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 Run the DoDispose methods of this object and all the objects aggregated to it. More...
 
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 Initialize (void)
 This method calls the virtual DoInitialize method on all the objects aggregated to this object. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
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 (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Static Public Attributes

static const uint32_t IF_ANY = 0xffffffff
 Any interface magic number. More...
 

Private Member Functions

virtual bool GetIpForward (void) const =0
 Get IPv6 forwarding state. More...
 
virtual bool GetMtuDiscover (void) const =0
 Get IPv6 MTU discover state. More...
 
virtual void SetIpForward (bool forward)=0
 Set IPv6 forwarding state. More...
 
virtual void SetMtuDiscover (bool mtuDiscover)=0
 Set IPv6 MTU discover state. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 
virtual void DoDispose (void)
 This method is called by Object::Dispose or by the object's destructor, whichever comes first. More...
 
virtual void DoInitialize (void)
 This method is called only once by Object::Initialize. More...
 
virtual void NotifyNewAggregate (void)
 This method is invoked whenever two sets of objects are aggregated together. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 This method is invoked once all member attributes have been initialized. More...
 

Detailed Description

Access to the IPv6 forwarding table, interfaces, and configuration.

Doxygen introspection did not find any typical Config paths.

This class defines the API to manipulate the following aspects of the IPv6 implementation:

  1. set/get an Ipv6RoutingProtocol
  2. register a NetDevice for use by the IPv6 layer (basically, to create IPv6-related state such as addressing and neighbor cache that is associated with a NetDevice)
  3. manipulate the status of the NetDevice from the IPv6 perspective, such as marking it as Up or Down,
  4. adding, deleting, and getting addresses associated to the IPv6 interfaces.
  5. exporting IPv6 configuration attributes

Each NetDevice has conceptually a single IPv6 interface associated with it (the corresponding structure in the Linux IPv6 implementation is struct in_device). Each interface may have one or more IPv6 addresses associated with it. Each IPv6 address may have different subnet mask, scope, etc., so all of this per-address information is stored in an Ipv6InterfaceAddress class (the corresponding structure in Linux is struct in6_ifaddr)

IPv6 attributes such as whether IP forwarding is enabled and disabled are also stored in this class

TO DO: Add API to allow access to the IPv6 neighbor table

See also
Ipv6RoutingProtocol
Ipv6InterfaceAddress


Attributes

  • 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
  • MtuDiscover: If disabled, every interface will have its MTU set to 1280 bytes.
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read

No TraceSources are defined for this type.

Definition at line 79 of file ipv6.h.

Constructor & Destructor Documentation

ns3::Ipv6::Ipv6 ( )

Constructor.

Definition at line 53 of file ipv6.cc.

ns3::Ipv6::~Ipv6 ( )
virtual

Destructor.

Definition at line 57 of file ipv6.cc.

Member Function Documentation

virtual bool ns3::Ipv6::AddAddress ( uint32_t  interface,
Ipv6InterfaceAddress  address 
)
pure virtual

Add an address on the specified IPv6 interface.

Parameters
interfaceInterface number of an IPv6 interface
addressIpv6InterfaceAddress address to associate with the underlying IPv6 interface
Returns
true if the operation succeeded

Implemented in ns3::Ipv6L3Protocol.

Referenced by StackHelper::AddAddress(), AddSimpleNetDevice(), TcpTestCase::AddSimpleNetDevice6(), Ipv6ForwardingTest::DoRun(), Ipv6PacketInfoTagTest::DoRun(), SixlowpanIphcImplTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), SixlowpanFragmentationTest::DoRun(), Ipv6FragmentationTest::DoRun(), and Udp6SocketImplTest::DoRun().

+ Here is the caller graph for this function:

virtual uint32_t ns3::Ipv6::AddInterface ( Ptr< NetDevice device)
pure virtual

Add a NetDevice interface.

Once a device has been added, it can never be removed: if you want to disable it, you can invoke Ipv6::SetDown which will make sure that it is never used during packet forwarding.

Parameters
devicedevice to add to the list of IPv6 interfaces which can be used as output interfaces during packet forwarding.
Returns
the index of the IPv6 interface added.

Implemented in ns3::Ipv6L3Protocol.

Referenced by AddSimpleNetDevice(), TcpTestCase::AddSimpleNetDevice6(), Ipv6ForwardingTest::DoRun(), Ipv6PacketInfoTagTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), SixlowpanIphcImplTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), SixlowpanFragmentationTest::DoRun(), Ipv6FragmentationTest::DoRun(), and Udp6SocketImplTest::DoRun().

+ Here is the caller graph for this function:

virtual Ipv6InterfaceAddress ns3::Ipv6::GetAddress ( uint32_t  interface,
uint32_t  addressIndex 
) const
pure virtual

Get IPv6 address on specified IPv6 interface.

Because addresses can be removed, the addressIndex is not guaranteed to be static across calls to this method.

Parameters
interfaceInterface number of an IPv6 interface
addressIndexindex of Ipv6InterfaceAddress
Returns
the Ipv6InterfaceAddress associated to the interface and addressIndex

Implemented in ns3::Ipv6L3Protocol.

Referenced by Ipv6ForwardingTest::DoRun(), IpAddressHelper::PrintIpAddresses(), and ns3::Ping6::Send().

+ Here is the caller graph for this function:

virtual int32_t ns3::Ipv6::GetInterfaceForAddress ( Ipv6Address  address) const
pure virtual

Return the interface number of the interface that has been assigned the specified IP address.

Parameters
addressThe IP address being searched for
Returns
The interface number of the IPv6 interface with the given address or -1 if not found.

Each IP interface has one or more IP addresses associated with it. This method searches the list of interfaces for one that holds a particular address. This call takes an IP address as a parameter and returns the interface number of the first interface that has been assigned that address, or -1 if not found. There must be an exact match.

Implemented in ns3::Ipv6L3Protocol.

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

Get the interface index of the specified NetDevice.

Parameters
deviceThe NetDevice for an Ipv6Interface
Returns
The interface number of an IPv6 interface or -1 if not found.

Implemented in ns3::Ipv6L3Protocol.

virtual int32_t ns3::Ipv6::GetInterfaceForPrefix ( Ipv6Address  address,
Ipv6Prefix  mask 
) const
pure virtual

Return the interface number of first interface found that has an IPv6 address within the prefix specified by the input address and mask parameters.

Parameters
addressThe IP address assigned to the interface of interest.
maskThe IP prefix to use in the mask
Returns
The interface number of the IPv6 interface with the given address or -1 if not found.

Each IP interface has one or more IP addresses associated with it. This method searches the list of interfaces for the first one found that holds an address that is included within the prefix formed by the input address and mask parameters. The value -1 is returned if no match is found.

Implemented in ns3::Ipv6L3Protocol.

virtual bool ns3::Ipv6::GetIpForward ( void  ) const
privatepure virtual

Get IPv6 forwarding state.

Returns
forwarding state (enabled or not)

Implemented in ns3::Ipv6L3Protocol.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual uint16_t ns3::Ipv6::GetMetric ( uint32_t  interface) const
pure virtual

Get metric for the specified IPv6 interface.

Parameters
interfaceThe interface number of an IPv6 interface
Returns
routing metric (cost) associated to the underlying IPv6 interface

Implemented in ns3::Ipv6L3Protocol.

virtual uint16_t ns3::Ipv6::GetMtu ( uint32_t  interface) const
pure virtual

Get MTU for the specified IPv6 interface.

Parameters
interfaceInterface number of IPv6 interface
Returns
the Maximum Transmission Unit (in bytes) associated to the underlying IPv6 interface

Implemented in ns3::Ipv6L3Protocol.

virtual bool ns3::Ipv6::GetMtuDiscover ( void  ) const
privatepure virtual

Get IPv6 MTU discover state.

Returns
MTU discover state (enabled or not)

Implemented in ns3::Ipv6L3Protocol.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual uint32_t ns3::Ipv6::GetNAddresses ( uint32_t  interface) const
pure virtual

Get number of addresses on specified IPv6 interface.

Parameters
interfaceInterface number of an IPv6 interface
Returns
the number of Ipv6InterfaceAddress entries for the interface.

Implemented in ns3::Ipv6L3Protocol.

Referenced by IpAddressHelper::PrintIpAddresses().

+ Here is the caller graph for this function:

virtual Ptr<NetDevice> ns3::Ipv6::GetNetDevice ( uint32_t  interface)
pure virtual

Get the NetDevice of the specified interface number.

Parameters
interfaceThe interface number of an IPv6 interface.
Returns
The NetDevice associated with the IPv6 interface number.

Implemented in ns3::Ipv6L3Protocol.

virtual uint32_t ns3::Ipv6::GetNInterfaces ( void  ) const
pure virtual

Get number of interfaces.

Returns
the number of interfaces added by the user.

Implemented in ns3::Ipv6L3Protocol.

Referenced by IpAddressHelper::PrintIpAddresses().

+ Here is the caller graph for this function:

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

Get the routing protocol to be used by this IPv6 stack.

Returns
smart pointer to Ipv6RoutingProtocol object, or null pointer if none

Implemented in ns3::Ipv6L3Protocol.

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

Get the type ID.

Returns
the object TypeId

Definition at line 35 of file ipv6.cc.

References GetIpForward(), GetMtuDiscover(), SetIpForward(), SetMtuDiscover(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

virtual bool ns3::Ipv6::IsForwarding ( uint32_t  interface) const
pure virtual

If the specified IPv6 interface has forwarding enabled.

Parameters
interfaceInterface number of IPv6 interface
Returns
true if IPv6 forwarding enabled for input datagrams on this device

Implemented in ns3::Ipv6L3Protocol.

virtual bool ns3::Ipv6::IsUp ( uint32_t  interface) const
pure virtual

If the specified interface index is in "up" state.

Parameters
interfaceInterface number of IPv6 interface
Returns
true if the underlying interface is in the "up" state, false otherwise.

Implemented in ns3::Ipv6L3Protocol.

virtual void ns3::Ipv6::RegisterExtensions ( )
pure virtual

Register the IPv6 Extensions.

Implemented in ns3::Ipv6L3Protocol.

virtual void ns3::Ipv6::RegisterOptions ( )
pure virtual

Register the IPv6 Options.

Implemented in ns3::Ipv6L3Protocol.

virtual bool ns3::Ipv6::RemoveAddress ( uint32_t  interface,
uint32_t  addressIndex 
)
pure virtual

Remove an address on specified IPv6 interface.

Remove the address at addressIndex on named interface. The addressIndex for all higher indices will decrement by one after this method is called; so, for example, to remove 5 addresses from an interface i, one could call RemoveAddress (i, 0); 5 times.

Parameters
interfaceInterface number of an IPv6 interface
addressIndexindex of Ipv6InterfaceAddress to remove
Returns
true if the operation succeeded

Implemented in ns3::Ipv6L3Protocol.

virtual bool ns3::Ipv6::RemoveAddress ( uint32_t  interface,
Ipv6Address  address 
)
pure virtual

Remove the given address on named Ipv6 interface.

Parameters
interfaceInterface number of an IPv6 interface
addressthe address to remove
Returns
true if the operation succeeded

Implemented in ns3::Ipv6L3Protocol.

virtual void ns3::Ipv6::SetDown ( uint32_t  interface)
pure virtual

Set the interface into the "down" state.

In this state, it is ignored during IPv6 forwarding.

Parameters
interfaceInterface number of IPv6 interface

Implemented in ns3::Ipv6L3Protocol.

virtual void ns3::Ipv6::SetForwarding ( uint32_t  interface,
bool  val 
)
pure virtual

Set forwarding on specified IPv6 interface.

Parameters
interfaceInterface number of IPv6 interface
valValue to set the forwarding flag

If set to true, IPv6 forwarding is enabled for input datagrams on this device

Implemented in ns3::Ipv6L3Protocol.

virtual void ns3::Ipv6::SetIpForward ( bool  forward)
privatepure virtual

Set IPv6 forwarding state.

Parameters
forwardIPv6 forwarding enabled or not

Implemented in ns3::Ipv6L3Protocol.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::Ipv6::SetMetric ( uint32_t  interface,
uint16_t  metric 
)
pure virtual

Set metric on specified Ipv6 interface.

Parameters
interfaceThe interface number of an IPv6 interface
metricrouting metric (cost) associated to the underlying IPv6 interface

Implemented in ns3::Ipv6L3Protocol.

Referenced by Ipv6PacketInfoTagTest::DoRun().

+ Here is the caller graph for this function:

virtual void ns3::Ipv6::SetMtuDiscover ( bool  mtuDiscover)
privatepure virtual

Set IPv6 MTU discover state.

Parameters
mtuDiscoverIPv6 MTU discover enabled or not

Implemented in ns3::Ipv6L3Protocol.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::Ipv6::SetPmtu ( Ipv6Address  dst,
uint32_t  pmtu 
)
pure virtual

Set the Path MTU for the specified IPv6 destination address.

Parameters
dstIpv6 destination address
pmtuthe Path MTU

Implemented in ns3::Ipv6L3Protocol.

virtual void ns3::Ipv6::SetRoutingProtocol ( Ptr< Ipv6RoutingProtocol routingProtocol)
pure virtual

Register a new routing protocol to be used by this IPv6 stack.

This call will replace any routing protocol that has been previously registered. If you want to add multiple routing protocols, you must add them to a Ipv6ListRoutingProtocol directly.

Parameters
routingProtocolsmart pointer to Ipv6RoutingProtocol object

Implemented in ns3::Ipv6L3Protocol.

virtual void ns3::Ipv6::SetUp ( uint32_t  interface)
pure virtual

Set the interface into the "up" state.

In this state, it is considered valid during IPv6 forwarding.

Parameters
interfaceInterface number of IPv6 interface

Implemented in ns3::Ipv6L3Protocol.

Referenced by AddSimpleNetDevice(), TcpTestCase::AddSimpleNetDevice6(), Ipv6ForwardingTest::DoRun(), Ipv6PacketInfoTagTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), SixlowpanIphcImplTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), SixlowpanFragmentationTest::DoRun(), Ipv6FragmentationTest::DoRun(), and Udp6SocketImplTest::DoRun().

+ Here is the caller graph for this function:

Member Data Documentation

const uint32_t ns3::Ipv6::IF_ANY = 0xffffffff
static

Any interface magic number.

Definition at line 319 of file ipv6.h.

Referenced by ns3::Ipv6StaticRouting::LookupStatic().


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