Namespace inet
IPv4ControlInfo
classControl information for sending/receiving packets over IPv4.
To send a packet over IPv4, fill in an IPv4ControlInfo object, attach it to the packet with the C++ method setControlInfo(), the send it to the IPv4 module.
When sending, the following fields are required:
- protocol: a value from IPProtocolId
- destAddr
Optional fields:
- srcAddr: it will be set to the address of the outgoing interface
- typeOfService: (default: 0)
- timeToLive: default defined as module parameter
- dontFragment: default: false
Not supported:
- options: IPv4 Options currently not used
- Identifier is currently always chosen by the IPv4 layer
When IPv4 delivers a packet to higher layers, it also attaches an IPv4ControlInfo to it. It fills in the following fields:
- srcAddr, destAddr, protocol, TypeOfService: values from the original datagram
- interfaceId: the interface on which the datagram arrived, or -1 if it was created locally
IPv4 also puts the original datagram object into the control info, because it may be needed by higher layers (for example, by ICMP for error reporting).
Extends
Name | Type | Description |
---|---|---|
cObject | (unknown -- not in documented files) |
Fields
Name | Type | Description |
---|---|---|
destAddr | IPv4Address |
destination IPv4 address |
srcAddr | IPv4Address |
source IPv4 address |
interfaceId | int |
interface on which the datagram was received, or should be sent (see InterfaceTable) |
multicastLoop | bool |
if true, sent multicast datagrams will be looped back |
protocol | short |
encapsulated protocol |
typeOfService | unsigned char |
Type of Service byte (low 6 bits: DSCP) |
diffServCodePoint | int |
maps to bits 0-5 of trafficClass |
explicitCongestionNotification | int |
maps to bits 6-7 of trafficClass |
timeToLive | short |
maximum hop count |
dontFragment | bool |
"don't fragment" bit |
Source code
// // Control information for sending/receiving packets over IPv4. // // To send a packet over IPv4, fill in an ~IPv4ControlInfo object, // attach it to the packet with the C++ method setControlInfo(), // the send it to the ~IPv4 module. // // When sending, the following fields are required: // - protocol: a value from ~IPProtocolId // - destAddr // // Optional fields: // - srcAddr: it will be set to the address of the outgoing interface // - typeOfService: (default: 0) // - timeToLive: default defined as module parameter // - dontFragment: default: false // // Not supported: // - options: IPv4 Options currently not used // - Identifier is currently always chosen by the IPv4 layer // // When ~IPv4 delivers a packet to higher layers, it also attaches an ~IPv4ControlInfo // to it. It fills in the following fields: // - srcAddr, destAddr, protocol, TypeOfService: values from the original datagram // - interfaceId: the interface on which the datagram arrived, or -1 if it was // created locally // // ~IPv4 also puts the original datagram object into the control info, because // it may be needed by higher layers (for example, by ~ICMP for error reporting). // class IPv4ControlInfo extends cObject { @customize(true); IPv4Address destAddr; // destination IPv4 address IPv4Address srcAddr; // source IPv4 address int interfaceId = -1; // interface on which the datagram was received, or // should be sent (see ~InterfaceTable) bool multicastLoop; // if true, sent multicast datagrams will be looped back short protocol @enum(IPProtocolId); // encapsulated protocol unsigned char typeOfService; // Type of Service byte (low 6 bits: DSCP) abstract int diffServCodePoint; // maps to bits 0-5 of trafficClass abstract int explicitCongestionNotification; // maps to bits 6-7 of trafficClass short timeToLive; // maximum hop count bool dontFragment; // "don't fragment" bit }File: src/inet/networklayer/contract/ipv4/IPv4ControlInfo.msg