Represents an IP datagram.
Uses the following cMessage fields:
Additional length fields defined in this class are in bytes (getTotalLength()=length()/8 and header_length), or 8 bytes (fragment_offset).
Only only one of the option fields can exist at a time.
The following diagram shows usage relationships between types. Unresolved types are missing from the diagram. Click here to see the full picture.
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram. Click here to see the full picture.
Name | Type | Description |
---|---|---|
recordRoute | IPRecordRouteOption | |
timestampOption | IPTimestampOption | |
transportProtocol | int | |
fragmentOffset | int | |
diffServCodePoint | unsigned char | |
destAddress | IPAddress | |
timeToLive | short | |
optionCode | int | |
version | short | |
dontFragment | bool | |
identification | int | |
srcAddress | IPAddress | |
moreFragments | bool | |
headerLength | short | |
sourceRoutingOption | IPSourceRoutingOption |
optionCode determines if strict or loose source routing |
// // Represents an IP datagram. // // Uses the following cMessage fields: // - length () / setBitLength(err) in bits // - hasBitError() / setBitError() // - getTimestamp() / setTimestamp (simtime) used in timestamp option // // Additional length fields defined in this class are in bytes // (getTotalLength()=length()/8 and header_length), or 8 bytes (fragment_offset). // // Only only one of the option fields can exist at a time. // packet IPDatagram { short version = 4; short headerLength = IP_HEADER_BYTES; IPAddress srcAddress; IPAddress destAddress; int transportProtocol enum(IPProtocolId) = IP_PROT_NONE; short timeToLive; int identification; bool moreFragments; bool dontFragment; int fragmentOffset; unsigned char diffServCodePoint; int optionCode enum(IPOption) = IPOPTION_NO_OPTION; //#FIXME modify header length when options are present //#FIXME also: the RFC says that more than one IP-Option is allowed IPRecordRouteOption recordRoute; IPTimestampOption timestampOption; IPSourceRoutingOption sourceRoutingOption; // optionCode determines if strict or loose source routing } // // Some old code regarding options and header length // // header length is always set automatically //short getHeaderLength() { return header_length; } // // fields for options //IPOption optionType() { return option_code; } // // if no option exists, return NULL, // otherwise, return pointer to appropriate structure; // conversion needs to be done by calling function */ //void *optionField();