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

#include <Protocol.h>

Public Types

enum  Layer {
  PhysicalLayer, LinkLayer, NetworkLayer, TransportLayer,
  UnspecifiedLayer
}
 

Public Member Functions

 Protocol (const char *name, const char *descriptiveName, Layer layer=UnspecifiedLayer)
 
bool operator== (const Protocol &other) const
 
bool operator!= (const Protocol &other) const
 
int getId () const
 
const char * getName () const
 
const char * getDescriptiveName () const
 
Layer getLayer () const
 
std::string str () const
 

Static Public Member Functions

static const ProtocolfindProtocol (int id)
 
static const ProtocolgetProtocol (int id)
 
static const ProtocolfindProtocol (const char *name)
 
static const ProtocolgetProtocol (const char *name)
 

Static Public Attributes

static const Protocol aodv
 
static const Protocol arp
 
static const Protocol babel
 
static const Protocol bgp
 
static const Protocol bmac
 
static const Protocol cdp
 
static const Protocol clns
 
static const Protocol dsdv2
 
static const Protocol dsr
 
static const Protocol dymo
 
static const Protocol egp
 
static const Protocol eigrp
 
static const Protocol ethernetFlowCtrl
 
static const Protocol ethernetMac
 
static const Protocol ethernetPhy
 
static const Protocol ftp
 
static const Protocol gpsr
 
static const Protocol gptp
 
static const Protocol http
 
static const Protocol icmpv4
 
static const Protocol icmpv6
 
static const Protocol ieee80211DsssPhy
 
static const Protocol ieee80211ErpOfdmPhy
 
static const Protocol ieee80211FhssPhy
 
static const Protocol ieee80211HrDsssPhy
 
static const Protocol ieee80211HtPhy
 
static const Protocol ieee80211IrPhy
 
static const Protocol ieee80211Mac
 
static const Protocol ieee80211Mgmt
 
static const Protocol ieee80211OfdmPhy
 
static const Protocol ieee80211VhtPhy
 
static const Protocol ieee802154
 
static const Protocol ieee8021ae
 
static const Protocol ieee8021qCTag
 
static const Protocol ieee8021qSTag
 
static const Protocol ieee8021rTag
 
static const Protocol ieee8022llc
 
static const Protocol ieee8022snap
 
static const Protocol ieee802epd
 
static const Protocol igmp
 
static const Protocol igp
 
static const Protocol ipv4
 
static const Protocol ipv6
 
static const Protocol isis
 
static const Protocol l2isis
 
static const Protocol lldp
 
static const Protocol lmac
 
static const Protocol manet
 
static const Protocol mobileipv6
 
static const Protocol mpls
 
static const Protocol ospf
 
static const Protocol pim
 
static const Protocol ppp
 
static const Protocol rip
 
static const Protocol rsvpTe
 
static const Protocol rtsp
 
static const Protocol sctp
 
static const Protocol srp
 
static const Protocol ssh
 
static const Protocol stp
 
static const Protocol tcp
 
static const Protocol telnet
 
static const Protocol trill
 
static const Protocol tsn
 
static const Protocol tteth
 
static const Protocol udp
 
static const Protocol xmac
 
static const Protocol xtp
 
static const Protocol ackingMac
 
static const Protocol apskPhy
 
static const Protocol csmaCaMac
 
static const Protocol echo
 
static const Protocol flooding
 
static const Protocol linkStateRouting
 
static const Protocol nextHopForwarding
 
static const Protocol probabilistic
 
static const Protocol shortcutMac
 
static const Protocol shortcutPhy
 
static const Protocol unitDisk
 
static const Protocol unknown
 
static const Protocol wiseRoute
 

Static Protected Member Functions

static std::map< int, const Protocol * > & getIdToProtocol ()
 
static std::map< std::string, const Protocol * > & getNameToProtocol ()
 

Protected Attributes

const int id
 
const std::string name
 
const std::string descriptiveName
 
const Layer layer
 

Static Protected Attributes

static int nextId = 0
 

Member Enumeration Documentation

◆ Layer

Enumerator
PhysicalLayer 
LinkLayer 
NetworkLayer 
TransportLayer 
UnspecifiedLayer 

Constructor & Destructor Documentation

◆ Protocol()

