Ipv4Encap

Package: inet.emulation.networklayer.ipv4

Ipv4Encap

simple module

C++ definition

Handles IPv4 encapsulation and decapsulation for network emulation. Adds IPv4 headers to outgoing packets and removes them from incoming packets. Processes packet tags for fields like TOS, DSCP, ECN, and hop limit. Supports socket operations and manages protocol registration for dispatching packets to the appropriate upper layer protocols.

Inheritance diagram

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

Used in compound modules

Name Type Description
ExtLowerIpv4 compound module

Provides IPv4 layer functionality for network emulation that connects the simulation to a real network on the host computer. Sends packets from the simulation to the real network and receives packets from the real network into the simulation using raw sockets. Uses ~Ipv4Encap for packet encapsulation and ~ExtIpv4Socket for the connection to the host's networking stack.

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

Properties

Name Value Description
class Ipv4Encap
display i=block/square

Gates

Name Direction Size Description
upperLayerIn input
upperLayerOut output
lowerLayerIn input
lowerLayerOut output

Source code

//
// Handles IPv4 encapsulation and decapsulation for network emulation. Adds IPv4
// headers to outgoing packets and removes them from incoming packets. Processes
// packet tags for fields like TOS, DSCP, ECN, and hop limit. Supports socket
// operations and manages protocol registration for dispatching packets to the
// appropriate upper layer protocols.
//
simple Ipv4Encap extends SimpleModule
{
    parameters:
        @class(Ipv4Encap);
        @display("i=block/square");
    gates:
        input upperLayerIn;
        output upperLayerOut;
        input lowerLayerIn;
        output lowerLayerOut;
}
File: src/inet/emulation/networklayer/ipv4/Ipv4Encap.ned