Udp

Package: inet.transportlayer.udp

Udp

simple module

UDP protocol implementation, for IPv4 (Ipv4) and IPv6 (Ipv6).

The UDP protocol header is represented by the class UdpHeader.

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.

When UDP receives an ICMP error (IcmpHeader or Icmpv6Header) that refers to an UDP socket, it reports the error to the corresponding application by sending a message with kind UDP_I_ERROR.

Communication with the IP (IPv4/IPv6) layer

The Udp model relies on sending and receiving L3AddressReq/L3AddressInd tags attached to UDP packets.

CRC operation modes for outgoing UDP packets (crcMode parameter in UDP module):

  • "disabled" means the outgoing packet will have its CRC set to 0 (serializable)
  • "declared" means the outgoing packet will have the correct CRC declared without actually computing it, the value is set to 0xC00D (not serializable)
  • "computed" means the outgoing packet will have the correctly computed CRC as defined by the RFC (serializable) CRC operation modes for incoming UDP packets (crcMode field in UdpHeader chunk):
  • CRC_DISABLED means the incoming packet must have its CRC set to 0 (serializable)
  • CRC_DECLARED_CORRECT means the incoming packet is assumed to have a correct CRC without the actual value (not serializable)
  • CRC_DECLARED_INCORRECT means the incoming packet is assumed to have an incorrect CRC without the actual value (not serializable)
  • CRC_COMPUTED means the incoming packet has a potentially incorrect CRC that is to be verified as defined by the RFC (serializable) The incoming packet also fails the CRC verification if any relevant chunk is marked incorrect.

See also: UdpHeader, UdpControlInfo, UdpCommandCode

Inheritance diagram

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

Parameters

Name Type Default value Description
interfaceTableModule string

The path to the InterfaceTable module

icmpModule string "^.ipv4.icmp"
icmpv6Module string "^.ipv6.icmpv6"
crcMode string "declared"
defaultMulticastLoop bool true

Properties

Name Value Description
display i=block/transport
selfMessageKinds

kind not used in self messages or model doesn't use any self message

directSendKinds

kind not used in sendDirect() messages or model doesn't use any sendDirect()

Gates

Name Direction Size Description
appIn input
ipIn input
appOut output
ipOut output

Signals

Name Type Unit
packetReceived cPacket
packetSent cPacket
packetReceivedFromUpper cPacket
packetReceivedFromLower cPacket
packetDropped inet::Packet
packetSentToLower cPacket
packetSentToUpper cPacket

Statistics

Name Title Source Record Unit Interpolation Mode
packetReceived packets received packetReceived count, sum(packetBytes), vector(packetBytes) none
passedUpPk packets passed up packetSentToUpper count, vector(count) none
packetSent packets sent packetSent count, sum(packetBytes), vector(packetBytes) none
droppedPkBadChecksum packets dropped (checksum error) packetDropReasonIsIncorrectlyReceived(packetDropped) count, vector(count) none
droppedPkWrongPort packets dropped (wrong port) packetDropReasonIsNoPortFound(packetDropped) count, vector(count) none

Direct method calls (observed)

call tofunctioninfo
MessageDispatcherinet::MessageDispatcher::arrivedarrived
MessageDispatcherinet::MessageDispatcher::handleRegisterProtocolhandleRegisterProtocol
MessageDispatcherinet::MessageDispatcher::handleRegisterServicehandleRegisterService
PcapRecorderinet::PcapRecorder::receiveSignalpacketReceivedFromLower
PcapRecorderinet::PcapRecorder::receiveSignalpacketSentToLower
MacForwardingTableConfiguratorinet::MacForwardingTableConfigurator::receiveSignalipv4McastChange
InterfaceTableinet::InterfaceTable::interfaceChangedinterfaceChanged
Icmpv6inet::Icmpv6::sendErrorMessagesendErrorMessage(datagram, type=%d, code=%d)
Icmpinet::Icmp::sendErrorMessagesendErrorMessage(datagram, type=%d, code=%d)
Igmpv2inet::Igmpv2::receiveSignalipv4MulticastGroupJoined
Igmpv2inet::Igmpv2::receiveSignalipv4MulticastGroupLeft
Ipv4inet::Ipv4::registerHookregisterHook()
Ipv6inet::Ipv6::registerHookregisterHook()