inet::Protocol::Protocol ( const char *  name,
const char *  descriptiveName,
Layer  layer = UnspecifiedLayer 
)
25  :
26  id(nextId++),
27  name(name),
29  layer(layer)
30 {
31  getIdToProtocol()[id] = this;
32  getNameToProtocol()[name] = this;
33  if (strchr(name, ' ') != nullptr)
34  throw cRuntimeError("Space is not allowed in protocol name");
35 }

Member Function Documentation

◆ findProtocol() [1/2]

const Protocol * inet::Protocol::findProtocol ( const char *  name)
static
60 {
61  auto it = getNameToProtocol().find(name);
62  return it != getNameToProtocol().end() ? it->second : nullptr;
63 }

◆ findProtocol() [2/2]

◆ getDescriptiveName()

const char* inet::Protocol::getDescriptiveName ( ) const
inline
39 { return descriptiveName.c_str(); }

◆ getId()

◆ getIdToProtocol()

std::map< int, const Protocol * > & inet::Protocol::getIdToProtocol ( )
staticprotected
14 {
15  static std::map<int, const Protocol *> idToProtocol;
16  return idToProtocol;
17 }

Referenced by findProtocol(), and Protocol().

◆ getLayer()

Layer inet::Protocol::getLayer ( ) const
inline
40 { return layer; }

◆ getName()

const char* inet::Protocol::getName ( ) const
inline

◆ getNameToProtocol()

std::map< std::string, const Protocol * > & inet::Protocol::getNameToProtocol ( )
staticprotected
20 {
21  static std::map<std::string, const Protocol *> nameToProtocol;
22  return nameToProtocol;
23 }

Referenced by findProtocol(), and Protocol().

◆ getProtocol() [1/2]

const Protocol * inet::Protocol::getProtocol ( const char *  name)
static
66 {
68  if (protocol != nullptr)
69  return protocol;
70  else
71  throw cRuntimeError("Unknown protocol: name = %s", name);
72 }

◆ getProtocol() [2/2]

◆ operator!=()

bool inet::Protocol::operator!= ( const Protocol other) const
inline
35 { return id != other.id; }

◆ operator==()

bool inet::Protocol::operator== ( const Protocol other) const
inline
34 { return id == other.id; }

◆ str()

std::string inet::Protocol::str ( ) const
38 {
39  std::ostringstream os;
40  os << getName() << "(" << id << ")";
41  return os.str();
42 }

Referenced by inet::operator<<().

Member Data Documentation

◆ ackingMac

◆ aodv

const Protocol inet::Protocol::aodv
static

◆ apskPhy

◆ arp

◆ babel

const Protocol inet::Protocol::babel
static

◆ bgp

const Protocol inet::Protocol::bgp
static

◆ bmac

◆ cdp

const Protocol inet::Protocol::cdp
static

◆ clns

const Protocol inet::Protocol::clns
static

◆ csmaCaMac

◆ descriptiveName

const std::string inet::Protocol::descriptiveName
protected

◆ dsdv2

const Protocol inet::Protocol::dsdv2
static

◆ dsr

const Protocol inet::Protocol::dsr
static

◆ dymo

const Protocol inet::Protocol::dymo
static

◆ echo

◆ egp

const Protocol inet::Protocol::egp
static

◆ eigrp

◆ ethernetFlowCtrl

const Protocol inet::Protocol::ethernetFlowCtrl
static

◆ ethernetMac

Register_Protocol_Printer & inet::Protocol::ethernetMac
static

