INET Framework for OMNeT++/OMNEST
|
Management of IP tunnels. More...
#include <IPv6Tunneling.h>
Classes | |
struct | equalTunnel |
struct | Tunnel |
Public Types | |
enum | TunnelType { INVALID = 0, SPLIT, NON_SPLIT, NORMAL, T2RH, HA_OPT, MOBILITY } |
Public Member Functions | |
IPv6Tunneling () | |
virtual void | initialize (int stage) override |
Initialize tunnel manager. More... | |
virtual int | numInitStages () const override |
virtual void | handleMessage (cMessage *msg) override |
Receive messages from IPv6 module and encapsulate/decapsulate them. More... | |
virtual bool | handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override |
Perform one stage of a lifecycle operation. More... | |
int | createTunnel (TunnelType tunnelType, const IPv6Address &src, const IPv6Address &dest, const IPv6Address &destTrigger=IPv6Address::UNSPECIFIED_ADDRESS) |
Creates a tunnel with given entry and exit point, which will be used for datagrams destined for destTrigger. More... | |
bool | destroyTunnel (const IPv6Address &src, const IPv6Address &dest, const IPv6Address &destTrigger) |
Creates a pseudo-tunnel for use with either Type 2 Routing Header or Home Address Option with given entry and exit point, which will be used for datagrams destined for destTrigger. More... | |
void | destroyTunnels (const IPv6Address &entry) |
Remove all tunnels with provided entry point. More... | |
void | destroyTunnel (const IPv6Address &entry, const IPv6Address &exit) |
Remove the tunnel with the provided entry and exit point. More... | |
void | destroyTunnelForExitAndTrigger (const IPv6Address &exit, const IPv6Address &trigger) |
Remove the tunnel with the provided exit point and trigger. More... | |
void | destroyTunnelForEntryAndTrigger (const IPv6Address &entry, const IPv6Address &trigger) |
Remove the tunnel with the provided entry point and trigger. More... | |
void | destroyTunnelFromTrigger (const IPv6Address &trigger) |
Remove the tunnel with the provided destination trigger. More... | |
int | getVIfIndexForDest (const IPv6Address &destAddress) |
Returns the virtual interface identifier for the tunnel which has the provided destination as destination trigger. More... | |
virtual int | getVIfIndexForDest (const IPv6Address &destAddress, TunnelType tunnelType) |
This method is equivalent for getVIfIndexForDest() except that it only searches for either "normal" or mobility tunnels. More... | |
bool | isTunnelExit (const IPv6Address &exit) |
This method is equivalent for getVIfIndexForDest() except that it only searches for pseudo tunnels (T2RH, etc.). More... | |
Public Member Functions inherited from inet::ILifecycle | |
virtual | ~ILifecycle () |
Protected Types | |
typedef std::map< int, struct Tunnel > | Tunnels |
typedef Tunnels::const_iterator | TI |
Protected Member Functions | |
int | findTunnel (const IPv6Address &src, const IPv6Address &dest, const IPv6Address &destTrigger) const |
Returns the type of the tunnels: non-split, split, T2RH, ... More... | |
void | encapsulateDatagram (IPv6Datagram *dgram) |
Encapsulate a datagram with tunnel headers. More... | |
void | decapsulateDatagram (IPv6Datagram *dgram) |
Strip tunnel headers from datagram. More... | |
Protected Attributes | |
IInterfaceTable * | ift = nullptr |
IPv6RoutingTable * | rt = nullptr |
Tunnels | tunnels |
int | vIfIndexTop = 0 |
int | noOfNonSplitTunnels = 0 |
Private Member Functions | |
int | lookupTunnels (const IPv6Address &dest) |
Search through all tunnels and locate one entry which is anything but a non-split tunnel and has a destination trigger for the provided address. More... | |
int | doPrefixMatch (const IPv6Address &dest) |
Search through all tunnels and locate one entry which is a non-split tunnel (later on this could be exteded to searching for a tunnel that has a prefix matching the provided address). More... | |
void | resetVIfIndex () |
Reset the vIfIndex to its starting value if no tunnels exist anymore. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const IPv6Tunneling::Tunnel &tun) |
Management of IP tunnels.
|
protected |
|
protected |
int inet::IPv6Tunneling::createTunnel | ( | TunnelType | tunnelType, |
const IPv6Address & | src, | ||
const IPv6Address & | dest, | ||
const IPv6Address & | destTrigger = IPv6Address::UNSPECIFIED_ADDRESS |
||
) |
Creates a tunnel with given entry and exit point, which will be used for datagrams destined for destTrigger.
Type of tunnel (normal tunnel, mobility related pseudo-tunnel) is determined by first parameter. Returns virtual interface index.
Referenced by inet::IPv6RoutingTable::configureTunnelFromXML(), inet::xMIPv6::processBAMessage(), and inet::xMIPv6::processBUMessage().
|
protected |
Strip tunnel headers from datagram.
Referenced by handleMessage().
bool inet::IPv6Tunneling::destroyTunnel | ( | const IPv6Address & | src, |
const IPv6Address & | dest, | ||
const IPv6Address & | destTrigger | ||
) |
Creates a pseudo-tunnel for use with either Type 2 Routing Header or Home Address Option with given entry and exit point, which will be used for datagrams destined for destTrigger.
Returns virtual interface index. Remove tunnel and the associated entries from destination cache
Referenced by inet::xMIPv6::cancelEntries(), destroyTunnel(), destroyTunnelForEntryAndTrigger(), destroyTunnelForExitAndTrigger(), destroyTunnelFromTrigger(), destroyTunnels(), inet::xMIPv6::handleBULExpiry(), and inet::xMIPv6::returningHome().
void inet::IPv6Tunneling::destroyTunnel | ( | const IPv6Address & | entry, |
const IPv6Address & | exit | ||
) |
Remove the tunnel with the provided entry and exit point.
void inet::IPv6Tunneling::destroyTunnelForEntryAndTrigger | ( | const IPv6Address & | entry, |
const IPv6Address & | trigger | ||
) |
Remove the tunnel with the provided entry point and trigger.
Referenced by inet::xMIPv6::cancelEntries(), and inet::xMIPv6::processBUMessage().
void inet::IPv6Tunneling::destroyTunnelForExitAndTrigger | ( | const IPv6Address & | exit, |
const IPv6Address & | trigger | ||
) |
Remove the tunnel with the provided exit point and trigger.
Referenced by inet::xMIPv6::initiateMIPv6Protocol(), inet::xMIPv6::processBAMessage(), and inet::xMIPv6::returningHome().
void inet::IPv6Tunneling::destroyTunnelFromTrigger | ( | const IPv6Address & | trigger | ) |
Remove the tunnel with the provided destination trigger.
Referenced by inet::xMIPv6::handleBCExpiry(), and inet::xMIPv6::processBUMessage().
void inet::IPv6Tunneling::destroyTunnels | ( | const IPv6Address & | entry | ) |
Remove all tunnels with provided entry point.
|
private |
Search through all tunnels and locate one entry which is a non-split tunnel (later on this could be exteded to searching for a tunnel that has a prefix matching the provided address).
Referenced by encapsulateDatagram(), and getVIfIndexForDest().
|
protected |
Encapsulate a datagram with tunnel headers.
Attaches a Type 2 Routing Header in the control info if the datagram is routed over an appropriate RH2 pseudo tunnel.
Referenced by handleMessage().
|
protected |
Returns the type of the tunnels: non-split, split, T2RH, ...
Returns the vIfIndex of tunnel if found, 0 otherwise.
Referenced by createTunnel(), and destroyTunnel().
int inet::IPv6Tunneling::getVIfIndexForDest | ( | const IPv6Address & | destAddress | ) |
Returns the virtual interface identifier for the tunnel which has the provided destination as destination trigger.
This is done by first looking at the split tunnels; if no split tunnels are found, a prefix matching on the non-split tunnels is then performed. In case both searches do not return a search hit, a value of -1 is returned.
Referenced by encapsulateDatagram(), inet::IPv6::routePacket(), and inet::xMIPv6::triggerRouteOptimization().
|
virtual |
This method is equivalent for getVIfIndexForDest() except that it only searches for either "normal" or mobility tunnels.
|
overridevirtual |
Receive messages from IPv6 module and encapsulate/decapsulate them.
|
overridevirtual |
Perform one stage of a lifecycle operation.
Processing may be done entirely within this method, or may be a longer process that involves nonzero simulation time or several events, and is triggered by this method call.
Return value: true = "done"; false = "not yet done, will invoke doneCallback when done"
Implements inet::ILifecycle.
|
overridevirtual |
Initialize tunnel manager.
bool inet::IPv6Tunneling::isTunnelExit | ( | const IPv6Address & | exit | ) |
This method is equivalent for getVIfIndexForDest() except that it only searches for pseudo tunnels (T2RH, etc.).
Check if there exists a tunnel with exit equal to the provided address.
Referenced by decapsulateDatagram().
|
private |
Search through all tunnels and locate one entry which is anything but a non-split tunnel and has a destination trigger for the provided address.
Referenced by getVIfIndexForDest().
|
inlineoverridevirtual |
|
inlineprivate |
Reset the vIfIndex to its starting value if no tunnels exist anymore.
Referenced by destroyTunnel(), destroyTunnelForEntryAndTrigger(), destroyTunnelForExitAndTrigger(), destroyTunnelFromTrigger(), and destroyTunnels().
|
friend |
|
protected |
Referenced by createTunnel(), decapsulateDatagram(), and initialize().
|
protected |
Referenced by createTunnel(), destroyTunnel(), and initialize().
|
protected |
Referenced by createTunnel(), decapsulateDatagram(), encapsulateDatagram(), and initialize().
|
protected |
|
protected |
Referenced by createTunnel(), and initialize().