Called methods (observed)

functioninfocall from
inet::Udp::handleOperationStagehandleOperationStageScenarioManager, SimpleEpEnergyManagement, SimpleEpEnergyStorage

Incoming messages (observed)

gatemsgkindctrlsrcModuletags
appInPacket0 (UdpCommandCode::UDP_C_DATA)DhcpClientDispatchProtocolReq, InterfaceReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)DhcpServerDispatchProtocolReq, InterfaceReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)NetPerfMeterDispatchProtocolReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)TunnelAppDispatchProtocolReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)UdpBasicAppDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)UdpBasicBurstDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)UdpEchoAppDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)UdpSocketIoDirectionTag, DispatchProtocolReq, PacketProtocolTag, SocketReq, VlanReq?
appInPacket0 (UdpCommandCode::UDP_C_DATA)UdpVideoStreamClientDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)UdpVideoStreamServerDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)SimpleVoipSenderDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)VoipStreamSenderDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)LdpDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)AodvDispatchProtocolReq, HopLimitReq, InterfaceReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)RipDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq, InterfaceReq?
appInPacket0 (UdpCommandCode::UDP_C_DATA)RtcpDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInPacket0 (UdpCommandCode::UDP_C_DATA)RtpDispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandDhcpClientDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandDhcpServerDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandNetPerfMeterDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandTunnelAppDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandUdpBasicAppDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandUdpBasicBurstDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandUdpEchoAppDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandUdpSinkDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandUdpSocketIoDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandUdpVideoStreamClientDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandUdpVideoStreamServerDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandSimpleVoipReceiverDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandSimpleVoipSenderDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandVoipStreamReceiverDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandVoipStreamSenderDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandLdpDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandAodvDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandRipDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandRtcpDispatchProtocolReq, SocketReq
appInRequest1 (UdpCommandCode::UDP_C_BIND)UdpBindCommandRtpDispatchProtocolReq, SocketReq
appInRequest2 (UdpCommandCode::UDP_C_CONNECT)UdpConnectCommandNetPerfMeterDispatchProtocolReq, SocketReq
appInRequest2 (UdpCommandCode::UDP_C_CONNECT)UdpConnectCommandTunnelAppDispatchProtocolReq, SocketReq
appInRequest2 (UdpCommandCode::UDP_C_CONNECT)UdpConnectCommandUdpSocketIoDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpJoinMulticastGroupsCommandUdpBasicAppDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpJoinMulticastGroupsCommandUdpEchoAppDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpJoinMulticastGroupsCommandUdpSinkDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpJoinMulticastGroupsCommandUdpSocketIoDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpJoinMulticastGroupsCommandRipDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpJoinMulticastGroupsCommandRtcpDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpJoinMulticastGroupsCommandRtpDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpLeaveMulticastGroupsCommandUdpSinkDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpSetBroadcastCommandDhcpClientDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpSetBroadcastCommandDhcpServerDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpSetBroadcastCommandUdpSinkDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpSetBroadcastCommandAodvDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpSetMulticastInterfaceCommandLdpDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpSetMulticastLoopCommandLdpDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpSetMulticastLoopCommandRipDispatchProtocolReq, SocketReq
appInRequest3 (UdpCommandCode::UDP_C_SETOPTION)UdpSetTimeToLiveCommandRipDispatchProtocolReq, SocketReq
appInRequest4 (UdpCommandCode::UDP_C_CLOSE)UdpCloseCommandDhcpClientDispatchProtocolReq, SocketReq
appInRequest4 (UdpCommandCode::UDP_C_CLOSE)UdpCloseCommandDhcpServerDispatchProtocolReq, SocketReq
appInRequest4 (UdpCommandCode::UDP_C_CLOSE)UdpCloseCommandUdpBasicAppDispatchProtocolReq, SocketReq
appInRequest4 (UdpCommandCode::UDP_C_CLOSE)UdpCloseCommandUdpBasicBurstDispatchProtocolReq, SocketReq
appInRequest4 (UdpCommandCode::UDP_C_CLOSE)UdpCloseCommandUdpSinkDispatchProtocolReq, SocketReq
appInRequest4 (UdpCommandCode::UDP_C_CLOSE)UdpCloseCommandUdpVideoStreamClientDispatchProtocolReq, SocketReq
appInRequest4 (UdpCommandCode::UDP_C_CLOSE)UdpCloseCommandLdpDispatchProtocolReq, SocketReq
appInRequest4 (UdpCommandCode::UDP_C_CLOSE)UdpCloseCommandAodvDispatchProtocolReq, SocketReq
appInRequest4 (UdpCommandCode::UDP_C_CLOSE)UdpCloseCommandRipDispatchProtocolReq, SocketReq
ipInPacket0Icmpv6DispatchProtocolReq, L3AddressInd, PacketProtocolTag, DispatchProtocolInd?, DscpInd?, EcnInd?, HopLimitInd?, InterfaceInd?, NetworkProtocolInd?, TosInd?
ipInPacket0IcmpDispatchProtocolReq, L3AddressInd, PacketProtocolTag, DscpInd?, EcnInd?, HopLimitInd?, InterfaceInd?, MacAddressInd?, NetworkProtocolInd?, TosInd?
ipInPacket0Ipv4DispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd, DirectionTag?, DropEligibleInd?, EncapsulationProtocolInd?, ErrorRateInd?, FragmentTag?, Ieee802SapInd?, MacAddressInd?, PcpInd?, SequenceNumberInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, StreamInd?, UserPriorityInd?, VlanInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
ipInPacket0Ipv6DispatchProtocolInd, DispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd, MacAddressInd?
ipInPacket4Ipv4DispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd

