Ipv4

Package: inet.networklayer.ipv4

Ipv4

simple module

Implements the IPv4 protocol. The protocol header is represented by the Ipv4Header message class.

Interfacing with higher layer protocols

To send a packet over IPv4 from a higher layer protocol, the module should fill in an L3AddressReq object, attach it to the packet with the Packets's addTag() method, then send the packet to the Ipv4 module.

When Ipv4 sends up a packet to a higher layer protocol, it will also attach an L3AddressInd to the packet, with the source and destination IPv4 addresses of the IPv4 datagram in which the packet arrived.

Ipv4 can serve several higher-layer protocols. The higher layer protocols should call registerProtocol with their gate towards the Ipv4 module, for fill up the protocol-to-gateindex map. When delivering packets to them, the output gate is determined from the Protocol in the IPv4 header.

Routing and interfacing with lower layers

The routing table is stored in the module Ipv4RoutingTable. When a datagram needs to be routed, Ipv4 queries Ipv4RoutingTable for the output interface (or "port") and next hop address of the packet. This is done by directly calling C++ methods (such as findBestMatchingRoute(destAddress)) of Ipv4RoutingTable. No message exchange with Ipv4RoutingTable takes place.

A routed datagram will be sent to the queueOut, which is expected to be connected to INetworkInterface modules.

Routing protocol implementations (e.g. OSPF and ISIS) can also query and manipulate the route table by calling Ipv4RoutingTable's methods in C++.

Working with Arp

Ipv4 module subscribe to arpResolutionCompleted and arpResolutionFailed signals on Arp module. The Arp module accessed via arpOut gate, should not insert any module between Ipv4 and Arp. Before Ipv4 module send down a packet to lower layer, ask MacAddress of next hop from Arp via method call. If MacAddress unspecified, then start address resolution via Arp method call and insert packet to a queue specified by next hop addr. When received a arpResolutionCompleted, then send packets from queue of next hop addr. When received a arpResolutionFailed, then drop packets from queue of next hop addr. When Ipv4 module received an ARP packet from Lower Layer on some queueIn gate, then send out this packet on arpOut gate. When received a packet on arpIn gate, then send out this packet on the specified queueOut gate.

Performance model, QoS

In the current form, Ipv4 contains a FIFO which queues up Ipv4 datagrams; datagrams are processed in order. The processing time is determined by the procDelay module parameter.

The current performance model comes from the QueueBase C++ base class. If you need a more sophisticated performance model, you may change the module implementation (the Ipv4 class), and: (1) override the startService() method which determines processing time for a packet, or (2) use a different base class.

See also: Ipv4RoutingTable, Arp

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

routingTableModule string
arpModule string
icmpModule string
crcMode string "declared"
timeToLive int 32
multicastTimeToLive int 32
fragmentTimeout double 60s
limitedBroadcast bool false

send out limited broadcast packets comming from higher layer

directBroadcastInterfaces string ""

list of interfaces that direct broadcast is enabled (by default direct broadcast is disabled on all interfaces)

Properties

Name Value Description
display i=block/routing

Gates

Name Direction Size Description
transportIn input
transportOut output
queueIn input
queueOut output

Signals

Name Type Unit
ipv4DataOnNonrpf inet::Ipv4Header
packetReceivedFromUpper cPacket
packetReceivedFromLower cPacket
packetDropped cPacket
packetSentToLower cPacket
ipv4DataOnRpf inet::Ipv4Header
ipv4MdataRegister inet::Packet
packetSentToUpper cPacket
ipv4NewMulticast inet::Ipv4Header

Statistics

Name Title Source Record Unit Interpolation Mode
packetDropForwardingDisabled packet drop: forwarding disabled packetDropReasonIsForwardingDisabled(packetDropped) count, sum(packetBytes), vector(packetBytes) none
packetDropAddressResolutionFailed packet drop: address resolution failed packetDropReasonIsAddressResolutionFailed(packetDropped) count, sum(packetBytes), vector(packetBytes) none
packetDropUndefined packet drop: undefined packetDropReasonIsUndefined(packetDropped) count, sum(packetBytes), vector(packetBytes) none
packetDropHopLimitReached packet drop: hop limit reached packetDropReasonIsHopLimitReached(packetDropped) count, sum(packetBytes), vector(packetBytes) none
packetDropNoInterfaceFound packet drop: no interface found packetDropReasonIsNoInterfaceFound(packetDropped) count, sum(packetBytes), vector(packetBytes) none
packetDropNoRouteFound packet drop: no route found packetDropReasonIsNoRouteFound(packetDropped) count, sum(packetBytes), vector(packetBytes) none

