TunnelApp

Package: inet.applications.tunapp

TunnelApp

simple module

C++ definition

Relays packets between a pre-existing tunnel endpoint (a local TUN interface) and a remote network address using either UDP or IPv4 protocols.

It captures packets from the specified TUN interface and forwards them to the configured destination, while also receiving packets from the remote endpoint and injecting them into the TUN interface. Setting up the tunnel is outside the scope of this application. Supports lifecycle operations for controlled startup and shutdown.

<b>See also:</b> TunInterface

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Extends

Name Type Description
SimpleModule simple module

Base module for all INET simple modules.

Parameters

Name Type Default value Description
displayStringTextFormat string ""

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

interfaceTableModule string
interface string
protocol string "udp"
destinationAddress string ""
destinationPort int -1
localPort int -1
stopOperationExtraTime double -1s

Extra time after the lifecycle stop operation finishes

stopOperationTimeout double 2s

Timeout value for the lifecycle stop operation

Properties

Name Value Description
class TunnelApp
lifecycleSupport
display i=block/app

Gates

Name Direction Size Description
socketIn input
socketOut output

Source code

//
// Relays packets between a pre-existing tunnel endpoint (a local TUN interface)
// and a remote network address using either UDP or IPv4 protocols.
//
// It captures packets from the specified TUN interface and forwards them to the
// configured destination, while also receiving packets from the remote endpoint
// and injecting them into the TUN interface. Setting up the tunnel is outside
// the scope of this application. Supports lifecycle operations for controlled
// startup and shutdown.
//
// @see TunInterface
//
simple TunnelApp extends SimpleModule like IApp
{
    parameters:
        @class(TunnelApp);
        string interfaceTableModule;
        string interface;
        string protocol @enum("udp","ipv4") = default("udp");
        string destinationAddress = default("");
        int destinationPort = default(-1);
        int localPort = default(-1);
        @lifecycleSupport;
        double stopOperationExtraTime @unit(s) = default(-1s);    // Extra time after the lifecycle stop operation finishes
        double stopOperationTimeout @unit(s) = default(2s);    // Timeout value for the lifecycle stop operation
        @display("i=block/app");
    gates:
        input socketIn;
        output socketOut;
}
File: src/inet/applications/tunapp/TunnelApp.ned