Outgoing messages (observed)

gatemsgkindctrldestModuletags
appOutIndication1 (UdpStatusInd::UDP_I_ERROR)UdpErrorIndicationUdpBasicAppL3AddressInd, L4PortInd, SocketInd
appOutIndication1 (UdpStatusInd::UDP_I_ERROR)UdpErrorIndicationUdpBasicBurstL3AddressInd, L4PortInd, SocketInd
appOutIndication1 (UdpStatusInd::UDP_I_ERROR)UdpErrorIndicationUdpEchoAppL3AddressInd, L4PortInd, SocketInd
appOutIndication1 (UdpStatusInd::UDP_I_ERROR)UdpErrorIndicationUdpVideoStreamServerL3AddressInd, L4PortInd, SocketInd
appOutIndication1 (UdpStatusInd::UDP_I_ERROR)UdpErrorIndicationRipL3AddressInd, L4PortInd, SocketInd
appOutIndication2 (UdpStatusInd::UDP_I_SOCKET_CLOSED)UdpSocketClosedIndicationDhcpClientSocketInd
appOutIndication2 (UdpStatusInd::UDP_I_SOCKET_CLOSED)UdpSocketClosedIndicationDhcpServerSocketInd
appOutIndication2 (UdpStatusInd::UDP_I_SOCKET_CLOSED)UdpSocketClosedIndicationUdpBasicAppSocketInd
appOutIndication2 (UdpStatusInd::UDP_I_SOCKET_CLOSED)UdpSocketClosedIndicationUdpBasicBurstSocketInd
appOutIndication2 (UdpStatusInd::UDP_I_SOCKET_CLOSED)UdpSocketClosedIndicationUdpSinkSocketInd
appOutIndication2 (UdpStatusInd::UDP_I_SOCKET_CLOSED)UdpSocketClosedIndicationUdpVideoStreamClientSocketInd
appOutIndication2 (UdpStatusInd::UDP_I_SOCKET_CLOSED)UdpSocketClosedIndicationLdpSocketInd
appOutIndication2 (UdpStatusInd::UDP_I_SOCKET_CLOSED)UdpSocketClosedIndicationRipSocketInd
appOutPacket0 (UdpStatusInd::UDP_I_DATA)DhcpClientDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, MacAddressInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, ErrorRateInd?, Ieee802SapInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)DhcpServerDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, MacAddressInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd
appOutPacket0 (UdpStatusInd::UDP_I_DATA)NetPerfMeterDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd
appOutPacket0 (UdpStatusInd::UDP_I_DATA)TunnelAppDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd
appOutPacket0 (UdpStatusInd::UDP_I_DATA)UdpBasicAppDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, DispatchProtocolInd?, ErrorRateInd?, Ieee802SapInd?, MacAddressInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)UdpBasicBurstDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, MacAddressInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)UdpEchoAppDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, DispatchProtocolInd?, ErrorRateInd?, Ieee802SapInd?, MacAddressInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)UdpSinkDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, DirectionTag?, EncapsulationProtocolInd?, ErrorRateInd?, Ieee802SapInd?, MacAddressInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, UserPriorityInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)UdpSocketIoDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, DirectionTag?, DropEligibleInd?, EncapsulationProtocolInd?, FragmentTag?, MacAddressInd?, PcpInd?, SequenceNumberInd?, StreamInd?, UserPriorityInd?, VlanInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)UdpVideoStreamClientDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, ErrorRateInd?, Ieee802SapInd?, MacAddressInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)UdpVideoStreamServerDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, ErrorRateInd?, Ieee802SapInd?, MacAddressInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)SimpleVoipReceiverDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd
appOutPacket0 (UdpStatusInd::UDP_I_DATA)VoipStreamReceiverDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, MacAddressInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)AodvDscpInd, EcnInd, ErrorRateInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, MacAddressInd, NetworkProtocolInd, SignalPowerInd, SignalTimeInd, SnirInd, SocketInd, TosInd, TransportProtocolInd, Ieee802SapInd?, UserPriorityInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)RipDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd, DispatchProtocolInd?, MacAddressInd?
appOutPacket0 (UdpStatusInd::UDP_I_DATA)RtcpDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd
appOutPacket0 (UdpStatusInd::UDP_I_DATA)RtpDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, SocketInd, TosInd, TransportProtocolInd
ipOutPacket0Ipv4DispatchProtocolReq, L3AddressReq, MulticastReq, PacketProtocolTag, TransportProtocolInd, DirectionTag?, HopLimitReq?, InterfaceReq?, VlanReq?
ipOutPacket0Ipv6DispatchProtocolReq, L3AddressReq, MulticastReq, PacketProtocolTag, TransportProtocolInd, HopLimitReq?, InterfaceReq?
ipOutPacket0NextHopForwardingDispatchProtocolReq, L3AddressReq, MulticastReq, PacketProtocolTag, TransportProtocolInd