Direct method calls (observed)

call tofunctioninfo
MessageDispatcherinet::MessageDispatcher::arrivedarrived
MessageDispatcherinet::MessageDispatcher::handleRegisterProtocolhandleRegisterProtocol
MessageDispatcherinet::MessageDispatcher::handleRegisterServicehandleRegisterService
PcapRecorderinet::PcapRecorder::receiveSignalpacketReceivedFromLower
Arpinet::Arp::resolveL3AddressresolveMACAddress(%s,%s)
GlobalArpinet::GlobalArp::resolveL3AddressresolveL3Address
InterfaceTableinet::InterfaceTable::findFirstLoopbackInterfacefindFirstLoopbackInterface
InterfaceTableinet::InterfaceTable::findFirstMulticastInterfacefindFirstMulticastInterface
NetfilterInfoHookinet::NetfilterInfoHook::datagramForwardHookdatagramForwardHook
NetfilterInfoHookinet::NetfilterInfoHook::datagramLocalInHookdatagramLocalInHook
NetfilterInfoHookinet::NetfilterInfoHook::datagramLocalOutHookdatagramLocalOutHook
NetfilterInfoHookinet::NetfilterInfoHook::datagramPostRoutingHookdatagramPostRoutingHook
NetfilterInfoHookinet::NetfilterInfoHook::datagramPreRoutingHookdatagramPreRoutingHook
MatrixCloudDelayerinet::MatrixCloudDelayer::datagramForwardHookdatagramForwardHook
Icmpinet::Icmp::sendErrorMessagesendErrorMessage(datagram, type=%d, code=%d)
Ipv4RoutingTableinet::Ipv4RoutingTable::findBestMatchingMulticastRoutegetMulticastRoutesFor(%u.%u.%u.%u, %u.%u.%u.%u)
Ipv4RoutingTableinet::Ipv4RoutingTable::findBestMatchingRoutefindBestMatchingRoute(%u.%u.%u.%u)
Ipv4RoutingTableinet::Ipv4RoutingTable::findInterfaceByLocalBroadcastAddressfindInterfaceByLocalBroadcastAddress(%u.%u.%u.%u)
Ipv4RoutingTableinet::Ipv4RoutingTable::getInterfaceByAddressgetInterfaceByAddress(%u.%u.%u.%u)
Ipv4RoutingTableinet::Ipv4RoutingTable::getInterfaceForDestAddrgetInterfaceForDestAddr(%u.%u.%u.%u)
Ipv4RoutingTableinet::Ipv4RoutingTable::isLocalAddressisLocalAddress(%u.%u.%u.%u)
Ipv4RoutingTableinet::Ipv4RoutingTable::isLocalBroadcastAddressisLocalBroadcastAddress(%u.%u.%u.%u)
Aodvinet::aodv::Aodv::datagramForwardHookdatagramForwardHook
Aodvinet::aodv::Aodv::datagramLocalOutHookdatagramLocalOutHook
Aodvinet::aodv::Aodv::datagramPreRoutingHookdatagramPreRoutingHook
Dymoinet::dymo::Dymo::datagramLocalOutHookdatagramLocalOutHook
Dymoinet::dymo::Dymo::datagramPreRoutingHookdatagramPreRoutingHook
Gpsrinet::Gpsr::datagramLocalOutHookdatagramLocalOutHook
Gpsrinet::Gpsr::datagramPreRoutingHookdatagramPreRoutingHook
PimDminet::PimDm::receiveSignalipv4DataOnNonrpf
PimDminet::PimDm::receiveSignalipv4DataOnRpf
PimDminet::PimDm::receiveSignalipv4NewMulticast
PimSminet::PimSm::receiveSignalipv4DataOnRpf
PimSminet::PimSm::receiveSignalipv4MdataRegister
PimSminet::PimSm::receiveSignalipv4NewMulticast
SctpCrcInsertioninet::sctp::SctpCrcInsertion::datagramPostRoutingHookdatagramPostRoutingHook
TcpCrcInsertionHookinet::tcp::TcpCrcInsertionHook::datagramPostRoutingHookdatagramPostRoutingHook
UdpCrcInsertionHookinet::UdpCrcInsertionHook::datagramPostRoutingHookdatagramPostRoutingHook

