INET Framework for OMNeT++/OMNEST
inet::queueing::PacketPusherBase Class Reference

#include <PacketPusherBase.h>

Inheritance diagram for inet::queueing::PacketPusherBase:
inet::queueing::PacketProcessorBase inet::queueing::IPacketPusher inet::queueing::IPacketProcessor inet::StringFormat::IDirectiveResolver inet::queueing::IPassivePacketSink inet::queueing::IActivePacketSource inet::ClockUserModuleMixin< PacketPusherBase > inet::AggregatorBase inet::DeaggregatorBase inet::DefragmenterBase inet::DuplicateRemoval inet::EthernetSocketPacketProcessor inet::Forwarding inet::FragmenterBase inet::Ieee8021qSocketPacketProcessor inet::Ieee8022LlcSocketPacketProcessor inet::queueing::PacketDuplicator inet::ReceiveWithAcknowledge inet::ReceiveWithProtocol inet::RelayInterfaceSelector inet::Reordering inet::Resending

Public Member Functions

virtual IPassivePacketSinkgetConsumer (cGate *gate) override
 Returns the passive packet sink where packets are pushed or nullptr if the connected module doesn't implement the interface. More...
 
virtual bool supportsPacketPushing (cGate *gate) const override
 Returns true if the processor supports pushing packets at the given gate. More...
 
virtual bool supportsPacketPulling (cGate *gate) const override
 Returns true if the processor supports pulling packets at the given gate. More...
 
virtual bool canPushSomePacket (cGate *gate) const override
 Returns false if the packet sink is full at the given gate and no more packets can be pushed into it without raising an error. More...
 
virtual bool canPushPacket (Packet *packet, cGate *gate) const override
 Returns true if the given packet can be pushed at the given gate into the packet sink without raising an error. More...
 
virtual void pushPacket (Packet *packet, cGate *gate) override
 Pushes the packet into the packet sink at the given gate. More...
 
virtual void pushPacketStart (Packet *packet, cGate *gate, bps datarate) override
 Starts pushing the packet into the packet sink at the given gate. More...
 
virtual void pushPacketEnd (Packet *packet, cGate *gate) override
 Ends pushing the packet into the packet sink at the given gate. More...
 
virtual void pushPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength=b(0)) override
 Progresses pushing the packet into the packet sink at the given gate. More...
 
virtual void handleCanPushPacketChanged (cGate *gate) override
 Notifies about a change in the possibility of pushing some packet into the passive packet sink at the given gate. More...
 
virtual void handlePushPacketProcessed (Packet *packet, cGate *gate, bool successful) override
 Notifies about the completion of the packet processing for a packet that was pushed earlier independently whether the packet is passed or streamed. More...
 
- Public Member Functions inherited from inet::queueing::PacketProcessorBase
virtual bool supportsPacketSending (cGate *gate) const override
 Returns true if the processor supports sending packets at the given gate. More...
 
virtual bool supportsPacketPassing (cGate *gate) const override
 Returns true if the processor supports passing packets as a whole at the given gate. More...
 
virtual bool supportsPacketStreaming (cGate *gate) const override
 Returns true if the processor supports streaming packets at the given gate. More...
 
virtual const char * resolveDirective (char directive) const override
 
- Public Member Functions inherited from inet::queueing::IPacketProcessor
virtual ~IPacketProcessor ()
 
- Public Member Functions inherited from inet::queueing::IPassivePacketSink
virtual ~IPassivePacketSink ()
 
- Public Member Functions inherited from inet::queueing::IActivePacketSource
virtual ~IActivePacketSource ()
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *message) override
 
- Protected Member Functions inherited from inet::queueing::PacketProcessorBase
virtual int numInitStages () const override
 
virtual void refreshDisplay () const override
 
virtual void handlePacketProcessed (Packet *packet)
 
virtual void checkPacketOperationSupport (cGate *gate) const
 
virtual void checkPacketOperationSupport (cGate *startGate, cGate *endGate) const
 
virtual void animate (Packet *packet, cGate *gate, const SendOptions &sendOptions, Action action) const
 
virtual void animatePacket (Packet *packet, cGate *gate, Action action) const
 
virtual void animatePacketStart (Packet *packet, cGate *gate, bps datarate, long transmissionId, Action action) const
 
virtual void animatePacketStart (Packet *packet, cGate *gate, bps datarate, const SendOptions &sendOptions, Action action) const
 
virtual void animatePacketEnd (Packet *packet, cGate *gate, long transmissionId, Action action) const
 
