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

#include <ActivePacketSink.h>

Inheritance diagram for inet::queueing::ActivePacketSink:
inet::ClockUserModuleMixin< ActivePacketSinkBase > inet::queueing::ActivePacketSinkBase inet::queueing::PacketSinkBase inet::queueing::IActivePacketSink inet::queueing::PacketProcessorBase inet::queueing::IPacketProcessor inet::StringFormat::IDirectiveResolver

Public Member Functions

virtual ~ActivePacketSink ()
 
virtual void handleCanPullPacketChanged (cGate *gate) override
 Notifies about a change in the possibility of pulling some packet from the passive packet source at the given gate. More...
 
virtual void handlePullPacketProcessed (Packet *packet, cGate *gate, bool successful) override
 Notifies about the completion of the packet processing for a packet that was pulled earlier independently whether the packet is passed or streamed. More...
 
- Public Member Functions inherited from inet::ClockUserModuleMixin< ActivePacketSinkBase >
virtual void scheduleClockEventAt (clocktime_t time, ClockEvent *msg)
 
virtual void scheduleClockEventAfter (clocktime_t delay, ClockEvent *msg)
 
virtual cMessage * cancelClockEvent (ClockEvent *msg)
 
virtual void cancelAndDeleteClockEvent (ClockEvent *msg)
 
virtual void rescheduleClockEventAt (clocktime_t time, ClockEvent *msg)
 
virtual void rescheduleClockEventAfter (clocktime_t time, ClockEvent *msg)
 
virtual clocktime_t computeClockTimeFromSimTime (simtime_t time) const
 
virtual simtime_t computeSimTimeFromClockTime (clocktime_t time) const
 
virtual clocktime_t getClockTime () const
 
virtual clocktime_t getArrivalClockTime (ClockEvent *msg) const
 
- Public Member Functions inherited from inet::queueing::ActivePacketSinkBase
virtual IPassivePacketSourcegetProvider (cGate *gate) override
 Returns the passive packet source from where packets are pulled 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...
 
- 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::IActivePacketSink
virtual ~IActivePacketSink ()
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *message) override
 
virtual void scheduleCollectionTimer (double delay)
 
virtual void collectPacket ()
 
- 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

cPar * collectionIntervalParameter = nullptr
 
ClockEventcollectionTimer = nullptr
 
bool scheduleForAbsoluteTime = false
 
- Protected Attributes inherited from inet::queueing::ActivePacketSinkBase
cGate * inputGate = nullptr
 
IPassivePacketSourceprovider = 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 }
 

Constructor & Destructor Documentation

◆ ~ActivePacketSink()

virtual inet::queueing::ActivePacketSink::~ActivePacketSink ( )
inlinevirtual

Member Function Documentation

◆ collectPacket()

void inet::queueing::ActivePacketSink::collectPacket ( )
protectedvirtual
57 {
58  auto packet = provider->pullPacket(inputGate->getPathStartGate());
59  take(packet);
60  emit(packetPulledSignal, packet);
61  EV_INFO << "Collecting packet" << EV_FIELD(packet) << EV_ENDL;
63  processedTotalLength += packet->getDataLength();
66 }

Referenced by handleCanPullPacketChanged(), handleMessage(), and initialize().

◆ handleCanPullPacketChanged()

void inet::queueing::ActivePacketSink::handleCanPullPacketChanged ( cGate *  gate)
overridevirtual

Notifies about a change in the possibility of pulling some packet from the passive packet source at the given gate.

This method is called, for example, when a new packet is inserted into a queue. It allows the sink to pull a new packet from the queue.

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

Implements inet::queueing::IActivePacketSink.

69 {
70  Enter_Method("handleCanPullPacketChanged");
71  if (!collectionTimer->isScheduled() && provider->canPullSomePacket(inputGate->getPathStartGate())) {
72  double offset = par("initialCollectionOffset");
73  if (offset != 0)
75  else {
77  collectPacket();
78  }
79  }
80 }

◆ handleMessage()

void inet::queueing::ActivePacketSink::handleMessage ( cMessage *  message)
overrideprotectedvirtual
37 {
38  if (message == collectionTimer) {
39  if (provider->canPullSomePacket(inputGate->getPathStartGate())) {
41  collectPacket();
42  }
43  }
44  else
45  throw cRuntimeError("Unknown message");
46 }

◆ handlePullPacketProcessed()

void inet::queueing::ActivePacketSink::handlePullPacketProcessed ( Packet packet,
cGate *  gate,
bool  successful 
)
overridevirtual

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

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

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

Implements inet::queueing::IActivePacketSink.

83 {
84  Enter_Method("handlePullPacketProcessed");
85 }

◆ initialize()

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

Reimplemented from inet::queueing::ActivePacketSinkBase.

