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

A QoS classifier that assigns a random User Priority. More...

#include <RandomQosClassifier.h>

Inheritance diagram for inet::RandomQosClassifier:
inet::DefaultProtocolRegistrationListener inet::IProtocolRegistrationListener

Public Member Functions

void handleMessage (cMessage *msg) override
 
- Public Member Functions inherited from inet::DefaultProtocolRegistrationListener
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 handleRegisterService (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) override
 
virtual void handleRegisterProtocol (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) override
 

Detailed Description

A QoS classifier that assigns a random User Priority.

This is useful for testing purposes.

Member Function Documentation

◆ handleMessage()

void inet::RandomQosClassifier::handleMessage ( cMessage *  msg)
override
18 {
19  auto packet = check_and_cast<Packet *>(msg);
20  packet->addTagIfAbsent<UserPriorityReq>()->setUserPriority(intrand(8));
21  send(msg, "out");
22 }

◆ handleRegisterProtocol()

void inet::RandomQosClassifier::handleRegisterProtocol ( const Protocol protocol,
cGate *  gate,
ServicePrimitive  servicePrimitive 
)
overrideprotectedvirtual

Reimplemented from inet::DefaultProtocolRegistrationListener.

34 {
35  Enter_Method("handleRegisterProtocol");
36  if (!strcmp("in", g->getName()))
37  registerProtocol(protocol, gate("out"), servicePrimitive);
38  else
39  throw cRuntimeError("Unknown gate: %s", g->getName());
40 }

◆ handleRegisterService()

void inet::RandomQosClassifier::handleRegisterService ( const Protocol protocol,
cGate *  gate,
ServicePrimitive  servicePrimitive 
)
overrideprotectedvirtual

Reimplemented from inet::DefaultProtocolRegistrationListener.

25 {
26  Enter_Method("handleRegisterService");
27  if (!strcmp("in", g->getName()))
28  registerService(protocol, gate("out"), servicePrimitive);
29  else
30  throw cRuntimeError("Unknown gate: %s", g->getName());
31 }

The documentation for this class was generated from the following files:
protocol
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
inet::registerService
void registerService(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a service primitive (SDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:14
inet::units::units::g
milli< kg >::type g
Definition: Units.h:1071
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::registerProtocol
void registerProtocol(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a protocol primitive (PDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:83