virtual void animatePacketEnd (Packet *packet, cGate *gate, const SendOptions &sendOptions, Action action) const
 
virtual void animatePacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, long transmissionId, Action action) const
 
virtual void animatePacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, const SendOptions &sendOptions, Action action) const
 
virtual void pushOrSendPacket (Packet *packet, cGate *gate, IPassivePacketSink *consumer)
 
virtual void pushOrSendPacketStart (Packet *packet, cGate *gate, IPassivePacketSink *consumer, bps datarate, int transmissionId)
 
virtual void pushOrSendPacketEnd (Packet *packet, cGate *gate, IPassivePacketSink *consumer, int transmissionId)
 
virtual void pushOrSendPacketProgress (Packet *packet, cGate *gate, IPassivePacketSink *consumer, bps datarate, b position, b extraProcessableLength, int transmissionId)
 
virtual void animatePush (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePushPacket (Packet *packet, cGate *gate) const
 
virtual void animatePushPacketStart (Packet *packet, cGate *gate, bps datarate, long transmissionId) const
 
virtual void animatePushPacketStart (Packet *packet, cGate *gate, bps datarate, const SendOptions &sendOptions) const
 
virtual void animatePushPacketEnd (Packet *packet, cGate *gate, long transmissionId) const
 
virtual void animatePushPacketEnd (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePushPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, long transmissionId) const
 
virtual void animatePushPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, const SendOptions &sendOptions) const
 
virtual void animatePull (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePullPacket (Packet *packet, cGate *gate) const
 
virtual void animatePullPacketStart (Packet *packet, cGate *gate, bps datarate, long transmissionId) const
 
virtual void animatePullPacketStart (Packet *packet, cGate *gate, bps datarate, const SendOptions &sendOptions) const
 
virtual void animatePullPacketEnd (Packet *packet, cGate *gate, long transmissionId) const
 
virtual void animatePullPacketEnd (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePullPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, long transmissionId) const
 
virtual void animatePullPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, const SendOptions &sendOptions) const
 
virtual void dropPacket (Packet *packet, PacketDropReason reason, int limit=-1)
 
virtual void updateDisplayString () const
 

Protected Attributes

cGate * inputGate = nullptr
 
IActivePacketSourceproducer = nullptr
 
cGate * outputGate = nullptr
 
IPassivePacketSinkconsumer = nullptr
 
- Protected Attributes inherited from inet::queueing::PacketProcessorBase
const char * displayStringTextFormat = nullptr
 
int numProcessedPackets = -1
 
b processedTotalLength = b(-1)
 

Additional Inherited Members

- Protected Types inherited from inet::queueing::PacketProcessorBase
enum  Action { PUSH, PULL }
 

Member Function Documentation

◆ canPushPacket()

bool inet::queueing::PacketPusherBase::canPushPacket ( Packet packet,
cGate *  gate 
) const
overridevirtual

Returns true if the given packet can be pushed at the given gate into the packet sink without raising an error.

The packet must not be nullptr. The gate must be a valid gate of this module and it must support pushing packets.

Implements inet::queueing::IPassivePacketSink.

Reimplemented in inet::InterpacketGapInserter, and inet::Resending.

43 {
44  return consumer->canPushPacket(packet, outputGate->getPathEndGate());
45 }

◆ canPushSomePacket()

bool inet::queueing::PacketPusherBase::canPushSomePacket ( cGate *  gate) const
overridevirtual

Returns false if the packet sink is full at the given gate and no more packets can be pushed into it without raising an error.

The gate must be a valid gate of this module and it must support pushing packets.

Implements inet::queueing::IPassivePacketSink.

Reimplemented in inet::InterpacketGapInserter, and inet::Resending.

38 {
39  return consumer->canPushSomePacket(outputGate->getPathEndGate());
40 }

◆ getConsumer()

virtual IPassivePacketSink* inet::queueing::PacketPusherBase::getConsumer ( cGate *  gate)
inlineoverridevirtual

Returns the passive packet sink where packets are pushed or nullptr if the connected module doesn't implement the interface.

The gate parameter must be a valid gate of this module.

Implements inet::queueing::IActivePacketSource.

Reimplemented in inet::InterpacketGapInserter.

33 { return this; }

◆ handleCanPushPacketChanged()

void inet::queueing::PacketPusherBase::handleCanPushPacketChanged ( cGate *  gate)
overridevirtual

Notifies about a change in the possibility of pushing some packet into the passive packet sink at the given gate.

This method is called, for example, when a new packet can be inserted into a queue. It allows the source to push a new packet into the queue.