Called methods (observed)

functioninfocall from
inet::Ipv4::dropQueuedDatagramdropQueuedDatagram()Aodv
inet::Ipv4::handleOperationStagehandleOperationStageScenarioManager, SimpleEpEnergyManagement, SimpleEpEnergyStorage
inet::Ipv4::handleRegisterProtocolhandleRegisterProtocolMessageDispatcher
inet::Ipv4::handleRegisterServicehandleRegisterServiceMessageDispatcher
inet::Ipv4::receiveSignalarpResolutionCompletedArp
inet::Ipv4::receiveSignalarpResolutionFailedArp
inet::Ipv4::registerHookregisterHook()NetfilterInfoHook, MatrixCloudDelayer, Aodv, Dymo, Gpsr, Sctp, Tcp, TcpLwip, Udp
inet::Ipv4::reinjectQueuedDatagramreinjectDatagram()MatrixCloudDelayer, Aodv, Dymo
inet::Ipv4::unregisterHookunregisterHook()NetfilterInfoHook, MatrixCloudDelayer

Incoming messages (observed)

gatemsgkindctrlsrcModuletags
queueInPacket0MessageDispatcherDirectionTag, DispatchProtocolReq, EncapsulationProtocolInd, InterfaceInd, MacAddressInd, PacketProtocolTag, DropEligibleInd?, FragmentTag?, PcpInd?, SequenceNumberInd?, StreamInd?, UserPriorityInd?, VlanInd?
queueInPacket0AckingMacDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag, DispatchProtocolInd?, ErrorRateInd?, InterfaceReq?, MacAddressReq?, NetworkProtocolInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, SocketReq?
queueInPacket0BMacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
queueInPacket0CsmaCaMacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd, UserPriorityInd
queueInPacket0EthernetEncapsulationDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag, NetworkProtocolInd?
queueInPacket0Ieee80211LlcEpdDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd, Ieee80211ChannelInd, Ieee80211ModeInd
queueInPacket0Ieee80211LlcLpdDispatchProtocolReq, Ieee802SapInd, InterfaceInd, MacAddressInd, PacketProtocolTag, DispatchProtocolInd?, ErrorRateInd?, InterfaceReq?, MacAddressReq?, NetworkProtocolInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, SocketReq?, UserPriorityInd?, LlcProtocolTag?, Ieee80211ChannelInd?, Ieee80211ModeInd?, Ieee80211ModeReq?
queueInPacket0Ieee802154MacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
queueInPacket0Ieee802154NarrowbandMacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
queueInPacket0LMacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
queueInPacket0LoopbackDispatchProtocolReq, InterfaceInd, PacketProtocolTag
queueInPacket0PppDispatchProtocolReq, InterfaceInd, PacketProtocolTag
queueInPacket0ShortcutMacDispatchProtocolReq, InterfaceInd, PacketProtocolTag
queueInPacket0VirtualTunnelDirectionTag, DispatchProtocolReq, DropEligibleInd, EncapsulationProtocolInd, InterfaceInd, MacAddressInd, PacketProtocolTag, PcpInd, UserPriorityInd, VlanInd
queueInPacket0XMacDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
queueInPacket0MplsDispatchProtocolReq, InterfaceInd, PacketProtocolTag
queueInPacket4EthernetEncapsulationDispatchProtocolReq, InterfaceInd, MacAddressInd, PacketProtocolTag
queueInPacket4 (TunSocketIndication::TUN_I_DATA)TunDispatchProtocolReq, InterfaceInd, PacketProtocolTag
transportInPacket0IpvxTrafGenDispatchProtocolReq, L3AddressReq, PacketProtocolTag
transportInPacket0PingAppDispatchProtocolReq, L3AddressReq, PacketProtocolTag, SocketReq
transportInPacket0IcmpDispatchProtocolReq, L3AddressReq, PacketProtocolTag
transportInPacket0Igmpv2DispatchProtocolInd, DispatchProtocolReq, HopLimitReq, InterfaceReq, L3AddressReq, PacketProtocolTag, Ipv4OptionsReq?
transportInPacket0Igmpv3DispatchProtocolInd, DispatchProtocolReq, HopLimitReq, InterfaceReq, Ipv4OptionsReq, L3AddressReq, PacketProtocolTag, DscpReq?
transportInPacket0RsvpTeDispatchProtocolInd, DispatchProtocolReq, L3AddressReq, PacketProtocolTag, DscpInd?, EcnInd?, HopLimitInd?, InterfaceInd?, L3AddressInd?, NetworkProtocolInd?, TosInd?
transportInPacket0LinkStateRoutingDispatchProtocolInd, DispatchProtocolReq, L3AddressReq, PacketProtocolTag
transportInPacket0DsdvDispatchProtocolReq, InterfaceReq, L3AddressReq, PacketProtocolTag
transportInPacket0DymoDispatchProtocolReq, HopLimitReq, L3AddressReq, PacketProtocolTag, InterfaceReq?
transportInPacket0EigrpSplitterDispatchProtocolReq, HopLimitReq, InterfaceReq, L3AddressReq, PacketProtocolTag
transportInPacket0GpsrDispatchProtocolReq, HopLimitReq, L3AddressReq, PacketProtocolTag
transportInPacket0Ospfv2DispatchProtocolReq, HopLimitReq, InterfaceReq, L3AddressReq, PacketProtocolTag
transportInPacket0PimSplitterDispatchProtocolReq, HopLimitReq, InterfaceReq, L3AddressReq, PacketProtocolTag, DispatchProtocolInd?, DscpInd?, EcnInd?, HopLimitInd?, InterfaceInd?, L3AddressInd?, MacAddressInd?, NetworkProtocolInd?, TosInd?
transportInPacket0SctpDispatchProtocolReq, L3AddressReq, PacketProtocolTag, TransportProtocolInd, SocketReq?
transportInPacket0TcpDispatchProtocolReq, L3AddressReq, PacketProtocolTag, TransportProtocolInd, EcnReq?, HopLimitReq?
transportInPacket0TcpLwipDispatchProtocolReq, L3AddressReq, PacketProtocolTag, TransportProtocolInd
transportInPacket0UdpDispatchProtocolReq, L3AddressReq, MulticastReq, PacketProtocolTag, TransportProtocolInd, DirectionTag?, HopLimitReq?, InterfaceReq?, VlanReq?
transportInRequest1Ipv4SocketBindCommandPingAppDispatchProtocolReq, SocketReq
transportInRequest3Ipv4SocketCloseCommandPingAppDispatchProtocolReq, SocketReq