Referenced by inet::ieee80211::Ieee80211Portal::decapsulate(), inet::EthernetMacBase::decapsulate(), inet::EthernetMacProtocolDissector::dissect(), inet::physicallayer::EthernetPhyProtocolDissector::dissect(), inet::Ieee8022Llc::encapsulate(), inet::queueing::EcnMarker::getEcn(), inet::ExampleQosClassifier::getUserPriority(), inet::QosClassifier::getUserPriority(), inet::physicallayer::EthernetPhy::handleMessage(), inet::EthernetEncapsulation::handleSendPause(), inet::EthernetTypeOrLengthInserter::initialize(), inet::Ieee8021aeTagEpdHeaderInserter::initialize(), inet::EthernetMacHeaderInserter::initialize(), inet::EthernetAddressChecker::initialize(), inet::EthernetMacHeaderChecker::initialize(), inet::VirtualTunnel::initialize(), inet::Ieee8021dRelay::initialize(), inet::EthernetEncapsulation::initialize(), inet::DscpMarker::markPacket(), inet::PcapRecorder::matchesLinkType(), inet::EthernetFcsInserter::processPacket(), inet::physicallayer::EthernetPhyHeaderChecker::processPacket(), inet::Ieee8021rTagEpdHeaderInserter::processPacket(), inet::physicallayer::EthernetFragmentPhyHeaderChecker::processPacket(), inet::Ieee8021qTagEpdHeaderInserter::processPacket(), inet::EthernetEncapsulation::processPacketFromHigherLayer(), inet::EthernetMac::processReceivedDataFrame(), inet::EthernetCsmaMac::processReceivedDataFrame(), inet::PcapRecorder::protocolToLinkType(), inet::EthernetSocket::sendOut(), inet::queueing::EcnMarker::setEcn(), and inet::AckingMacToEthernetPcapRecorderHelper::tryConvertToLinkType().

◆ ethernetPhy

◆ flooding

◆ ftp

const Protocol inet::Protocol::ftp
static

◆ gpsr

const Protocol inet::Protocol::gpsr
static

◆ gptp

Register_Protocol_Dissector & inet::physicallayer::Protocol::gptp
static

◆ http

const Protocol inet::Protocol::http
static

◆ icmpv4

◆ icmpv6

◆ id

const int inet::Protocol::id
protected

Referenced by operator!=(), operator==(), and Protocol().

◆ ieee80211DsssPhy

◆ ieee80211ErpOfdmPhy

◆ ieee80211FhssPhy

◆ ieee80211HrDsssPhy

◆ ieee80211HtPhy

◆ ieee80211IrPhy

◆ ieee80211Mac

◆ ieee80211Mgmt

◆ ieee80211OfdmPhy

◆ ieee80211VhtPhy

◆ ieee802154

◆ ieee8021ae

const Protocol inet::Protocol::ieee8021ae
static

◆ ieee8021qCTag

◆ ieee8021qSTag

◆ ieee8021rTag

◆ ieee8022llc

Register_Protocol_Printer & inet::Protocol::ieee8022llc
static

Referenced by inet::Ieee80211MacProtocolDissector::computeLlcProtocol(), inet::EthernetMacProtocolDissector::dissect(), inet::Ieee802LlcDissector::dissect(), inet::physicallayer::Ieee8021qTagEpdProtocolDissector::dissect(), inet::physicallayer::Ieee8021rTagEpdProtocolDissector::dissect(), inet::ieee80211::Ieee80211Portal::encapsulate(), inet::Ieee8022Llc::encapsulate(), inet::Stp::generateBPDU(), inet::Stp::generateTCN(), inet::ieee80211::Ieee80211LlcLpd::getProtocol(), inet::ieee80211::Ieee80211Portal::getProtocol(), inet::Stp::handleTCN(), inet::Ieee8022LlcInserter::initialize(), inet::Ieee8022LlcChecker::initialize(), inet::Ieee8022Llc::initialize(), inet::Ieee8021aeTagEpdHeaderChecker::processPacket(), inet::EthernetTypeOrLengthChecker::processPacket(), inet::Ieee8021aeTagEpdHeaderInserter::processPacket(), inet::EthernetTypeOrLengthInserter::processPacket(), inet::Ieee8022LlcInserter::processPacket(), inet::Ieee8021rTagEpdHeaderChecker::processPacket(), inet::Ieee8021rTagEpdHeaderInserter::processPacket(), inet::EthernetMacHeaderInserter::processPacket(), inet::EthernetMacHeaderChecker::processPacket(), inet::Ieee8021qTagEpdHeaderChecker::processPacket(), inet::Ieee8021qTagEpdHeaderInserter::processPacket(), inet::EthernetEncapsulation::processPacketFromHigherLayer(), inet::EthernetEncapsulation::processPacketFromMac(), inet::Ieee8022Llc::registerMyProtocol(), inet::Rstp::sendBPDU(), inet::EtherTrafGen::sendBurstPackets(), inet::Ieee8022LlcSocket::sendOut(), and inet::Rstp::sendTCNtoRoot().

◆ ieee8022snap