The gate parameter must be a valid gate of this module.

Implements inet::queueing::IActivePacketSource.

Reimplemented in inet::InterpacketGapInserter, inet::queueing::PacketDelayer, and inet::queueing::PacketDuplicator.

68 {
69  Enter_Method("handleCanPushPacketChanged");
70  if (producer != nullptr)
71  producer->handleCanPushPacketChanged(inputGate->getPathStartGate());
72 }

◆ handleMessage()

void inet::queueing::PacketPusherBase::handleMessage ( cMessage *  message)
overrideprotectedvirtual

Reimplemented in inet::InterpacketGapInserter, inet::Resending, and inet::queueing::PacketDelayer.

32 {
33  auto packet = check_and_cast<Packet *>(message);
34  pushPacket(packet, packet->getArrivalGate());
35 }

Referenced by inet::queueing::PacketDelayer::handleMessage().

◆ handlePushPacketProcessed()

void inet::queueing::PacketPusherBase::handlePushPacketProcessed ( Packet packet,
cGate *  gate,
bool  successful 
)
overridevirtual

Notifies about the completion of the packet processing for a packet that was pushed earlier independently whether the packet is passed or streamed.

This method is called, for example, when a previously pushed packet is failed to be processed successfully. It allows the source to retry the operation.

The gate parameter must be a valid gate of this module. The packet must not be nullptr.

Implements inet::queueing::IActivePacketSource.

Reimplemented in inet::InterpacketGapInserter, inet::Resending, inet::queueing::PacketDelayer, and inet::queueing::PacketDuplicator.

75 {
76  Enter_Method("handlePushPacketProcessed");
77  if (producer != nullptr)
78  producer->handlePushPacketProcessed(packet, inputGate->getPathStartGate(), successful);
79 }

◆ initialize()

void inet::queueing::PacketPusherBase::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::queueing::PacketProcessorBase.

Reimplemented in inet::RelayInterfaceSelector, inet::InterpacketGapInserter, inet::AggregatorBase, inet::Resending, inet::DefragmenterBase, inet::FragmenterBase, inet::EthernetSocketPacketProcessor, inet::Ieee8021qSocketPacketProcessor, inet::Ieee8022LlcSocketPacketProcessor, inet::Forwarding, inet::FragmentNumberHeaderBasedDefragmenter, inet::FragmentNumberHeaderBasedFragmenter, inet::Reordering, inet::DeaggregatorBase, inet::DuplicateRemoval, inet::ReceiveWithAcknowledge, and inet::SubpacketLengthHeaderBasedDeaggregator.

17 {
19  if (stage == INITSTAGE_LOCAL) {
20  inputGate = gate("in");
21  outputGate = gate("out");
22  producer = findConnectedModule<IActivePacketSource>(inputGate);
23  consumer = findConnectedModule<IPassivePacketSink>(outputGate);
24  }
25  else if (stage == INITSTAGE_QUEUEING) {
28  }
29 }

Referenced by inet::ReceiveWithAcknowledge::initialize(), inet::DeaggregatorBase::initialize(), inet::DuplicateRemoval::initialize(), inet::Ieee8021qSocketPacketProcessor::initialize(), inet::Ieee8022LlcSocketPacketProcessor::initialize(), inet::EthernetSocketPacketProcessor::initialize(), inet::Forwarding::initialize(), inet::Reordering::initialize(), inet::FragmenterBase::initialize(), inet::DefragmenterBase::initialize(), inet::Resending::initialize(), inet::AggregatorBase::initialize(), and inet::RelayInterfaceSelector::initialize().

◆ pushPacket()

void inet::queueing::PacketPusherBase::pushPacket ( Packet packet,
cGate *  gate 
)
overridevirtual

Pushes the packet into the packet sink at the given gate.

This operation pushes the packet as a whole. The onwership of the packet is transferred to the sink.

This method is called, for example, when a packet source module pushes a packet into a queue module.

The sink must not be full at the gate. The packet must not be nullptr. The gate must be a valid gate of this module and it must support pushing and passing packets.

Implements inet::queueing::IPassivePacketSink.

Reimplemented in inet::InterpacketGapInserter, inet::AggregatorBase, inet::Resending, inet::RelayInterfaceSelector, inet::FragmenterBase, inet::Ieee8021qSocketPacketProcessor, inet::Ieee8022LlcSocketPacketProcessor, inet::Forwarding, inet::EthernetSocketPacketProcessor, inet::Reordering, inet::DuplicateRemoval, inet::queueing::PacketDelayer, inet::ReceiveWithAcknowledge, inet::ReceiveWithProtocol, inet::queueing::PacketDuplicator, inet::FragmentNumberHeaderBasedDefragmenter, inet::FragmentTagBasedDefragmenter, and inet::DeaggregatorBase.