Outgoing messages (observed)

gatemsgkindctrldestModuletags
queueOutPacket0ExampleQosClassifierDispatchProtocolInd, InterfaceReq, MacAddressReq, MulticastReq, NetworkProtocolInd, PacketProtocolTag, TransportProtocolInd
queueOutPacket0QosClassifierDispatchProtocolInd, InterfaceReq, MacAddressReq, MulticastReq, NetworkProtocolInd, PacketProtocolTag, TransportProtocolInd
queueOutPacket0EthernetEncapsulationDispatchProtocolInd, DispatchProtocolReq, EncapsulationProtocolReq, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, DirectionTag?, DscpInd?, EcnInd?, ErrorRateInd?, HopLimitInd?, Ieee802SapInd?, InterfaceInd?, L3AddressInd?, MacAddressInd?, MulticastReq?, SignalPowerInd?, SignalTimeInd?, SnirInd?, SocketReq?, TosInd?, TransportProtocolInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
queueOutPacket0EthernetMacHeaderInserterDispatchProtocolInd, DispatchProtocolReq, EncapsulationProtocolReq, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, TransportProtocolInd, DirectionTag?, EcnInd?, MulticastReq?, VlanReq?
queueOutPacket0Ieee80211LlcEpdDispatchProtocolInd, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, SocketReq?
queueOutPacket0Ieee80211LlcLpdDispatchProtocolInd, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, DirectionTag?, EcnInd?, ErrorRateInd?, Ieee802SapInd?, InterfaceInd?, MacAddressInd?, MulticastReq?, SignalPowerInd?, SignalTimeInd?, SnirInd?, SocketReq?, TransportProtocolInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
queueOutPacket0LoopbackDispatchProtocolInd, InterfaceReq, NetworkProtocolInd, PacketProtocolTag, MulticastReq?, SocketReq?, TransportProtocolInd?
queueOutPacket0ShortcutMacDispatchProtocolInd, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, SocketReq?
queueOutPacket0TunDispatchProtocolInd, InterfaceInd, InterfaceReq, MacAddressInd, NetworkProtocolInd, PacketProtocolTag
queueOutPacket0VirtualTunnelDispatchProtocolInd, EcnInd, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, TransportProtocolInd
queueOutPacket0VlanReqMapperDispatchProtocolInd, DispatchProtocolReq, EcnInd, EncapsulationProtocolReq, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, TransportProtocolInd
queueOutPacket0BehaviorAggregateClassifierDispatchProtocolInd, InterfaceInd, InterfaceReq, NetworkProtocolInd, PacketProtocolTag, MacAddressInd?
queueOutPacket0MultiFieldClassifierDispatchProtocolInd, InterfaceInd, InterfaceReq, MacAddressInd, NetworkProtocolInd, PacketProtocolTag
queueOutPacket0MplsDispatchProtocolInd, InterfaceReq, NetworkProtocolInd, PacketProtocolTag, DscpInd?, EcnInd?, HopLimitInd?, InterfaceInd?, L3AddressInd?, MulticastReq?, TosInd?, TransportProtocolInd?
queueOutPacket0PacketMultiplexerDirectionTag, DispatchProtocolInd, DispatchProtocolReq, EncapsulationProtocolReq, InterfaceReq, MacAddressReq, MulticastReq, NetworkProtocolInd, PacketProtocolTag, TransportProtocolInd
queueOutPacket0RedDropperDispatchProtocolInd, InterfaceInd, InterfaceReq, NetworkProtocolInd, PacketProtocolTag
queueOutPacket0DropTailQueueDispatchProtocolInd, InterfaceReq, NetworkProtocolInd, PacketProtocolTag, DirectionTag?, EcnInd?, ErrorRateInd?, InterfaceInd?, MacAddressInd?, MacAddressReq?, MulticastReq?, SignalPowerInd?, SignalTimeInd?, SnirInd?, SocketReq?, TransportProtocolInd?, UserPriorityInd?
queueOutPacket4EthernetEncapsulationDispatchProtocolInd, DispatchProtocolReq, EncapsulationProtocolReq, InterfaceInd, InterfaceReq, MacAddressReq, NetworkProtocolInd, PacketProtocolTag
transportOutIndication1Ipv4SocketClosedIndicationPingAppSocketInd
transportOutPacket0IpvxTrafSinkDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd
transportOutPacket0PingAppDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, SocketInd, TosInd, DispatchProtocolInd?, ErrorRateInd?, Ieee802SapInd?, InterfaceReq?, MacAddressInd?, MacAddressReq?, SignalPowerInd?, SignalTimeInd?, SnirInd?, UserPriorityInd?, LlcProtocolTag?, Ieee80211ChannelInd?, Ieee80211ModeInd?, Ieee80211ModeReq?
transportOutPacket0IcmpDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd, DispatchProtocolInd?, ErrorRateInd?, Ieee802SapInd?, InterfaceReq?, MacAddressInd?, MacAddressReq?, SignalPowerInd?, SignalTimeInd?, SnirInd?, SocketReq?, UserPriorityInd?, LlcProtocolTag?, Ieee80211ChannelInd?, Ieee80211ModeInd?, Ieee80211ModeReq?
transportOutPacket0Igmpv2DispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd, MacAddressInd?
transportOutPacket0Igmpv3DispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd
transportOutPacket0RsvpTeDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd
transportOutPacket0LinkStateRoutingDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd
transportOutPacket0DsdvDispatchProtocolReq, DscpInd, EcnInd, ErrorRateInd, HopLimitInd, Ieee802SapInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd, TosInd, Ieee80211ChannelInd, Ieee80211ModeInd
transportOutPacket0DymoDispatchProtocolReq, DscpInd, EcnInd, ErrorRateInd, HopLimitInd, Ieee802SapInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd, TosInd, Ieee80211ChannelInd, Ieee80211ModeInd
transportOutPacket0EigrpSplitterDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd
transportOutPacket0GpsrDispatchProtocolReq, DscpInd, EcnInd, ErrorRateInd, HopLimitInd, Ieee802SapInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd, TosInd, Ieee80211ChannelInd, Ieee80211ModeInd
transportOutPacket0Ospfv2DispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd, MacAddressInd?
transportOutPacket0PimSplitterDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd
transportOutPacket0SctpDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd
transportOutPacket0TcpDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd, DirectionTag?, DropEligibleInd?, EncapsulationProtocolInd?, ErrorRateInd?, Ieee802SapInd?, MacAddressInd?, PcpInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, UserPriorityInd?, VlanInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
transportOutPacket0TcpLwipDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd, MacAddressInd?
transportOutPacket0UdpDispatchProtocolReq, 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?
transportOutPacket4TcpDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd
transportOutPacket4UdpDispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, TosInd

