Access to the IPv6 forwarding table, interfaces, and configuration. More...
#include "ipv6.h"
Public Member Functions | |
Ipv6 () | |
Constructor. | |
~Ipv6 () override | |
Destructor. | |
virtual bool | AddAddress (uint32_t interface, Ipv6InterfaceAddress address, bool addOnLinkRoute=true)=0 |
Add an address on the specified IPv6 interface. | |
virtual uint32_t | AddInterface (Ptr< NetDevice > device)=0 |
Add a NetDevice interface. | |
virtual Ipv6InterfaceAddress | GetAddress (uint32_t interface, uint32_t addressIndex) const =0 |
Get IPv6 address on specified IPv6 interface. | |
virtual int32_t | GetInterfaceForAddress (Ipv6Address address) const =0 |
Return the interface number of the interface that has been assigned the specified IP address. | |
virtual int32_t | GetInterfaceForDevice (Ptr< const NetDevice > device) const =0 |
Get the interface index of the specified NetDevice. | |
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. | |
virtual uint16_t | GetMetric (uint32_t interface) const =0 |
Get metric for the specified IPv6 interface. | |
virtual uint16_t | GetMtu (uint32_t interface) const =0 |
Get MTU for the specified IPv6 interface. | |
virtual uint32_t | GetNAddresses (uint32_t interface) const =0 |
Get number of addresses on specified IPv6 interface. | |
virtual Ptr< NetDevice > | GetNetDevice (uint32_t interface)=0 |
Get the NetDevice of the specified interface number. | |
virtual uint32_t | GetNInterfaces () const =0 |
Get number of interfaces. | |
virtual Ptr< IpL4Protocol > | GetProtocol (int protocolNumber) const =0 |
Get L4 protocol by protocol number. | |
virtual Ptr< IpL4Protocol > | GetProtocol (int protocolNumber, int32_t interfaceIndex) const =0 |
Get L4 protocol by protocol number for the specified interface. | |
virtual Ptr< Ipv6RoutingProtocol > | GetRoutingProtocol () const =0 |
Get the routing protocol to be used by this IPv6 stack. | |
virtual void | Insert (Ptr< IpL4Protocol > protocol)=0 |
Add a L4 protocol. | |
virtual void | Insert (Ptr< IpL4Protocol > protocol, uint32_t interfaceIndex)=0 |
Add a L4 protocol to a specific interface. | |
virtual bool | IsForwarding (uint32_t interface) const =0 |
If the specified IPv6 interface has forwarding enabled. | |
virtual bool | IsUp (uint32_t interface) const =0 |
If the specified interface index is in "up" state. | |
virtual void | RegisterExtensions ()=0 |
Register the IPv6 Extensions. | |
virtual void | RegisterOptions ()=0 |
Register the IPv6 Options. | |
virtual void | Remove (Ptr< IpL4Protocol > protocol)=0 |
Remove a L4 protocol. | |
virtual void | Remove (Ptr< IpL4Protocol > protocol, uint32_t interfaceIndex)=0 |
Remove a L4 protocol from a specific interface. | |
virtual bool | RemoveAddress (uint32_t interface, Ipv6Address address)=0 |
Remove the given address on named Ipv6 interface. | |
virtual bool | RemoveAddress (uint32_t interface, uint32_t addressIndex)=0 |
Remove an address on specified IPv6 interface. | |
virtual void | Send (Ptr< Packet > packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr< Ipv6Route > route)=0 |
Higher-level layers call this method to send a packet down the stack to the MAC and PHY layers. | |
virtual void | SetDown (uint32_t interface)=0 |
Set the interface into the "down" state. | |
virtual void | SetForwarding (uint32_t interface, bool val)=0 |
Set forwarding on specified IPv6 interface. | |
virtual void | SetMetric (uint32_t interface, uint16_t metric)=0 |
Set metric on specified Ipv6 interface. | |
virtual void | SetPmtu (Ipv6Address dst, uint32_t pmtu)=0 |
Set the Path MTU for the specified IPv6 destination address. | |
virtual void | SetRoutingProtocol (Ptr< Ipv6RoutingProtocol > routingProtocol)=0 |
Register a new routing protocol to be used by this IPv6 stack. | |
virtual void | SetUp (uint32_t interface)=0 |
Set the interface into the "up" state. | |
virtual Ipv6Address | SourceAddressSelection (uint32_t interface, Ipv6Address dest)=0 |
Choose the source address to use with destination address. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Attributes | |
static const uint32_t | IF_ANY = 0xffffffff |
Any interface magic number. | |
Private Member Functions | |
virtual bool | GetIpForward () const =0 |
Get IPv6 forwarding state. | |
virtual bool | GetMtuDiscover () const =0 |
Get IPv6 MTU discover state. | |
virtual bool | GetStrongEndSystemModel () const =0 |
Get the Strong End System Model status. | |
virtual void | SetIpForward (bool forward)=0 |
Set IPv6 forwarding state. | |
virtual void | SetMtuDiscover (bool mtuDiscover)=0 |
Set IPv6 MTU discover state. | |
virtual void | SetStrongEndSystemModel (bool model)=0 |
Set or unset the Strong End System Model. | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Access to the IPv6 forwarding table, interfaces, and configuration.
This class defines the API to manipulate the following aspects of the IPv6 implementation:
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
|
pure virtual |
Add an address on the specified IPv6 interface.
interface | Interface number of an IPv6 interface |
address | Ipv6InterfaceAddress address to associate with the underlying IPv6 interface |
addOnLinkRoute | add on-link route to the network (default true) |
Implemented in ns3::Ipv6L3Protocol.
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.
device | device to add to the list of IPv6 interfaces which can be used as output interfaces during packet forwarding. |
Implemented in ns3::Ipv6L3Protocol.
|
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.
interface | Interface number of an IPv6 interface |
addressIndex | index of Ipv6InterfaceAddress |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::RipNg::DoInitialize(), ns3::NoBackhaulEpcHelper::GetUeDefaultGatewayAddress6(), ns3::Ipv6StaticRouting::NotifyInterfaceUp(), and ns3::RipNg::NotifyInterfaceUp().
|
pure virtual |
Return the interface number of the interface that has been assigned the specified IP address.
address | The IP address being searched for |
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.
Referenced by ns3::RipNg::Receive().
|
pure virtual |
Get the interface index of the specified NetDevice.
device | The NetDevice for an Ipv6Interface |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::RipNg::Lookup(), ns3::Ipv6StaticRouting::LookupStatic(), ns3::RipNg::Receive(), ns3::Ipv6ListRouting::RouteInput(), ns3::Ipv6StaticRouting::RouteInput(), and ns3::RipNg::RouteInput().
|
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.
address | The IP address assigned to the interface of interest. |
mask | The IP prefix to use in the mask |
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.
|
privatepure virtual |
Get IPv6 forwarding state.
Implemented in ns3::Ipv6L3Protocol.
Referenced by GetTypeId().
|
pure virtual |
Get metric for the specified IPv6 interface.
interface | The interface number of an IPv6 interface |
Implemented in ns3::Ipv6L3Protocol.
|
pure virtual |
Get MTU for the specified IPv6 interface.
interface | Interface number of IPv6 interface |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::RipNg::DoSendRouteUpdate(), and ns3::RipNg::HandleRequests().
|
privatepure virtual |
Get IPv6 MTU discover state.
Implemented in ns3::Ipv6L3Protocol.
Referenced by GetTypeId().
Get number of addresses on specified IPv6 interface.
interface | Interface number of an IPv6 interface |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::RipNg::DoInitialize(), ns3::Ipv6StaticRouting::NotifyInterfaceUp(), and ns3::RipNg::NotifyInterfaceUp().
Get the NetDevice of the specified interface number.
interface | The interface number of an IPv6 interface. |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::RipNg::DoInitialize(), ns3::RipNg::Lookup(), ns3::Ipv6StaticRouting::LookupStatic(), ns3::RipNg::NotifyInterfaceUp(), ns3::Ipv6StaticRouting::PrintRoutingTable(), and ns3::RipNg::PrintRoutingTable().
|
pure virtual |
Get number of interfaces.
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::RipNg::DoInitialize(), ns3::Ipv6StaticRouting::SetIpv6(), and ns3::RipNg::SetIpv6().
|
pure virtual |
Get L4 protocol by protocol number.
protocolNumber | protocol number |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::Ipv6Interface::AddAddress(), ns3::Ipv6Interface::DoSetup(), and ns3::Ipv6Interface::Send().
|
pure virtual |
Get L4 protocol by protocol number for the specified interface.
protocolNumber | protocol number |
interfaceIndex | interface index, -1 means "any" interface. |
Implemented in ns3::Ipv6L3Protocol.
|
pure virtual |
Get the routing protocol to be used by this IPv6 stack.
Implemented in ns3::Ipv6L3Protocol.
Referenced by Ipv6ForwardingTest::DoRun().
|
privatepure virtual |
Get the Strong End System Model status.
RFC1122 term for whether host rejects datagram with a dest. address on another interface
Implemented in ns3::Ipv6L3Protocol.
Referenced by GetTypeId().
|
static |
Get the type ID.
Definition at line 23 of file ipv6.cc.
References GetIpForward(), GetMtuDiscover(), GetStrongEndSystemModel(), ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), SetIpForward(), SetMtuDiscover(), ns3::TypeId::SetParent(), and SetStrongEndSystemModel().
|
pure virtual |
|
pure virtual |
Add a L4 protocol to a specific interface.
This may be called multiple times for multiple interfaces for the same protocol. To insert for all interfaces, use the separate Insert (Ptr<IpL4Protocol> protocol) method.
Setting a protocol on a specific interface will overwrite the previously bound protocol.
protocol | L4 protocol. |
interfaceIndex | interface index. |
Implemented in ns3::Ipv6L3Protocol.
|
pure virtual |
If the specified IPv6 interface has forwarding enabled.
interface | Interface number of IPv6 interface |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::Ipv6ListRouting::RouteInput(), ns3::Ipv6StaticRouting::RouteInput(), and ns3::RipNg::RouteInput().
|
pure virtual |
If the specified interface index is in "up" state.
interface | Interface number of IPv6 interface |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::Ipv6StaticRouting::NotifyAddAddress(), ns3::RipNg::NotifyAddAddress(), ns3::Ipv6StaticRouting::NotifyRemoveAddress(), ns3::RipNg::NotifyRemoveAddress(), ns3::Ipv6StaticRouting::SetIpv6(), and ns3::RipNg::SetIpv6().
|
pure virtual |
Register the IPv6 Extensions.
Does nothing if the Extensions have been already registered.
Implemented in ns3::Ipv6L3Protocol.
|
pure virtual |
Register the IPv6 Options.
Does nothing if the Options have been already registered.
Implemented in ns3::Ipv6L3Protocol.
|
pure virtual |
|
pure virtual |
Remove a L4 protocol from a specific interface.
protocol | L4 protocol to remove. |
interfaceIndex | interface index. |
Implemented in ns3::Ipv6L3Protocol.
|
pure virtual |
Remove the given address on named Ipv6 interface.
interface | Interface number of an IPv6 interface |
address | the address to remove |
Implemented in ns3::Ipv6L3Protocol.
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.
interface | Interface number of an IPv6 interface |
addressIndex | index of Ipv6InterfaceAddress to remove |
Implemented in ns3::Ipv6L3Protocol.
|
pure virtual |
Higher-level layers call this method to send a packet down the stack to the MAC and PHY layers.
All PMTU values are stored at this level, so packet size calculations should be done mathematically at higher levels.
packet | packet to send |
source | source address of packet |
destination | address of packet |
protocol | number of packet |
route | route to take |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::Icmpv6L4Protocol::NotifyNewAggregate(), ns3::TcpL4Protocol::NotifyNewAggregate(), and ns3::UdpL4Protocol::NotifyNewAggregate().
|
pure virtual |
Set the interface into the "down" state.
In this state, it is ignored during IPv6 forwarding.
interface | Interface number of IPv6 interface |
Implemented in ns3::Ipv6L3Protocol.
Referenced by NixVectorRoutingTest::DoRun().
|
pure virtual |
Set forwarding on specified IPv6 interface.
interface | Interface number of IPv6 interface |
val | Value to set the forwarding flag |
If set to true, IPv6 forwarding is enabled for input datagrams on this device
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::RipNg::DoInitialize(), and ns3::RipNg::NotifyInterfaceUp().
|
privatepure virtual |
Set IPv6 forwarding state.
forward | IPv6 forwarding enabled or not |
Implemented in ns3::Ipv6L3Protocol.
Referenced by GetTypeId().
|
pure virtual |
Set metric on specified Ipv6 interface.
interface | The interface number of an IPv6 interface |
metric | routing metric (cost) associated to the underlying IPv6 interface |
Implemented in ns3::Ipv6L3Protocol.
|
privatepure virtual |
Set IPv6 MTU discover state.
mtuDiscover | IPv6 MTU discover enabled or not |
Implemented in ns3::Ipv6L3Protocol.
Referenced by GetTypeId().
|
pure virtual |
Set the Path MTU for the specified IPv6 destination address.
dst | Ipv6 destination address |
pmtu | the Path MTU |
Implemented in ns3::Ipv6L3Protocol.
|
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.
routingProtocol | smart pointer to Ipv6RoutingProtocol object |
Implemented in ns3::Ipv6L3Protocol.
|
privatepure virtual |
Set or unset the Strong End System Model.
RFC1122 term for whether host rejects datagram with a dest. address on another interface
model | true for Strong End System Model |
Implemented in ns3::Ipv6L3Protocol.
Referenced by GetTypeId().
|
pure virtual |
Set the interface into the "up" state.
In this state, it is considered valid during IPv6 forwarding.
interface | Interface number of IPv6 interface |
Implemented in ns3::Ipv6L3Protocol.
|
pure virtual |
Choose the source address to use with destination address.
interface | interface index |
dest | IPv6 destination address |
Implemented in ns3::Ipv6L3Protocol.
Referenced by ns3::RipNg::Lookup(), and ns3::Ipv6StaticRouting::LookupStatic().
|
static |
Any interface magic number.
Definition at line 389 of file ipv6.h.
Referenced by ns3::Ipv6StaticRouting::LookupStatic().