◆ ieee802epd

◆ igmp

◆ igp

const Protocol inet::Protocol::igp
static

◆ ipv4

Register_Protocol_Printer & inet::Protocol::ipv4
static

Referenced by inet::tcp::Tcp::checkCrc(), inet::tcp::TcpCrcInsertionHook::computeCrc(), inet::Udp::computeCrc(), inet::sctp::SctpNatHook::datagramForwardHook(), inet::sctp::SctpUdpHook::datagramPreRoutingHook(), inet::sctp::SctpNatHook::datagramPreRoutingHook(), inet::MplsProtocolDissector::dissect(), inet::Ipv4ProtocolDissector::dissect(), inet::Ipv4Encap::encapsulate(), inet::Ipv4::encapsulate(), inet::Ipv4::fragmentAndSend(), inet::Ipv4::fragmentPostRouting(), inet::queueing::EcnMarker::getEcn(), inet::Ipv4AddressType::getNetworkProtocol(), inet::Ipv4Socket::getNetworkProtocol(), inet::ExampleQosClassifier::getUserPriority(), inet::QosClassifier::getUserPriority(), inet::Ipv4::handleIncomingDatagram(), inet::PimSplitter::handleMessage(), inet::Dsdv::handleMessageWhenUp(), inet::Dsdv::handleSelfMessage(), inet::PingApp::handleSelfMessage(), inet::Tun::handleUpperPacket(), inet::Udp::handleUpperPacket(), inet::Ipv4Encap::initialize(), inet::TunnelApp::initialize(), inet::Ipv4::initialize(), inet::Pim::insertCrc(), inet::Ipv6::localDeliver(), inet::DscpMarker::markPacket(), inet::PcapRecorder::matchesLinkType(), inet::peekNetworkProtocolHeader(), inet::Mpls::popLabel(), inet::Ipv4::prepareForForwarding(), inet::Mpls::processMplsPacketFromL2(), inet::eigrp::EigrpIpv4Pdm::processMsgFromRtp(), inet::Ipv4NatTable::processPacket(), inet::Mpls::processPacketFromL2(), inet::Mpls::processPacketFromL3(), inet::Udp::processUndeliverablePacket(), inet::PcapRecorder::protocolToLinkType(), inet::Ipv4::reassembleAndDeliver(), inet::removeNetworkProtocolHeader(), inet::PimBase::sendHelloPacket(), inet::ospfv2::MessageHandler::sendPacket(), inet::Ipv4::sendPacketToNIC(), inet::Igmpv3::sendQueryToIP(), inet::Igmpv3::sendReportToIP(), inet::Icmp::sendToIP(), inet::LinkStateRouting::sendToIP(), inet::Igmpv2::sendToIP(), inet::PimDm::sendToIP(), inet::RsvpTe::sendToIP(), inet::PimSm::sendToIP(), inet::Ipv4Socket::sendToOutput(), inet::TransportPseudoHeaderSerializer::serialize(), inet::queueing::EcnMarker::setEcn(), inet::Gpsr::setGpsrOptionOnNetworkDatagram(), inet::TunnelApp::socketDataArrived(), inet::BehaviorAggregateClassifier::PacketDissectorCallback::visitChunk(), and inet::MultiFieldClassifier::PacketDissectorCallback::visitChunk().

◆ ipv6

Register_Protocol_Printer & inet::Protocol::ipv6
static

