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

#include <ActivePacketSource.h>

Inheritance diagram for inet::queueing::ActivePacketSource:
inet::ClockUserModuleMixin< ActivePacketSourceBase > inet::queueing::ActivePacketSourceBase inet::queueing::PacketSourceBase inet::queueing::IActivePacketSource inet::queueing::PacketProcessorBase inet::queueing::IPacketProcessor inet::StringFormat::IDirectiveResolver

Public Member Functions

virtual ~ActivePacketSource ()
 
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::ClockUserModuleMixin< ActivePacketSourceBase >
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::ActivePacketSourceBase
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...
 
- 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::IActivePacketSource
virtual ~IActivePacketSource ()
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *message) override
 
virtual void scheduleProductionTimer (double delay)
 
virtual void producePacket ()
 
- Protected Member Functions inherited from inet::queueing::PacketSourceBase
virtual const char * createPacketName (const Ptr< const Chunk > &data) const
 
virtual Ptr< ChunkcreatePacketContent () const
 
virtual PacketcreatePacket ()
 
virtual const cModule * findContainingApplication () const
 
virtual const cModule * getContainingApplication () const
 
- 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 * productionIntervalParameter = nullptr
 
ClockEventproductionTimer = nullptr
 
bool scheduleForAbsoluteTime = false
 
- Protected Attributes inherited from inet::queueing::ActivePacketSourceBase
cGate * outputGate = nullptr
 
IPassivePacketSinkconsumer = nullptr
 
- Protected Attributes inherited from inet::queueing::PacketSourceBase
const char * packetNameFormat = nullptr
 
const char * packetRepresentation = nullptr
 
cPar * packetLengthParameter = nullptr
 
cPar * packetDataParameter = nullptr
 
bool attachCreationTimeTag = false
 
bool attachIdentityTag = false
 
bool attachDirectionTag = false
 
- 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

◆ ~ActivePacketSource()

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

Member Function Documentation

◆ handleCanPushPacketChanged()

void inet::queueing::ActivePacketSource::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.

69 {
70  Enter_Method("handleCanPushPacketChanged");
71  if (!productionTimer->isScheduled() && (consumer == nullptr || consumer->canPushSomePacket(outputGate->getPathEndGate()))) {
72  double offset = par("initialProductionOffset");
73  if (offset != 0)
75  else {
77  producePacket();
78  }
79  }
80 }

◆ handleMessage()

void inet::queueing::ActivePacketSource::handleMessage ( cMessage *  message)
overrideprotectedvirtual
40 {
41  if (message == productionTimer) {
42  if (consumer == nullptr || consumer->canPushSomePacket(outputGate->getPathEndGate())) {
44  producePacket();
45  }
46  }
47  else
48  throw cRuntimeError("Unknown message");
49 }

◆ handlePushPacketProcessed()

void inet::queueing::ActivePacketSource::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.

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

◆ initialize()

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

Reimplemented from inet::queueing::ActivePacketSourceBase.

19 {
20  ClockUserModuleMixin::initialize(stage);
21  if (stage == INITSTAGE_LOCAL) {
22  productionIntervalParameter = &par("productionInterval");
23  productionTimer = new ClockEvent("ProductionTimer");
24  scheduleForAbsoluteTime = par("scheduleForAbsoluteTime");
25  }
26  else if (stage == INITSTAGE_QUEUEING) {
27  if (!productionTimer->isScheduled() && (consumer == nullptr || consumer->canPushSomePacket(outputGate->getPathEndGate()))) {
28  double offset = par("initialProductionOffset");
29  if (offset != 0)
31  else {
33  producePacket();
34  }
35  }
36  }
37 }

◆ producePacket()

void inet::queueing::ActivePacketSource::producePacket ( )
protectedvirtual
60 {
61  auto packet = createPacket();
62  EV_INFO << "Producing packet" << EV_FIELD(packet) << EV_ENDL;
63  emit(packetPushedSignal, packet);
66 }

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

◆ scheduleProductionTimer()

void inet::queueing::ActivePacketSource::scheduleProductionTimer ( double  delay)
protectedvirtual

Member Data Documentation

◆ productionIntervalParameter

cPar* inet::queueing::ActivePacketSource::productionIntervalParameter = nullptr
protected

◆ productionTimer

ClockEvent* inet::queueing::ActivePacketSource::productionTimer = nullptr
protected

◆ scheduleForAbsoluteTime

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

The documentation for this class was generated from the following files:
inet::queueing::PacketProcessorBase::pushOrSendPacket
virtual void pushOrSendPacket(Packet *packet, cGate *gate, IPassivePacketSink *consumer)
Definition: PacketProcessorBase.cc:126
inet::queueing::ActivePacketSource::productionIntervalParameter
cPar * productionIntervalParameter
Definition: ActivePacketSource.h:20
inet::queueing::PacketSourceBase::createPacket
virtual Packet * createPacket()
Definition: PacketSourceBase.cc:146
inet::INITSTAGE_QUEUEING
INET_API InitStage INITSTAGE_QUEUEING
Initialization of queueing modules.
inet::ClockUserModuleMixin< ActivePacketSourceBase >::scheduleClockEventAfter
virtual void scheduleClockEventAfter(clocktime_t delay, ClockEvent *msg)
Definition: ClockUserModuleMixin.h:65
inet::ClockUserModuleMixin< ActivePacketSourceBase >::scheduleClockEventAt
virtual void scheduleClockEventAt(clocktime_t time, ClockEvent *msg)
Definition: ClockUserModuleMixin.h:64
inet::queueing::ActivePacketSource::scheduleForAbsoluteTime
bool scheduleForAbsoluteTime
Definition: ActivePacketSource.h:22
inet::ClockUserModuleMixin< ActivePacketSourceBase >::getClockTime
virtual clocktime_t getClockTime() const
Definition: ClockUserModuleMixin.h:72
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::ClockEvent
cMessage ClockEvent
Definition: contract/ClockEvent.h:18
inet::packetPushedSignal
simsignal_t packetPushedSignal
Definition: Simsignals.cc:99
EV_FIELD
#define EV_FIELD(...)
Definition: INETDefs.h:112
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::queueing::ActivePacketSource::productionTimer
ClockEvent * productionTimer
Definition: ActivePacketSource.h:21
inet::ClockUserModuleMixin< ActivePacketSourceBase >::cancelAndDeleteClockEvent
virtual void cancelAndDeleteClockEvent(ClockEvent *msg)
Definition: ClockUserModuleMixin.h:67
inet::queueing::ActivePacketSourceBase::consumer
IPassivePacketSink * consumer
Definition: ActivePacketSourceBase.h:21
inet::queueing::ActivePacketSourceBase::outputGate
cGate * outputGate
Definition: ActivePacketSourceBase.h:20
inet::queueing::PacketProcessorBase::updateDisplayString
virtual void updateDisplayString() const
Definition: PacketProcessorBase.cc:399
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::queueing::ActivePacketSource::producePacket
virtual void producePacket()
Definition: ActivePacketSource.cc:59
inet::queueing::ActivePacketSource::scheduleProductionTimer
virtual void scheduleProductionTimer(double delay)
Definition: ActivePacketSource.cc:51
EV_ENDL
#define EV_ENDL
Definition: INETDefs.h:114