OMNeT++ Simulation Library  6.0.3
SendOptions Struct Reference

#include <csimplemodule.h>

Description

Options for the cSimpleModule::send() and cSimpleModule::sendDirect() calls.

This class currently allows specifying send delay, propagation delay, duration, and sending a transmission update.

A convenient way to produce an appropriately configured instance for a send() call is by creating a default instance, and chaining mutator methods:

send(msg, SendOptions().updateTx(transmissionId, remainingDuration).duration(duration), "out");

Transmission updates:

A transmission update is needed when the transmission of a packet (sending a cPacket over a connection path that contains a transmission channel, i.e. a channel whose isTransmissionChannel() method returns true) needs to be aborted or preempted, extended, or modified in other unforeseen ways while the transmission is in progress.

Transmission updates are normal packets (cPacket) sent with the updateTx() or finishTx() options. These methods expect a transmission ID which should be determined when sending the original packet, and specified using the transmissionId() method. A transmission can be updated several times, using always the same transmissionId.

The packet in each transmission update conceptually replaces the packet that the peer is going to receive. Updates may be sent while transmission is still ongoing, and, in certain cases, also at the time the packet transmission ends, but not later.

As an example, aborting a transmission is done by sending a packet with a truncated content and a remaining duration of zero.

Receivers that receive the packet at the end of the reception (default) will only receive the final update, the original packet and intermediate updates are absorbed by the simulation kernel.

Receivers that receive the packet at the start of the reception (see cGate::setDeliverImmediately()) should be prepared to receive the original packet and all its updates, and handle them appropriately (i.e. only keep the packet in last update). Transmission updates can be recognized at the receiver end by the cPacket::isUpdate() method returning true. In order to reduce the chance of unprepared modules receiving transmission updates and interpreting them as independent packets leading to erroneous operation, modules will only receive transmission updates if they explicitly declare that they are prepared to handle them by calling cSimpleModule::setTxUpdateSupport(true) beforehand. (If this flag is not set in a module, sending a transmission update to it will result in a runtime error.

See also
cSimpleModule::send(), cSimpleModule::sendDirect

Public Member Functions

 SendOptions ()
 
SendOptionsafter (simtime_t delay)
 
SendOptionspropagationDelay (simtime_t delay)
 
SendOptionsduration (simtime_t duration)
 
SendOptionstransmissionId (txid_t transmissionId)
 
SendOptionsfinishTx (txid_t transmissionId)
 
SendOptionsupdateTx (txid_t transmissionId)
 
SendOptionsupdateTx (txid_t transmissionId, simtime_t remainingDuration)
 
std::string str () const
 

Constructor & Destructor Documentation

◆ SendOptions()

SendOptions ( )
inline

Creates an instance with the default settings.

Member Function Documentation

◆ after()

SendOptions& after ( simtime_t  delay)
inline

Specifies delay for the send operation. Conceptually, this would cause timer to start, and the actual send operation would take place when the timer expires. In practice, for the sake of efficiency, the explicit timer is omitted, and delay is simply applied to the message before it enters the connection path that leads to the destination module. Note that this simplified modeling does not account for changes in the connection path during the delay period, so if modeling those changes are important, you have to use an explicit timer followed by a regular send.

◆ propagationDelay()

SendOptions& propagationDelay ( simtime_t  delay)
inline

Specifies the propagation delay for sendDirect(). It is an error to use this option with send() or sendDelayed().

◆ duration()

SendOptions& duration ( simtime_t  duration)
inline

Specifies an explicit transmission duration. This is only allowed if the connection path contains a transmission channel (a cChannel whose isTransmissionChannel() method returns true). cDatarateChannel, which is the only built-in transmission channel model in OMNeT++, can compute transmission duration from the packet length in bits and the datarate, but allows it to be overridden with this option.

References SendOptions::duration().

Referenced by SendOptions::duration().

◆ transmissionId()

SendOptions& transmissionId ( txid_t  transmissionId)
inline

Specifies the transmission ID for a (non-update) packet. A transmission ID is necessary for sending transmission updates (see finishTx() and updateTx()). It is customary to use the packet's message id as transmission ID.

See also
cMessage::getId(), cPacket::isUpdate()

References SendOptions::transmissionId().

Referenced by SendOptions::transmissionId().

◆ finishTx()

SendOptions& finishTx ( txid_t  transmissionId)
inline

Specifies that this is a transmission update, where the remaining duration is zero. See the comment of this class for an explanation of transmission updates.

See also
cPacket::isUpdate(), cPacket::getRemainingDuration()

References SIMTIME_ZERO.

◆ updateTx() [1/2]

SendOptions& updateTx ( txid_t  transmissionId)
inline

Specifies that this is a transmission update, where the remaining duration should be computed by the channel (as packet duration minus elapsed transmission time). See the comment of this class for an explanation of transmission updates.

See also
cPacket::isUpdate(), cPacket::getRemainingDuration()

◆ updateTx() [2/2]

SendOptions& updateTx ( txid_t  transmissionId,
simtime_t  remainingDuration 
)
inline

Specifies that this is a transmission update, with the given remaining duration. See the comment of this class for an explanation of transmission updates.

See also
cPacket::isUpdate(), cPacket::getRemainingDuration()

◆ str()

std::string str ( ) const

Returns the options in a string form.


The documentation for this struct was generated from the following file: