Namespace inet
Ipv4Header
classRepresents an Ipv4 datagram.
Uses the following cPacket fields:
- getByteLength() / setByteLength() to represent total datagram length
- hasBitError() / setBitError() to represent datagram correctness
- getTimestamp() / setTimestamp (simtime) used in timestamp option
Additional length fields defined in this class are in bytes.
Only one of the option fields can exist at a time.
TODO cleanup order of fields
Extends
| Name | Type | Description |
|---|---|---|
| NetworkHeaderBase | (unknown -- not in documented files) |
Fields
| Name | Type | Description |
|---|---|---|
| chunkLength | ||
| version | short |
@bit(4) |
| headerLength | B |
@bit(4), bytes, must be multiple of 4 |
| typeOfService | short |
@bit(8) OMNeT++ 6.0: short __dscp @custom @getter(getDscp) @setter(setDscp); // @bit(6), maps to bits 0-5 of ToS, stored in typeOfService short __ecn @custom @getter(getEcn) @setter(setEcn); // @bit(2), maps to bits 6-7 of ToS, stored in typeOfService |
| totalLengthField | B |
@byte(2) |
| identification | uint16_t |
@byte(2) |
| reservedBit | bool |
@bit(1) |
| moreFragments | bool |
@bit(1) |
| dontFragment | bool |
@bit(1) |
| fragmentOffset | uint16_t |
@bit(13), must be multiple of 8 |
| timeToLive | short |
@byte(1) |
| protocolId | IpProtocolId |
@byte(1) |
| crc | uint16_t |
@byte(2) |
| crcMode | CrcMode | |
| srcAddress | Ipv4Address | |
| destAddress | Ipv4Address | |
| options | TlvOptions |
array of option pointers, option pointers owned by datagram |
Packet operations (observed)
| action | module |
|---|---|
| insertAtBack | ApskScalarRadioMedium, PimSm |
| insertAtFront | Ipv4, Gpsr, SctpCrcInsertion, TcpCrcInsertionHook, Udp, UdpCrcInsertionHook |
| insertDataAt | DscpMarker, RedDropper |
| peekAtFront | Icmp, Ipv4, Mpls, PimSm |
| peekDataAt | ExampleQosClassifier, QosClassifier, Icmp, RedDropper |
| popAtFront | PcapRecorder, BehaviorAggregateClassifier, DiffservQueue, MultiFieldClassifier, Ipv4, StreamIdentifier, PacketMultiplexer, PimSm, Udp |
| removeAtFront | Ipv4, Gpsr |
| removeDataAt | DscpMarker, RedDropper |
Source code
// // Represents an Ipv4 datagram. // // Uses the following cPacket fields: // - getByteLength() / setByteLength() to represent total datagram length // - hasBitError() / setBitError() to represent datagram correctness // - getTimestamp() / setTimestamp (simtime) used in timestamp option // // Additional length fields defined in this class are in bytes. // // Only one of the option fields can exist at a time. // // TODO cleanup order of fields class Ipv4Header extends NetworkHeaderBase { chunkLength = IPv4_MIN_HEADER_LENGTH; short version = 4; // @bit(4) B headerLength = IPv4_MIN_HEADER_LENGTH; // @bit(4), bytes, must be multiple of 4 short typeOfService; // @bit(8) // OMNeT++ 6.0: // short __dscp @custom @getter(getDscp) @setter(setDscp); // @bit(6), maps to bits 0-5 of ToS, stored in typeOfService // short __ecn @custom @getter(getEcn) @setter(setEcn); // @bit(2), maps to bits 6-7 of ToS, stored in typeOfService B totalLengthField; // @byte(2) uint16_t identification; // @byte(2) bool reservedBit = false; // @bit(1) bool moreFragments; // @bit(1) bool dontFragment; // @bit(1) uint16_t fragmentOffset; // @bit(13), must be multiple of 8 short timeToLive; // @byte(1) IpProtocolId protocolId = IP_PROT_NONE; // @byte(1) uint16_t crc = 0; // @byte(2) CrcMode crcMode = CRC_MODE_UNDEFINED; Ipv4Address srcAddress; Ipv4Address destAddress; TlvOptions options; // array of option pointers, option pointers owned by datagram }File: src/inet/networklayer/ipv4/Ipv4Header.msg