Packet operations (observed)

chunkTypepacketAction
peekDataAsBytes, peekDataAt, setFrontOffset, trim
BytesChunkpeekDataAt
IcmpHeaderpeekAtFront, popAtFront
Icmpv6HeaderpeekAtFront, popAtFront
Ipv4HeaderinsertAtFront, popAtFront
Ipv6HeaderinsertAtFront, popAtFront
UdpHeaderinsertAtFront, peekAtFront, popAtFront

Shared Tagging operations (observed)

tagTypetagAction
DispatchProtocolReqaddTagIfAbsent, removeTagIfPresent
ErrorRateIndfindTag
HopLimitReqaddTag, findTag
InterfaceIndgetTag
InterfaceReqaddTagIfAbsent, findTag
L3AddressIndaddTag, getTag
L3AddressReqaddTagIfAbsent
L4PortIndaddTag, addTagIfAbsent
L4PortReqremoveTagIfPresent
MulticastReqaddTag, findTag
NetworkProtocolIndgetTag
PacketProtocolTagaddTagIfAbsent, getTag, removeTag, removeTagIfPresent
SocketIndaddTag, addTagIfAbsent
SocketReqgetTag, removeTag
TransportProtocolIndaddTagIfAbsent

Tagging operations (observed)

tagTypetagAction
inet::Ipv4InterfaceDatagetTagForUpdate
inet::Ipv6InterfaceDatagetTagForUpdate

