INET Framework for OMNeT++/OMNEST
inet::EthernetCutthroughSink Class Reference

#include <EthernetCutthroughSink.h>

Inheritance diagram for inet::EthernetCutthroughSink:
inet::PacketStreamer inet::ClockUserModuleMixin< PacketProcessorBase > inet::queueing::IPacketFlow inet::queueing::PacketProcessorBase inet::queueing::IPacketSink inet::queueing::IPacketSource inet::queueing::IPacketProcessor inet::StringFormat::IDirectiveResolver inet::queueing::IPassivePacketSink inet::queueing::IActivePacketSink inet::queueing::IPassivePacketSource inet::queueing::IActivePacketSource

Public Member Functions

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 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::PacketStreamer
virtual ~PacketStreamer ()
 
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 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...
 
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 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 void pushPacket (Packet *packet, cGate *gate) override
 Pushes 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 bool canPullSomePacket (cGate *gate) const override
 Returns false if the packet source is empty at the given gate and no more packets can be pulled from it without raising an error. More...
 
virtual PacketcanPullPacket (cGate *gate) const override
 Returns the packet that can be pulled at the given gate. More...
 
virtual PacketpullPacket (cGate *gate) override
 Pulls the packet from the packet source at the given gate. More...
 
virtual PacketpullPacketStart (cGate *gate, bps datarate) override
 Starts pulling the packet from the packet source at the given gate. More...
 
virtual PacketpullPacketEnd (cGate *gate) override
 Ends pulling the packet from the packet source at the given gate. More...
 
virtual PacketpullPacketProgress (cGate *gate, bps datarate, b position, b extraProcessableLength) override
 Progresses pulling the packet from the packet source at the given gate. More...
 
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< PacketProcessorBase >
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::PacketProcessorBase
virtual bool supportsPacketSending (cGate *gate) const override
 Returns true if the processor supports sending 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::IActivePacketSink
virtual ~IActivePacketSink ()
 
- Public Member Functions inherited from inet::queueing::IPassivePacketSource
virtual ~IPassivePacketSource ()
 
- Public Member Functions inherited from inet::queueing::IActivePacketSource
virtual ~IActivePacketSource ()
 

Protected Member Functions

virtual void initialize (int stage) override
 
- Protected Member Functions inherited from inet::PacketStreamer
virtual void handleMessage (cMessage *message) override
 
virtual bool isStreaming () const
 
virtual void endStreaming ()
 
- 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 * cutthroughInputGate = nullptr
 
IActivePacketSourcecutthroughProducer = nullptr
 
bool cutthrough = false
 
- Protected Attributes inherited from inet::PacketStreamer
bps datarate = bps(NaN)
 
cGate * inputGate = nullptr
 
IActivePacketSourceproducer = nullptr
 
IPassivePacketSourceprovider = nullptr
 
cGate * outputGate = nullptr
 
IPassivePacketSinkconsumer = nullptr
 
IActivePacketSinkcollector = nullptr
 
bps streamDatarate = bps(NaN)
 
PacketstreamedPacket = nullptr
 
ClockEventendStreamingTimer = 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::EthernetCutthroughSink::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.

Reimplemented from inet::PacketStreamer.

26 {
27  if (gate == cutthroughInputGate)
28  return !isStreaming() && !provider->canPullSomePacket(inputGate->getPathStartGate()) && consumer->canPushPacket(packet, outputGate->getPathEndGate());
29  else
30  return PacketStreamer::canPushPacket(packet, gate);
31 }

◆ handlePushPacketProcessed()

void inet::EthernetCutthroughSink::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::PacketStreamer.

69 {
70  Enter_Method("handlePushPacketProcessed");
71  if (!cutthrough && producer != nullptr)
72  producer->handlePushPacketProcessed(packet, inputGate->getPathStartGate(), successful);
73  else if (cutthrough && cutthroughProducer != nullptr)
74  cutthroughProducer->handlePushPacketProcessed(packet, cutthroughInputGate->getPathStartGate(), successful);
75 }

◆ initialize()

void inet::EthernetCutthroughSink::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::PacketStreamer.