48 {
49  throw cRuntimeError("Invalid operation");
50 }

Referenced by handleMessage().

◆ pushPacketEnd()

void inet::queueing::PacketPusherBase::pushPacketEnd ( Packet packet,
cGate *  gate 
)
overridevirtual

Ends pushing the packet into the packet sink at the given gate.

This is a packet streaming operation. The onwership of the packet is transferred to the sink.

Packet streaming can be started with any of the streaming operations, and ends when the streaming position plus the extra processable packet length equals to the total packet length.

This method is called, for example, when a preemption supporting server module ends streaming a packet to the sink.

The sink must not be full at the gate and no other packet streaming can be in progress. The packet must not be nullptr. The gate must be a valid gate of this module and it must support pushing and streaming packets.

Implements inet::queueing::IPassivePacketSink.

Reimplemented in inet::InterpacketGapInserter.

58 {
59  throw cRuntimeError("Invalid operation");
60 }

◆ pushPacketProgress()

void inet::queueing::PacketPusherBase::pushPacketProgress ( Packet packet,
cGate *  gate,
bps  datarate,
b  position,
b  extraProcessableLength = b(0) 
)
overridevirtual

Progresses pushing the packet into the packet sink at the given gate.

This is a packet streaming operation. The position specifies where the packet streaming is at the moment. The extra length parameter partially fixes the future of the packet streaming operation. The onwership of the packet is transferred to the sink.

Packet streaming can be started with any of the streaming operations, and ends when the streaming position plus the extra processable packet length equals to the total packet length.

This method is called, for example, to notify the sink about a change in the packet data when a preemption occurs.

The sink must not be full at the gate and no other packet streaming can be in progress. The packet must not be nullptr. The gate must be a valid gate of this module and it must support pushing and streaming packets.

Implements inet::queueing::IPassivePacketSink.

Reimplemented in inet::InterpacketGapInserter.

63 {
64  throw cRuntimeError("Invalid operation");
65 }

◆ pushPacketStart()

void inet::queueing::PacketPusherBase::pushPacketStart ( Packet packet,
cGate *  gate,
bps  datarate 
)
overridevirtual

Starts pushing the packet into the packet sink at the given gate.

This is a packet streaming operation. The onwership of the packet is transferred to the sink.

Packet streaming can be started with any of the streaming operations, and ends when the streaming position plus the extra processable packet length equals to the total packet length.

This method is called, for example, when a preemption supporting server module starts streaming a packet to the sink.

The sink must not be full at the gate and no other packet streaming can be in progress. The packet must not be nullptr. The gate must be a valid gate of this module and it must support pushing and streaming packets.

Implements inet::queueing::IPassivePacketSink.

Reimplemented in inet::InterpacketGapInserter.

53 {
54  throw cRuntimeError("Invalid operation");
55 }

◆ supportsPacketPulling()

virtual bool inet::queueing::PacketPusherBase::supportsPacketPulling ( cGate *  gate) const
inlineoverridevirtual

Returns true if the processor supports pulling packets at the given gate.

Pulling a packet is a synchronous operation that is initiated by the sink module. A pulled packet can be passed as a whole using pullPacket(), or it can be streamed from the source to the sink using pullPacketStart(), pullPacketEnd(), and pullPacketProgress().

For output gates, true means that the connected module can pull packets from this module. For input gates, true means that this module can pull packets from the connected module. For example, a packet server module can pull packets from a queue module.

Connecting incompatible gates raises an error during initialize. The gate parameter must be a valid gate of this module. The gate should be marked with @labels(pull) in the NED file.

Implements inet::queueing::IPacketProcessor.

Reimplemented in inet::InterpacketGapInserter.

36 { return false; }

◆ supportsPacketPushing()

virtual bool inet::queueing::PacketPusherBase::supportsPacketPushing ( cGate *  gate) const
inlineoverridevirtual

Returns true if the processor supports pushing packets at the given gate.

Pushing a packet is a synchronous operation that is initiated by the source module. A pushed packet can be passed as a whole using pushPacket(), or it can be streamed from the source to the sink using pushPacketStart(), pushPacketEnd(), and pushPacketProgress().

For output gates, true means that this module can push packets into the connected module. For input gates, true means that the connected module can push packets into this module. For example, a packet generator module can push packets into a queue module.