Referenced by inet::tcp::Tcp::checkCrc(), inet::tcp::TcpCrcInsertionHook::computeCrc(), inet::Pim::computeCrc(), inet::Udp::computeCrc(), inet::PimCrcInsertionHook::datagramPostRoutingHook(), inet::Ipv6::decapsulate(), inet::Ipv6ProtocolDissector::dissect(), inet::Ipv6::encapsulate(), inet::Ipv6Tunneling::encapsulateDatagram(), inet::Ipv6::fragmentPostRouting(), inet::Ipv6AddressType::getNetworkProtocol(), inet::Ipv6Socket::getNetworkProtocol(), inet::ExampleQosClassifier::getUserPriority(), inet::QosClassifier::getUserPriority(), inet::Ipv6::handleMessage(), inet::Ipv6::handleMessageFromHL(), inet::PingApp::handleSelfMessage(), inet::Udp::handleUpperPacket(), inet::Ipv6::initialize(), inet::Ipv6::localDeliver(), inet::DscpMarker::markPacket(), inet::PcapRecorder::matchesLinkType(), inet::peekNetworkProtocolHeader(), inet::xMIPv6::processHoAOpt(), inet::eigrp::EigrpIpv6Pdm::processMsgFromRtp(), inet::xMIPv6::processType2RH(), inet::Udp::processUndeliverablePacket(), inet::PcapRecorder::protocolToLinkType(), inet::removeNetworkProtocolHeader(), inet::Ipv6::routeMulticastPacket(), inet::Ipv6::routePacket(), inet::Ipv6::sendDatagramToOutput(), inet::ospfv3::Ospfv3Process::sendPacket(), inet::Icmpv6::sendToIP(), inet::Ipv6Socket::sendToOutput(), inet::TransportPseudoHeaderSerializer::serialize(), inet::Gpsr::setGpsrOptionOnNetworkDatagram(), inet::BehaviorAggregateClassifier::PacketDissectorCallback::visitChunk(), and inet::MultiFieldClassifier::PacketDissectorCallback::visitChunk().

◆ isis

const Protocol inet::Protocol::isis
static

◆ l2isis

const Protocol inet::Protocol::l2isis
static

◆ layer

const Layer inet::Protocol::layer
protected

◆ linkStateRouting

◆ lldp

const Protocol inet::Protocol::lldp
static

◆ lmac

◆ manet

◆ mobileipv6

◆ mpls

◆ name

const std::string inet::Protocol::name
protected

Referenced by findProtocol(), getProtocol(), and Protocol().

◆ nextHopForwarding

◆ nextId

int inet::Protocol::nextId = 0
staticprotected

◆ ospf

◆ pim

◆ ppp

◆ probabilistic

◆ rip

Register_Protocol_Printer & inet::Protocol::rip
static

◆ rsvpTe

◆ rtsp

const Protocol inet::Protocol::rtsp
static

◆ sctp

◆ shortcutMac

◆ shortcutPhy

◆ srp

const Protocol inet::Protocol::srp
static

◆ ssh

const Protocol inet::Protocol::ssh
static

◆ stp

◆ tcp

◆ telnet

const Protocol inet::Protocol::telnet
static

◆ trill

const Protocol inet::Protocol::trill
static

◆ tsn

const Protocol inet::Protocol::tsn
static

◆ tteth

const Protocol inet::Protocol::tteth
static

◆ udp

◆ unitDisk

◆ unknown

◆ wiseRoute

Register_Protocol_Printer & inet::Protocol::wiseRoute
static

◆ xmac

◆ xtp

const Protocol inet::Protocol::xtp
static

The documentation for this class was generated from the following files:
inet::Protocol::getIdToProtocol
static std::map< int, const Protocol * > & getIdToProtocol()
Definition: Protocol.cc:13
inet::Protocol::nextId
static int nextId
Definition: Protocol.h:18
inet::Protocol::UnspecifiedLayer
@ UnspecifiedLayer
Definition: Protocol.h:23
inet::Protocol::getNameToProtocol
static std::map< std::string, const Protocol * > & getNameToProtocol()
Definition: Protocol.cc:19
protocol
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
inet::Protocol::layer
const Layer layer
Definition: Protocol.h:29
inet::Protocol::descriptiveName
const std::string descriptiveName
Definition: Protocol.h:28
inet::Protocol::LinkLayer
@ LinkLayer
Definition: Protocol.h:23
inet::Protocol::name
const std::string name
Definition: Protocol.h:27
inet::Protocol::Protocol
Protocol(const char *name, const char *descriptiveName, Layer layer=UnspecifiedLayer)
Definition: Protocol.cc:25
inet::Protocol::TransportLayer
@ TransportLayer
Definition: Protocol.h:23
inet::Protocol::PhysicalLayer
@ PhysicalLayer
Definition: Protocol.h:23
inet::Protocol::getName
const char * getName() const
Definition: Protocol.h:38
inet::Protocol::NetworkLayer
@ NetworkLayer
Definition: Protocol.h:23
inet::Protocol::id
const int id
Definition: Protocol.h:26
inet::Protocol::findProtocol
static const Protocol * findProtocol(int id)
Definition: Protocol.cc:44