17 {
19  if (stage == INITSTAGE_LOCAL) {
20  cutthroughInputGate = gate("cutthroughIn");
21  cutthroughProducer = findConnectedModule<IActivePacketSource>(cutthroughInputGate);
22  }
23 }

◆ pushPacketEnd()

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

Reimplemented from inet::PacketStreamer.

53 {
54  if (gate == cutthroughInputGate) {
55  Enter_Method("pushPacketEnd");
56  take(packet);
57  delete streamedPacket;
58  streamedPacket = packet;
59  EV_INFO << "Ending streaming packet " << streamedPacket->getName() << "." << std::endl;
61  streamedPacket = nullptr;
63  }
64  else
65  PacketStreamer::pushPacketEnd(packet, gate);
66 }

◆ pushPacketStart()

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

Reimplemented from inet::PacketStreamer.

34 {
35  if (gate == cutthroughInputGate) {
36  Enter_Method("pushPacketStart");
37  take(packet);
38  delete streamedPacket;
39  streamedPacket = packet;
40  cutthrough = true;
41  EV_INFO << "Starting streaming packet " << streamedPacket->getName() << "." << std::endl;
43  streamedPacket = nullptr;
45  }
46  else {
47  cutthrough = false;
49  }
50 }

Member Data Documentation

◆ cutthrough

bool inet::EthernetCutthroughSink::cutthrough = false
protected

◆ cutthroughInputGate

cGate* inet::EthernetCutthroughSink::cutthroughInputGate = nullptr
protected

◆ cutthroughProducer

IActivePacketSource* inet::EthernetCutthroughSink::cutthroughProducer = nullptr
protected

The documentation for this class was generated from the following files:
inet::PacketStreamer::initialize
virtual void initialize(int stage) override
Definition: PacketStreamer.cc:22
inet::PacketStreamer::streamedPacket
Packet * streamedPacket
Definition: PacketStreamer.h:33
inet::PacketStreamer::consumer
IPassivePacketSink * consumer
Definition: PacketStreamer.h:29
inet::PacketStreamer::pushPacketStart
virtual void pushPacketStart(Packet *packet, cGate *gate, bps datarate) override
Starts pushing the packet into the packet sink at the given gate.
Definition: PacketStreamer.h:59
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::PacketStreamer::canPushPacket
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...
Definition: PacketStreamer.cc:68
inet::PacketStreamer::inputGate
cGate * inputGate
Definition: PacketStreamer.h:24
inet::EthernetCutthroughSink::cutthroughInputGate
cGate * cutthroughInputGate
Definition: EthernetCutthroughSink.h:20
inet::PacketStreamer::datarate
bps datarate
Definition: PacketStreamer.h:22
inet::PacketStreamer::outputGate
cGate * outputGate
Definition: PacketStreamer.h:28
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::queueing::PacketProcessorBase::pushOrSendPacketEnd
virtual void pushOrSendPacketEnd(Packet *packet, cGate *gate, IPassivePacketSink *consumer, int transmissionId)
Definition: PacketProcessorBase.cc:154
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::PacketStreamer::provider
IPassivePacketSource * provider
Definition: PacketStreamer.h:26
inet::EthernetCutthroughSink::cutthroughProducer
IActivePacketSource * cutthroughProducer
Definition: EthernetCutthroughSink.h:21
inet::PacketStreamer::pushPacketEnd
virtual void pushPacketEnd(Packet *packet, cGate *gate) override
Ends pushing the packet into the packet sink at the given gate.
Definition: PacketStreamer.h:60
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::queueing::PacketProcessorBase::pushOrSendPacketStart
virtual void pushOrSendPacketStart(Packet *packet, cGate *gate, IPassivePacketSink *consumer, bps datarate, int transmissionId)
Definition: PacketProcessorBase.cc:136
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 ...
inet::PacketStreamer::producer
IActivePacketSource * producer
Definition: PacketStreamer.h:25
inet::PacketStreamer::isStreaming
virtual bool isStreaming() const
Definition: PacketStreamer.h:41
inet::EthernetCutthroughSink::cutthrough
bool cutthrough
Definition: EthernetCutthroughSink.h:23