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

#include <PacketDelayer.h>

Inheritance diagram for inet::queueing::PacketDelayer:
inet::ClockUserModuleMixin< PacketPusherBase > inet::TransparentProtocolRegistrationListener inet::queueing::PacketPusherBase inet::IProtocolRegistrationListener inet::queueing::PacketProcessorBase inet::queueing::IPacketPusher inet::queueing::IPacketProcessor inet::StringFormat::IDirectiveResolver inet::queueing::IPassivePacketSink inet::queueing::IActivePacketSource

Public Member Functions

virtual void pushPacket (Packet *packet, cGate *gate) override
 Pushes 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::ClockUserModuleMixin< PacketPusherBase >
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::PacketPusherBase
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 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...
 
- 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 ()
 
- Public Member Functions inherited from inet::TransparentProtocolRegistrationListener
virtual void mapRegistrationForwardingGates (cGate *gate, std::function< void(cGate *)> f)
 
virtual bool isForwardingProtocol (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) const
 
virtual bool isForwardingProtocolGroup (const ProtocolGroup &protocolGroup, cGate *gate, ServicePrimitive servicePrimitive) const
 
virtual bool isForwardingAnyProtocol (cGate *gate, ServicePrimitive servicePrimitive) const
 
virtual bool isForwardingProtocol (cGate *gate, ServicePrimitive servicePrimitive) const
 
virtual bool isForwardingService (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) const
 
virtual bool isForwardingServiceGroup (const ProtocolGroup &protocolGroup, cGate *gate, ServicePrimitive servicePrimitive) const
 
virtual bool isForwardingAnyService (cGate *gate, ServicePrimitive servicePrimitive) const
 
virtual bool isForwardingService (cGate *gate, ServicePrimitive servicePrimitive) const
 
virtual void handleRegisterService (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) override
 
virtual void handleRegisterProtocol (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) override
 
virtual void handleRegisterServiceGroup (const ProtocolGroup &protocolGroup, cGate *gate, ServicePrimitive servicePrimitive) override
 
virtual void handleRegisterProtocolGroup (const ProtocolGroup &protocolGroup, cGate *gate, ServicePrimitive servicePrimitive) override
 
virtual void handleRegisterAnyService (cGate *gate, ServicePrimitive servicePrimitive) override
 
virtual void handleRegisterAnyProtocol (cGate *gate, ServicePrimitive servicePrimitive) override
 

Protected Member Functions

virtual void handleMessage (cMessage *message) override
 
virtual cGate * getRegistrationForwardingGate (cGate *gate) override
 
- Protected Member Functions inherited from inet::queueing::PacketPusherBase
virtual void initialize (int stage) 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
 

Additional Inherited Members

- Protected Types inherited from inet::queueing::PacketProcessorBase
enum  Action { PUSH, PULL }
 
- Protected Attributes inherited from inet::queueing::PacketPusherBase
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)
 

Member Function Documentation

◆ getRegistrationForwardingGate()

cGate * inet::queueing::PacketDelayer::getRegistrationForwardingGate ( cGate *  gate)
overrideprotectedvirtual

Reimplemented from inet::TransparentProtocolRegistrationListener.

35 {
36  if (gate == outputGate)
37  return inputGate;
38  else if (gate == inputGate)
39  return outputGate;
40  else
41  throw cRuntimeError("Unknown gate");
42 }

◆ handleCanPushPacketChanged()

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

Reimplemented from inet::queueing::PacketPusherBase.

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

◆ handleMessage()

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

Reimplemented from inet::queueing::PacketPusherBase.

20 {
21  if (message->isSelfMessage()) {
22  auto packet = message->isPacket() ? check_and_cast<Packet *>(message) : static_cast<Packet *>(message->getContextPointer());
23  if (!message->isPacket())
24  delete message;
25  simtime_t delay = simTime() - message->getSendingTime();
26  insertPacketEvent(this, packet, PEK_DELAYED, delay / packet->getBitLength());
27  increaseTimeTag<DelayingTimeTag>(packet, delay / packet->getBitLength(), delay);
29  }
30  else
32 }

◆ handlePushPacketProcessed()

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

Reimplemented from inet::queueing::PacketPusherBase.

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

◆ pushPacket()

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

Reimplemented from inet::queueing::PacketPusherBase.

45 {
46  Enter_Method("pushPacket");
47  take(packet);
48 #ifdef INET_WITH_CLOCK
49  if (clock != nullptr) {
50  clocktime_t delay = par("delay");
51  EV_INFO << "Delaying packet" << EV_FIELD(delay) << EV_FIELD(packet) << EV_ENDL;
52  auto clockEvent = new ClockEvent("DelayTimer");
53  clockEvent->setContextPointer(packet);
54  scheduleClockEventAfter(delay, clockEvent);
55  }
56  else {
57 #else
58  {
59 #endif
60  simtime_t delay = par("delay");
61  EV_INFO << "Delaying packet" << EV_FIELD(delay) << EV_FIELD(packet) << EV_ENDL;
62  scheduleAfter(delay, packet);
63  }
64  handlePacketProcessed(packet);
66 }

The documentation for this class was generated from the following files:
inet::queueing::PacketPusherBase::inputGate
cGate * inputGate
Definition: PacketPusherBase.h:22
inet::queueing::PacketPusherBase::handleMessage
virtual void handleMessage(cMessage *message) override
Definition: PacketPusherBase.cc:31
inet::clocktime_t
ClockTime clocktime_t
Definition: contract/ClockTime.h:25
inet::queueing::PacketProcessorBase::pushOrSendPacket
virtual void pushOrSendPacket(Packet *packet, cGate *gate, IPassivePacketSink *consumer)
Definition: PacketProcessorBase.cc:126
inet::ClockUserModuleMixin< PacketPusherBase >::scheduleClockEventAfter
virtual void scheduleClockEventAfter(clocktime_t delay, ClockEvent *msg)
Definition: ClockUserModuleMixin.h:65
inet::queueing::PacketProcessorBase::handlePacketProcessed
virtual void handlePacketProcessed(Packet *packet)
Definition: PacketProcessorBase.cc:34
inet::ClockEvent
cMessage ClockEvent
Definition: contract/ClockEvent.h:18
inet::queueing::PacketPusherBase::outputGate
cGate * outputGate
Definition: PacketPusherBase.h:25
inet::PEK_DELAYED
@ PEK_DELAYED
Definition: PacketEventTag_m.h:65
EV_FIELD
#define EV_FIELD(...)
Definition: INETDefs.h:112
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::updateDisplayString
virtual void updateDisplayString() const
Definition: PacketProcessorBase.cc:399
inet::queueing::PacketPusherBase::consumer
IPassivePacketSink * consumer
Definition: PacketPusherBase.h:26
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
EV_ENDL
#define EV_ENDL
Definition: INETDefs.h:114
inet::insertPacketEvent
void insertPacketEvent(const cModule *module, Packet *packet, int kind, simtime_t duration, PacketEvent *packetEvent)
Definition: PacketEventTag.cc:12
inet::queueing::PacketPusherBase::producer
IActivePacketSource * producer
Definition: PacketPusherBase.h:23