An example packet classifier based on the UDP/TCP port number.
More...
#include <ExampleQoSClassifier.h>
An example packet classifier based on the UDP/TCP port number.
inet::ExampleQoSClassifier::ExampleQoSClassifier |
( |
| ) |
|
|
inline |
int inet::ExampleQoSClassifier::getUserPriority |
( |
cMessage * |
msg | ) |
|
|
protectedvirtual |
Referenced by handleMessage().
56 cPacket *ipData =
nullptr;
59 ipData =
dynamic_cast<IPv4Datagram *
>(msg);
60 if (ipData && dynamic_cast<ICMPMessage *>(ipData->getEncapsulatedPacket()))
66 ipData =
dynamic_cast<IPv6Datagram *
>(msg);
67 if (ipData && dynamic_cast<ICMPv6Message *>(ipData->getEncapsulatedPacket()))
76 UDPPacket *udp =
dynamic_cast<UDPPacket *
>(ipData->getEncapsulatedPacket());
78 if (udp->getDestinationPort() == 21 || udp->getSourcePort() == 21)
80 if (udp->getDestinationPort() == 80 || udp->getSourcePort() == 80)
82 if (udp->getDestinationPort() == 4000 || udp->getSourcePort() == 4000)
84 if (udp->getDestinationPort() == 5000 || udp->getSourcePort() == 5000)
86 if (udp->getDestinationPort() == 6000 || udp->getSourcePort() == 6000)
91 #ifdef WITH_TCP_COMMON 92 tcp::TCPSegment *tcp =
dynamic_cast<tcp::TCPSegment *
>(ipData->getEncapsulatedPacket());
94 if (tcp->getDestPort() == 21 || tcp->getSrcPort() == 21)
96 if (tcp->getDestPort() == 80 || tcp->getSrcPort() == 80)
98 if (tcp->getDestPort() == 4000 || tcp->getSrcPort() == 4000)
100 if (tcp->getDestPort() == 5000 || tcp->getSrcPort() == 5000)
102 if (tcp->getDestinationPort() == 6000 || tcp->getSourcePort() == 6000)
Definition: UserPriority.h:33
Definition: UserPriority.h:31
Definition: UserPriority.h:36
Definition: UserPriority.h:37
void inet::ExampleQoSClassifier::handleMessage |
( |
cMessage * |
msg | ) |
|
|
overridevirtual |
48 Ieee802Ctrl *ctrl = check_and_cast<Ieee802Ctrl*>(msg->getControlInfo());
50 ctrl->setUserPriority(userPriority);
virtual int getUserPriority(cMessage *msg)
Definition: ExampleQoSClassifier.cc:54
void inet::ExampleQoSClassifier::initialize |
( |
| ) |
|
|
overridevirtual |
The documentation for this class was generated from the following files: