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
Usage diagram
The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.
Inheritance diagram
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.
Extends
Name | Type | Description |
---|---|---|
NetworkHeaderBase | class | (no description) |
Fields
Name | Type | Description |
---|---|---|
chunkLength | b | |
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 |
sourceAddress | L3Address | |
destinationAddress | L3Address | |
protocol | Protocol | |
mutable | bool | |
complete | bool | |
correct | bool | |
properlyRepresented | bool | |
rawBin | string[] | |
rawHex | string[] | |
tags | RegionTagSet::cObjectRegionTag[] |
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