Class IPControlInfo

File: src/networklayer/contract/IPControlInfo.msg

C++ definition

Control information for sending/receiving packets over IP.

To send a packet over IP, fill in an IPControlInfo object, attach it to the packet with the C++ method setControlInfo(), the send it to the IP module.

When sending, the following fields are required:

Optional fields:

Not supported:

When IP delivers a packet to higher layers, it also attaches an IPControlInfo to it. It fills in the following fields:

IP 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).

Usage diagram:

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram. Click here to see the full picture.

Inheritance diagram:

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram. Click here to see the full picture.

Fields:

Name Type Description
protocol short

encapsulated protocol

dontFragment bool

"don't fragment" bit

interfaceId int

interface on which the datagram was received, or should be sent (see InterfaceTable)

destAddr IPAddress

destination IP address

srcAddr IPAddress

source IP address

diffServCodePoint unsigned char

for QoS

timeToLive short

maximum hop count

Source code:

//
// Control information for sending/receiving packets over \IP.
//
// To send a packet over \IP, fill in an IPControlInfo object,
// attach it to the packet with the C++ method setControlInfo(),
// the send it to the IP 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
// - diffServCodePoint: used in DS_Field (RFC 2474) instead of TOS (default: 0)
// - timeToLive: default defined as module parameter
// - dontFragment: default: false
//
// Not supported:
// - options: \IP Options currently not used
// - Identifier is currently always chosen by the \IP layer
//
// When IP delivers a packet to higher layers, it also attaches an IPControlInfo 
// to it. It fills in the following fields: 
//  - srcAddr, destAddr, protocol, diffServCodePoint: values from the original datagram
//  - interfaceId: the interface on which the datagram arrived, or -1 if it was
//    created locally
//
// IP 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 IPControlInfo
{
    @customize(true);
    IPAddress destAddr;   // destination IP address
    IPAddress srcAddr;    // source IP address
    int interfaceId = -1; // interface on which the datagram was received, or
                          // should be sent (see InterfaceTable)
    short protocol @enum(IPProtocolId);  // encapsulated protocol
    unsigned char diffServCodePoint;  // for QoS
    short timeToLive;     // maximum hop count
    bool dontFragment;    // "don't fragment" bit
}