IUDP

Package: inet.transportlayer.contract

IUDP

module interface

UDP protocol interface.

The UDP protocol header is represented by the class UDPPacket.

Communication with clients (applications)

The module can (should) be connected to several applications. For sending an UDP packet, the application should attach an UDPControlInfo object to the payload, and send it to UDP. UDP will also attach an UDPControlInfo object to any payload message in sends up to the application.

For receiving UDP packets, the connected applications should first "bind" to the given UDP port. This can be done by sending an arbitrary message with message kind UDP_C_BIND and an UDPControlInfo attached with srcPort filled in.

If there is only one app which doesn't bind to any port, it will receive all packets.

Communication with the IPv4 (IPv4/IPv6) layer

The UDP model relies on sending and receiving IPv4ControlInfo/IPv6ControlInfo objects attached to UDPPacket objects as control info (see cMessage::setControlInfo()).

See also: UDP, UDPPacket, UDPControlInfo, UDPCommandCode

Inheritance diagram

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

Implemented by

Name Type Description
UDP simple module

UDP protocol implementation, for IPv4 and IPv6.

Used in compound modules

Name Type Description
LDP_LSR compound module

An LDP-capable router.

NetPerfMeterHost compound module

NetPerfMeter application host.

PacketDrillHost compound module

IPv4 host with SCTP, TCP, UDP layers and a packetdrill application. The application has a direct connection to the TunInterface.

Router compound module

IPv4 router that supports wireless, Ethernet, PPP and external interfaces. By default, no wireless and external interfaces are added; the number of Ethernet and PPP ports depends on the external connections.

StandardHost compound module

IPv4 host with SCTP, TCP, UDP layers and applications. IP forwarding is disabled by default (see forwarding).

Properties

Name Value Description
display i=block/transport

Source code

//
// UDP protocol interface.
//
// The UDP protocol header is represented by the class ~UDPPacket.
//
// <b>Communication with clients (applications)</b>
//
// The module can (should) be connected to several applications.
// For sending an UDP packet, the application should attach an ~UDPControlInfo
// object to the payload, and send it to ~UDP.
// ~UDP will also attach an ~UDPControlInfo object to any payload
// message in sends up to the application.
//
// For receiving UDP packets, the connected applications should first
// "bind" to the given UDP port. This can be done by sending an
// arbitrary message with message kind UDP_C_BIND and an ~UDPControlInfo
// attached with srcPort filled in.
//
// If there is only one app which doesn't bind to any port, it will
// receive all packets.
//
// <b>Communication with the IPv4 (IPv4/IPv6) layer</b>
//
// The ~UDP model relies on sending and receiving ~IPv4ControlInfo/~IPv6ControlInfo
// objects attached to ~UDPPacket objects as control info
// (see cMessage::setControlInfo()).
//
// @see ~UDP, ~UDPPacket, ~UDPControlInfo, ~UDPCommandCode
//
moduleinterface IUDP
{
    parameters:
        @display("i=block/transport");

    gates:
        input appIn[] @labels(UDPControlInfo/down);
        input ipIn @labels(UDPPacket,IPv4ControlInfo/up,IPv6ControlInfo/up);
        output appOut[] @labels(UDPControlInfo/up);
        output ipOut @labels(UDPPacket,IPv4ControlInfo/down,IPv6ControlInfo/down);
}
File: src/inet/transportlayer/contract/IUDP.ned