Namespace inet
IPv4Datagram
packetRepresents 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.
Fields
Name | Type | Description |
---|---|---|
version | short | |
headerLength | short | |
srcAddress | IPv4Address | |
destAddress | IPv4Address | |
transportProtocol | int | |
timeToLive | short | |
identification | int | |
moreFragments | bool | |
dontFragment | bool | |
fragmentOffset | int |
bytes, must be multiple of 8 |
totalLengthField | int | -1 means: getTotalLengthField() uses getByteLength() |
typeOfService | unsigned char |
ToS byte |
diffServCodePoint | int |
maps to bits 0-5 of ToS |
explicitCongestionNotification | int |
maps to bits 6-7 of ToS |
options | TLVOptions |
array of option pointers, option pointers owned by datagram |
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. // packet IPv4Datagram { @customize(true); short version = 4; short headerLength = IP_HEADER_BYTES; IPv4Address srcAddress; IPv4Address destAddress; int transportProtocol @enum(IPProtocolId) = IP_PROT_NONE; short timeToLive; int identification; bool moreFragments; bool dontFragment; int fragmentOffset; // bytes, must be multiple of 8 int totalLengthField = -1; // -1 means: getTotalLengthField() uses getByteLength() unsigned char typeOfService; // ToS byte abstract int diffServCodePoint; // maps to bits 0-5 of ToS abstract int explicitCongestionNotification; // maps to bits 6-7 of ToS TLVOptions options; // array of option pointers, option pointers owned by datagram }File: src/inet/networklayer/ipv4/IPv4Datagram.msg