Packet operations (observed)

chunkTypepacketAction
peekDataAt, setBackOffset, setFrontOffset, trim
ByteCountChunkinsertAtBack
ChunkremoveAll
Ipv4HeaderinsertAtFront, peekAtFront, popAtFront, removeAtFront
LinkStateMsginsertAtBack
SequenceChunkinsertAtBack
SliceChunkinsertAtBack

Shared Tagging operations (observed)

tagTypetagAction
DispatchProtocolIndaddTagIfAbsent
DispatchProtocolReqaddTagIfAbsent, removeTagIfPresent
DscpIndaddTag, addTagIfAbsent
DscpReqremoveTagIfPresent
EcnIndaddTag, addTagIfAbsent
EcnReqremoveTagIfPresent
EncapsulationProtocolReqaddTagIfAbsent, findTagForUpdate
ErrorRateIndfindTag
FragmentationReqremoveTagIfPresent
HopLimitIndaddTagIfAbsent
HopLimitReqremoveTagIfPresent
InterfaceIndfindTag, getTag
InterfaceReqaddTagIfAbsent, findTag, getTag
Ipv4OptionsReqremoveTagIfPresent
L3AddressIndaddTagIfAbsent
L3AddressReqfindTag, removeTag
MacAddressReqaddTagIfAbsent
MulticastReqfindTag
NetworkProtocolIndaddTagIfAbsent, removeTagIfPresent
NextHopAddressReqaddTagIfAbsent, findTag, removeTag
PacketProtocolTagaddTagIfAbsent, getTag, removeTagIfPresent
SocketIndaddTag, addTagIfAbsent
SocketReqfindTag, getTag
TosIndaddTagIfAbsent
TosReqremoveTagIfPresent

