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

#include <EthernetPauseCommandProcessor.h>

Inheritance diagram for inet::EthernetPauseCommandProcessor:

Protected Member Functions

virtual void initialize () override
 
virtual void handleMessage (cMessage *msg) override
 
void handleSendPause (Request *msg, Ieee802PauseCommand *etherctrl)
 

Protected Attributes

int seqNum = 0
 

Static Protected Attributes

static simsignal_t pauseSentSignal = registerSignal("pauseSent")
 

Member Function Documentation

◆ handleMessage()

void inet::EthernetPauseCommandProcessor::handleMessage ( cMessage *  msg)
overrideprotectedvirtual
25 {
26  if (auto rq = dynamic_cast<Request *>(msg)) {
27  auto ctrl = msg->getControlInfo();
28  if (auto cmd = dynamic_cast<Ieee802PauseCommand *>(ctrl)) {
29  handleSendPause(rq, cmd);
30  return;
31  }
32  }
33  send(msg, "out");
34 }

◆ handleSendPause()

void inet::EthernetPauseCommandProcessor::handleSendPause ( Request msg,
Ieee802PauseCommand etherctrl 
)
protected
37 {
38  MacAddress dest = etherctrl->getDestinationAddress();
39  int pauseUnits = etherctrl->getPauseUnits();
40  delete msg;
41 
42  EV_DETAIL << "Creating and sending PAUSE frame, with duration = " << pauseUnits << " units\n";
43 
44  // create Ethernet frame
45  char framename[40];
46  sprintf(framename, "pause-%d-%d", getId(), seqNum++);
47  auto packet = new Packet(framename);
48  const auto& frame = makeShared<EthernetPauseFrame>();
49  frame->setPauseTime(pauseUnits);
50  packet->insertAtFront(frame);
51  if (dest.isUnspecified())
53  packet->addTag<MacAddressReq>()->setDestAddress(dest);
54  packet->addTag<PacketProtocolTag>()->setProtocol(&Protocol::ethernetFlowCtrl);
55 
56  EV_INFO << "Sending Pause command " << frame << " to lower layer.\n";
57  send(packet, "out");
58 
59  emit(pauseSentSignal, pauseUnits);
60 }

Referenced by handleMessage().

◆ initialize()

void inet::EthernetPauseCommandProcessor::initialize ( )
overrideprotectedvirtual
20 {
21  seqNum = 0;
22 }

Member Data Documentation

◆ pauseSentSignal

simsignal_t inet::EthernetPauseCommandProcessor::pauseSentSignal = registerSignal("pauseSent")
staticprotected

Referenced by handleSendPause().

◆ seqNum

int inet::EthernetPauseCommandProcessor::seqNum = 0
protected

Referenced by handleSendPause(), and initialize().


The documentation for this class was generated from the following files:
inet::MacAddress::MULTICAST_PAUSE_ADDRESS
static const MacAddress MULTICAST_PAUSE_ADDRESS
The special multicast PAUSE MAC address, 01:80:C2:00:00:01.
Definition: MacAddress.h:37
inet::EthernetPauseCommandProcessor::seqNum
int seqNum
Definition: EthernetPauseCommandProcessor.h:21
PacketProtocolTag
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
ctrl
removed ctrl
Definition: IUdp-gates.txt:7
inet::EthernetPauseCommandProcessor::pauseSentSignal
static simsignal_t pauseSentSignal
Definition: EthernetPauseCommandProcessor.h:22
inet::Protocol::ethernetFlowCtrl
static const Protocol ethernetFlowCtrl
Definition: Protocol.h:64
inet::EthernetPauseCommandProcessor::handleSendPause
void handleSendPause(Request *msg, Ieee802PauseCommand *etherctrl)
Definition: EthernetPauseCommandProcessor.cc:36