Connecting incompatible gates raises an error during initialize. The gate parameter must be a valid gate of this module. The gate should be marked with @labels(push) in the NED file.

Implements inet::queueing::IPacketProcessor.

Reimplemented in inet::InterpacketGapInserter.

35 { return true; }

Member Data Documentation

◆ consumer

◆ inputGate

◆ outputGate

cGate* inet::queueing::PacketPusherBase::outputGate = nullptr
protected

Referenced by canPushPacket(), inet::InterpacketGapInserter::canPushPacket(), canPushSomePacket(), inet::InterpacketGapInserter::canPushSomePacket(), inet::DefragmenterBase::defragmentPacket(), inet::queueing::PacketDelayer::getRegistrationForwardingGate(), inet::Ieee8021qSocketPacketProcessor::getRegistrationForwardingGate(), inet::Ieee8022LlcSocketPacketProcessor::getRegistrationForwardingGate(), inet::EthernetSocketPacketProcessor::getRegistrationForwardingGate(), inet::RelayInterfaceSelector::getRegistrationForwardingGate(), inet::queueing::PacketDelayer::handleMessage(), inet::Resending::handleMessage(), inet::InterpacketGapInserter::handleMessage(), inet::Resending::handlePushPacketProcessed(), inet::SubpacketLengthHeaderBasedDeaggregator::initialize(), inet::ReceiveWithAcknowledge::initialize(), inet::DuplicateRemoval::initialize(), inet::Forwarding::initialize(), inet::FragmentNumberHeaderBasedDefragmenter::initialize(), inet::Reordering::initialize(), initialize(), inet::InterpacketGapInserter::pushOrSendOrSchedulePacketProgress(), inet::queueing::PacketDuplicator::pushPacket(), inet::DuplicateRemoval::pushPacket(), inet::DeaggregatorBase::pushPacket(), inet::Reordering::pushPacket(), inet::EthernetSocketPacketProcessor::pushPacket(), inet::Ieee8021qSocketPacketProcessor::pushPacket(), inet::Forwarding::pushPacket(), inet::FragmenterBase::pushPacket(), inet::AggregatorBase::pushPacket(), inet::InterpacketGapInserter::pushPacket(), inet::InterpacketGapInserter::receivePacketEnd(), inet::InterpacketGapInserter::receivePacketProgress(), inet::InterpacketGapInserter::receivePacketStart(), and inet::RelayInterfaceSelector::sendPacket().

◆ producer


The documentation for this class was generated from the following files:
inet::queueing::PacketPusherBase::inputGate
cGate * inputGate
Definition: PacketPusherBase.h:22
inet::queueing::PacketProcessorBase::initialize
virtual void initialize(int stage) override
Definition: PacketProcessorBase.cc:16
inet::queueing::IPassivePacketSink::canPushPacket
virtual bool canPushPacket(Packet *packet, cGate *gate) const =0
Returns true if the given packet can be pushed at the given gate into the packet sink without raising...
inet::INITSTAGE_QUEUEING
INET_API InitStage INITSTAGE_QUEUEING
Initialization of queueing modules.
inet::queueing::PacketPusherBase::pushPacket
virtual void pushPacket(Packet *packet, cGate *gate) override
Pushes the packet into the packet sink at the given gate.
Definition: PacketPusherBase.cc:47
inet::queueing::IPassivePacketSink::canPushSomePacket
virtual bool canPushSomePacket(cGate *gate) const =0
Returns false if the packet sink is full at the given gate and no more packets can be pushed into it ...
inet::queueing::PacketPusherBase::outputGate
cGate * outputGate
Definition: PacketPusherBase.h:25
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::queueing::IActivePacketSource::handleCanPushPacketChanged
virtual void handleCanPushPacketChanged(cGate *gate)=0
Notifies about a change in the possibility of pushing some packet into the passive packet sink at the...
inet::queueing::IActivePacketSource::handlePushPacketProcessed
virtual void handlePushPacketProcessed(Packet *packet, cGate *gate, bool successful)=0
Notifies about the completion of the packet processing for a packet that was pushed earlier independe...
inet::queueing::PacketProcessorBase::checkPacketOperationSupport
virtual void checkPacketOperationSupport(cGate *gate) const
Definition: PacketProcessorBase.cc:40
inet::queueing::PacketPusherBase::consumer
IPassivePacketSink * consumer
Definition: PacketPusherBase.h:26
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::queueing::PacketPusherBase::producer
IActivePacketSource * producer
Definition: PacketPusherBase.h:23