is protocol or protocolNumber just a Flag for user criteria usage model or is mapped to specific protocol?

24 views
Skip to first unread message

Francisco Eduardo Balart Sanchez

unread,
Nov 25, 2016, 3:45:08 PM11/25/16
to ns-3-users
Good day:

I apologize in advance, maybe this question is quite obvious but i haven't clear enough my doubt with the existing documentation or i have being reading the wrong documentation.

I want to know if the protocol/protocol_number is just a number that the user developer can use as a flag identifier or we can actually map the protocol number to a specific protocol
meaning:
protocolNumber = 1 -> Protocol A
protocolNumber = 2 -> Protocol B, and so on

Looking at the ne-device.cc and .h i just found this


In the documentation below is a description of the protocol

Parameters
devicea pointer to the net device which is calling this callback
packetthe packet received
protocolthe 16 bit protocol number associated with this packet. This protocol number is expected to be the same protocol number given to the Send method by the user on the sender side.
senderthe address of the sender


Also in the send command for the netdevice (and wifinetdevice) you can find that this protocol number is used

virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) = 0;

In the wifinetdevice.cc you can see also this protocol number

314 bool
315 WifiNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
316 {
317  NS_LOG_FUNCTION (this << packet << dest << protocolNumber);
319 
320  Mac48Address realTo = Mac48Address::ConvertFrom (dest);
321 
322  LlcSnapHeader llc;
323  llc.SetType (protocolNumber);
324  packet->AddHeader (llc);
325 
326  m_mac->NotifyTx (packet);
327  m_mac->Enqueue (packet, realTo);
328  return true;
329 }


Digging further the protocolNumber is used for the LLcSnapHeader for them_etherType

38 LlcSnapHeader::SetType (uint16_t type)
39 {
40  NS_LOG_FUNCTION (this);
41  m_etherType = type;
42 }
43 uint

I´m out of ideas, i just want to clarify this to see if this has a direct relationship with when we setup the protocol with the helper, is just a number we can use a an identifier and has no direct mapping with a protocol vs its number

Thanks in advance and best regards


Konstantinos

unread,
Nov 26, 2016, 4:53:01 AM11/26/16
to ns-3-users
Hi,

There is indeed a relationship in the protocol number that is defined in IANA
http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

If you read the Send() documentation it is a bit more clear about the protocol:
protocolNumber: identifies the type of payload contained in this packet. Used to call the right L3Protocol when the packet is received.

Regards,
K.
Reply all
Reply to author
Forward
0 new messages