TransportLayerNodeBase.ned

NED File src/inet/node/base/TransportLayerNodeBase.ned

Name Type Description
TransportLayerNodeBase compound module

An extension of the network layer node base with transport layer protocols. Provides support for UDP, TCP, and SCTP, enabling end-to-end communication services for applications.

Source code

//
// Copyright (C) 2020 OpenSim Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//


package inet.node.base;

import inet.common.MessageDispatcher;
import inet.transportlayer.contract.ISctp;
import inet.transportlayer.contract.ITcp;
import inet.transportlayer.contract.IUdp;
import inet.transportlayer.contract.IQuic;

//
// An extension of the network layer node base with transport layer protocols.
// Provides support for UDP, TCP, and SCTP, enabling end-to-end communication
// services for applications.
//
// Adds transport layer capabilities to the node architecture, bridging
// the gap between applications and the network layer. It handles connection management,
// reliability, flow control, and congestion control depending on the transport
// protocol used.
//
module TransportLayerNodeBase extends NetworkLayerNodeBase
{
    parameters:
        bool hasUdp = default(firstAvailableOrEmpty("Udp") != "");
        bool hasTcp = default(firstAvailableOrEmpty("Tcp", "TcpLwip", "TcpNsc") != "");
        bool hasSctp = default(false);
        bool hasQuic = default(false);
        @figure[transportLayer](type=rectangle; pos=250,158; size=1000,134; fillColor=#ff0000; lineColor=#808080; cornerRadius=5; fillOpacity=0.1);
        @figure[transportLayer.title](type=text; pos=1245,163; anchor=ne; text="transport layer");
    submodules:
        udp: <default(firstAvailableOrEmpty("Udp"))> like IUdp if hasUdp {
            @display("p=375,225");
        }
        tcp: <default(firstAvailableOrEmpty("Tcp", "TcpLwip", "TcpNsc"))> like ITcp if hasTcp {
            @display("p=525,225");
        }
        sctp: <default(firstAvailableOrEmpty("Sctp"))> like ISctp if hasSctp {
            @display("p=675,225");
        }
        quic: <default(firstAvailableOrEmpty("Quic"))> like IQuic if hasQuic {
            @display("p=825,226");
        }
        tn: MessageDispatcher {
            @display("p=750,300;b=1000,5,,,,1");
        }
    connections allowunconnected:
        udp.ipOut --> tn.in++ if hasUdp;
        udp.ipIn <-- tn.out++ if hasUdp;

        tcp.ipOut --> tn.in++ if hasTcp;
        tcp.ipIn <-- tn.out++ if hasTcp;

        sctp.ipOut --> tn.in++ if hasSctp;
        tn.out++ --> sctp.ipIn if hasSctp;

        quic.udpOut --> tn.in++ if hasQuic;
        tn.out++ --> quic.udpIn if hasQuic;

        tn.out++ --> ipv4.transportIn if hasIpv4;
        tn.in++ <-- ipv4.transportOut if hasIpv4;

        tn.out++ --> ipv6.transportIn if hasIpv6;
        tn.in++ <-- ipv6.transportOut if hasIpv6;

        tn.out++ --> generic.transportIn if hasGn;
        tn.in++ <-- generic.transportOut if hasGn;

        tn.out++ --> nl.in++;
        tn.in++ <-- nl.out++;
}