Tagging operations (observed)

tagTypetagAction
inet::Ipv4InterfaceDatagetTag

Source code

//
// Implements the IPv4 protocol. The protocol header is represented
// by the ~Ipv4Header message class.
//
// <b>Interfacing with higher layer protocols</b>
//
// To send a packet over IPv4 from a higher layer protocol, the module should
// fill in an ~L3AddressReq object, attach it to the packet with the Packets's
// addTag() method, then send the packet to the ~Ipv4 module.
//
// When ~Ipv4 sends up a packet to a higher layer protocol, it will also attach
// an ~L3AddressInd to the packet, with the source and destination IPv4 addresses
// of the IPv4 datagram in which the packet arrived.
//
// ~Ipv4 can serve several higher-layer protocols. The higher layer protocols
// should call registerProtocol with their gate towards the ~Ipv4 module,
// for fill up the protocol-to-gateindex map. When delivering packets to them,
// the output gate is determined from the Protocol in the IPv4 header.
//
// <b>Routing and interfacing with lower layers</b>
//
// The routing table is stored in the module ~Ipv4RoutingTable. When a datagram
// needs to be routed, ~Ipv4 queries ~Ipv4RoutingTable for the output interface
// (or "port") and next hop address of the packet. This is done by directly
// calling C++ methods (such as findBestMatchingRoute(destAddress)) of ~Ipv4RoutingTable.
// No message exchange with ~Ipv4RoutingTable takes place.
//
// A routed datagram will be sent to the queueOut, which is expected to be
// connected to ~INetworkInterface modules.
//
// Routing protocol implementations (e.g. OSPF and ISIS) can also query
// and manipulate the route table by calling ~Ipv4RoutingTable's methods in C++.
//
// <b>Working with Arp</b>
//
// Ipv4 module subscribe to arpResolutionCompleted and arpResolutionFailed signals on Arp module.
// The ~Arp module accessed via arpOut gate, should not insert any module between ~Ipv4 and ~Arp.
// Before Ipv4 module send down a packet to lower layer, ask MacAddress of next hop from Arp via
// method call. If MacAddress unspecified, then start address resolution via Arp method call and
// insert packet to a queue specified by next hop addr.
// When received a arpResolutionCompleted, then send packets from queue of next hop addr.
// When received a arpResolutionFailed, then drop packets from queue of next hop addr.
// When Ipv4 module received an ARP packet from Lower Layer on some queueIn gate,
// then send out this packet on arpOut gate. When received a packet on arpIn gate,
// then send out this packet on the specified queueOut gate.
//
// <b>Performance model, QoS</b>
//
// In the current form, ~Ipv4 contains a FIFO which queues up Ipv4 datagrams;
// datagrams are processed in order. The processing time is determined by the
// procDelay module parameter.
//
// The current performance model comes from the QueueBase C++ base class.
// If you need a more sophisticated performance model, you may change the
// module implementation (the Ipv4 class), and: (1) override the startService()
// method which determines processing time for a packet, or (2) use a
// different base class.
//
// @see ~Ipv4RoutingTable, ~Arp
//
simple Ipv4 like IIpv4
{
    parameters:
        string interfaceTableModule;   // The path to the InterfaceTable module
        string routingTableModule;
        string arpModule;
        string icmpModule;
        string crcMode @enum("declared","computed") = default("declared");
        int timeToLive = default(32);
        int multicastTimeToLive = default(32);
        double fragmentTimeout @unit(s) = default(60s);
        bool limitedBroadcast = default(false); // send out limited broadcast packets comming from higher layer
        string directBroadcastInterfaces = default("");   // list of interfaces that direct broadcast is enabled (by default direct broadcast is disabled on all interfaces)
        @display("i=block/routing");
        @signal[packetSentToUpper](type=cPacket);
        @signal[packetReceivedFromUpper](type=cPacket);
        @signal[packetSentToLower](type=cPacket);
        @signal[packetReceivedFromLower](type=cPacket);
        @signal[packetDropped](type=cPacket);
        @signal[ipv4NewMulticast](type=inet::Ipv4Header);
        @signal[ipv4DataOnNonrpf](type=inet::Ipv4Header);
        @signal[ipv4DataOnRpf](type=inet::Ipv4Header);
        @signal[ipv4MdataRegister](type=inet::Packet);
        @statistic[packetDropAddressResolutionFailed](title="packet drop: address resolution failed"; source=packetDropReasonIsAddressResolutionFailed(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);
        @statistic[packetDropHopLimitReached](title="packet drop: hop limit reached"; source=packetDropReasonIsHopLimitReached(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);
        @statistic[packetDropForwardingDisabled](title="packet drop: forwarding disabled"; source=packetDropReasonIsForwardingDisabled(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);
        @statistic[packetDropNoInterfaceFound](title="packet drop: no interface found"; source=packetDropReasonIsNoInterfaceFound(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);
        @statistic[packetDropNoRouteFound](title="packet drop: no route found"; source=packetDropReasonIsNoRouteFound(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);
        @statistic[packetDropUndefined](title="packet drop: undefined"; source=packetDropReasonIsUndefined(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);
    gates:
        input transportIn @labels(Ipv4ControlInfo/down,TcpHeader,UdpHeader,SctpHeader);
        output transportOut @labels(Ipv4ControlInfo/up,TcpHeader,UdpHeader,SctpHeader);
        input queueIn @labels(Ipv4Header,ArpPacket,Ieee802Ctrl);
        output queueOut @labels(Ipv4Header,ArpPacket,Ieee802Ctrl);
}

File: src/inet/networklayer/ipv4/Ipv4.ned