Skip to content

Commit

Permalink
PacketServer: Derived from TransparentProtocolRegistrationListener.
Browse files Browse the repository at this point in the history
This allows propagating protocol registration.
  • Loading branch information
levy committed Mar 27, 2024
1 parent 93f7120 commit 0618999
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/inet/queueing/server/PacketServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ void PacketServer::endProcessingPacket()
packet = nullptr;
}

cGate *PacketServer::getRegistrationForwardingGate(cGate *gate)
{
if (gate == outputGate)
return inputGate;
else if (gate == inputGate)
return outputGate;
else
throw cRuntimeError("Unknown gate");
}

void PacketServer::handleCanPushPacketChanged(const cGate *gate)
{
Enter_Method("handleCanPushPacketChanged");
Expand Down
5 changes: 4 additions & 1 deletion src/inet/queueing/server/PacketServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define __INET_PACKETSERVER_H

#include "inet/common/clock/ClockUserModuleMixin.h"
#include "inet/common/IProtocolRegistrationListener.h"
#include "inet/queueing/base/PacketServerBase.h"

namespace inet {
Expand All @@ -17,7 +18,7 @@ extern template class ClockUserModuleMixin<queueing::PacketServerBase>;

namespace queueing {

class INET_API PacketServer : public ClockUserModuleMixin<PacketServerBase>
class INET_API PacketServer : public ClockUserModuleMixin<PacketServerBase>, public TransparentProtocolRegistrationListener
{
protected:
cMessage *serveTimer = nullptr;
Expand All @@ -35,6 +36,8 @@ class INET_API PacketServer : public ClockUserModuleMixin<PacketServerBase>
public:
virtual ~PacketServer();

virtual cGate *getRegistrationForwardingGate(cGate *gate) override;

virtual void handleCanPushPacketChanged(const cGate *gate) override;
virtual void handleCanPullPacketChanged(const cGate *gate) override;

Expand Down

0 comments on commit 0618999

Please sign in to comment.