Source code

//
// UDP protocol implementation, for IPv4 (~Ipv4) and IPv6 (~Ipv6).
//
// The UDP protocol header is represented by the class ~UdpHeader.
//
// <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.
//
// When UDP receives an ICMP error (~IcmpHeader or ~Icmpv6Header)
// that refers to an UDP socket, it reports the error to the corresponding
// application by sending a message with kind UDP_I_ERROR.
//
// <b>Communication with the IP (IPv4/IPv6) layer</b>
//
// The ~Udp model relies on sending and receiving ~L3AddressReq/~L3AddressInd
// tags attached to UDP packets.
//
// CRC operation modes for outgoing UDP packets (crcMode parameter in UDP module):
//  - "disabled" means the outgoing packet will have its CRC set to 0 (serializable)
//  - "declared" means the outgoing packet will have the correct CRC declared
//     without actually computing it, the value is set to 0xC00D (not serializable)
//  - "computed" means the outgoing packet will have the correctly computed CRC
//     as defined by the RFC (serializable)
// CRC operation modes for incoming UDP packets (crcMode field in ~UdpHeader chunk):
//  - CRC_DISABLED means the incoming packet must have its CRC set to 0 (serializable)
//  - CRC_DECLARED_CORRECT means the incoming packet is assumed to have a
//    correct CRC without the actual value (not serializable)
//  - CRC_DECLARED_INCORRECT means the incoming packet is assumed to have an
//    incorrect CRC without the actual value (not serializable)
//  - CRC_COMPUTED means the incoming packet has a potentially incorrect CRC
//    that is to be verified as defined by the RFC (serializable)
// The incoming packet also fails the CRC verification if any relevant chunk is marked incorrect.
//
// @see ~UdpHeader, ~UdpControlInfo, ~UdpCommandCode
//
simple Udp like IUdp
{
    parameters:
        string interfaceTableModule;   // The path to the InterfaceTable module
        string icmpModule = default("^.ipv4.icmp");
        string icmpv6Module = default("^.ipv6.icmpv6");
        string crcMode @enum("disabled","declared","computed") = default("declared");
        bool defaultMulticastLoop = default(true);
        @display("i=block/transport");
        @signal[packetSentToUpper](type=cPacket);
        @signal[packetReceivedFromUpper](type=cPacket);
        @signal[packetSentToLower](type=cPacket);
        @signal[packetReceivedFromLower](type=cPacket);
        @signal[packetDropped](type=inet::Packet);
        @signal[packetSent](type=cPacket);
        @signal[packetReceived](type=cPacket);
        @statistic[packetSent](title="packets sent"; source=packetSent; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[packetReceived](title="packets received"; source=packetReceived; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[passedUpPk](title="packets passed up"; source=packetSentToUpper; record=count,"vector(count)"; interpolationmode=none);
        @statistic[droppedPkWrongPort](title="packets dropped (wrong port)"; source=packetDropReasonIsNoPortFound(packetDropped); record=count,"vector(count)"; interpolationmode=none);
        @statistic[droppedPkBadChecksum](title="packets dropped (checksum error)"; source=packetDropReasonIsIncorrectlyReceived(packetDropped); record=count,"vector(count)"; interpolationmode=none);
        @selfMessageKinds();    // kind not used in self messages or model doesn't use any self message
        @directSendKinds();     // kind not used in sendDirect() messages or model doesn't use any sendDirect()

    gates:
        input appIn @labels(UdpControlInfo/down) @messageKinds(inet::UdpCommandCode);
        input ipIn @labels(UdpHeader,Ipv4ControlInfo/up,Ipv6ControlInfo/up);
        output appOut @labels(UdpControlInfo/up) @messageKinds(inet::UdpStatusInd);
        output ipOut @labels(UdpHeader,Ipv4ControlInfo/down,Ipv6ControlInfo/down);
}

File: src/inet/transportlayer/udp/Udp.ned