16 {
17  ClockUserModuleMixin::initialize(stage);
18  if (stage == INITSTAGE_LOCAL) {
19  collectionIntervalParameter = &par("collectionInterval");
20  collectionTimer = new ClockEvent("CollectionTimer");
21  scheduleForAbsoluteTime = par("scheduleForAbsoluteTime");
22  }
23  else if (stage == INITSTAGE_QUEUEING) {
24  if (!collectionTimer->isScheduled() && provider->canPullSomePacket(inputGate->getPathStartGate())) {
25  double offset = par("initialCollectionOffset");
26  if (offset != 0)
28  else {
30  collectPacket();
31  }
32  }
33  }
34 }

◆ scheduleCollectionTimer()

void inet::queueing::ActivePacketSink::scheduleCollectionTimer ( double  delay)
protectedvirtual

Member Data Documentation

◆ collectionIntervalParameter

cPar* inet::queueing::ActivePacketSink::collectionIntervalParameter = nullptr
protected

◆ collectionTimer

ClockEvent* inet::queueing::ActivePacketSink::collectionTimer = nullptr
protected

◆ scheduleForAbsoluteTime

bool inet::queueing::ActivePacketSink::scheduleForAbsoluteTime = false
protected

The documentation for this class was generated from the following files:
inet::queueing::ActivePacketSink::collectPacket
virtual void collectPacket()
Definition: ActivePacketSink.cc:56
inet::INITSTAGE_QUEUEING
INET_API InitStage INITSTAGE_QUEUEING
Initialization of queueing modules.
inet::ClockUserModuleMixin< ActivePacketSinkBase >::scheduleClockEventAfter
virtual void scheduleClockEventAfter(clocktime_t delay, ClockEvent *msg)
Definition: ClockUserModuleMixin.h:65
inet::ClockUserModuleMixin< ActivePacketSinkBase >::scheduleClockEventAt
virtual void scheduleClockEventAt(clocktime_t time, ClockEvent *msg)
Definition: ClockUserModuleMixin.h:64
inet::packetPulledSignal
simsignal_t packetPulledSignal
Definition: Simsignals.cc:105
inet::queueing::ActivePacketSink::scheduleForAbsoluteTime
bool scheduleForAbsoluteTime
Definition: ActivePacketSink.h:22
inet::ClockUserModuleMixin< ActivePacketSinkBase >::getClockTime
virtual clocktime_t getClockTime() const
Definition: ClockUserModuleMixin.h:72
inet::queueing::ActivePacketSink::collectionIntervalParameter
cPar * collectionIntervalParameter
Definition: ActivePacketSink.h:20
inet::queueing::PacketProcessorBase::processedTotalLength
b processedTotalLength
Definition: PacketProcessorBase.h:31
inet::ClockEvent
cMessage ClockEvent
Definition: contract/ClockEvent.h:18
EV_FIELD
#define EV_FIELD(...)
Definition: INETDefs.h:112
inet::queueing::ActivePacketSinkBase::inputGate
cGate * inputGate
Definition: ActivePacketSinkBase.h:20
inet::queueing::PacketProcessorBase::dropPacket
virtual void dropPacket(Packet *packet, PacketDropReason reason, int limit=-1)
Definition: PacketProcessorBase.cc:390
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::queueing::PacketProcessorBase::numProcessedPackets
int numProcessedPackets
Definition: PacketProcessorBase.h:30
inet::ClockUserModuleMixin< ActivePacketSinkBase >::cancelAndDeleteClockEvent
virtual void cancelAndDeleteClockEvent(ClockEvent *msg)
Definition: ClockUserModuleMixin.h:67
inet::OTHER_PACKET_DROP
@ OTHER_PACKET_DROP
Definition: Simsignals_m.h:84
inet::queueing::ActivePacketSink::collectionTimer
ClockEvent * collectionTimer
Definition: ActivePacketSink.h:21
inet::queueing::PacketProcessorBase::updateDisplayString
virtual void updateDisplayString() const
Definition: PacketProcessorBase.cc:399
inet::queueing::ActivePacketSink::scheduleCollectionTimer
virtual void scheduleCollectionTimer(double delay)
Definition: ActivePacketSink.cc:48
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::queueing::IPassivePacketSource::canPullSomePacket
virtual bool canPullSomePacket(cGate *gate) const =0
Returns false if the packet source is empty at the given gate and no more packets can be pulled from ...
EV_ENDL
#define EV_ENDL
Definition: INETDefs.h:114
inet::queueing::ActivePacketSinkBase::provider
IPassivePacketSource * provider
Definition: ActivePacketSinkBase.h:21
inet::queueing::IPassivePacketSource::pullPacket
virtual Packet * pullPacket(cGate *gate)=0
Pulls the packet from the packet source at the given gate.