Layer 2 protocol on top of LLC/SNAP

57 views
Skip to first unread message

Sergio Domínguez

unread,
Jan 15, 2018, 9:09:43 AM1/15/18
to ns-3-users
Hi,

First of all thank in advance.
This is my first message in this group and I don't have much experience with ns-3. I hope my questions make sense.

I'm trying to build a protocol on top of the LLC/SNAP on an wifi ad-hoc network using the 802.11a standard.
I don't need to forward the frames to higher layers (ip,...), the protocol I'm building will be the highest layer.

I have seen different classes that can be used as base class for building a custom protocol such as:
ns3::MeshL2RoutingProtocol
ns3::Ipv4L3Protocol

I may be wrong but I don't think they really fit my needs. The first one, because even though it is on the right layer, I'm not working with a mesh network and the second because I won't use the IP protocol.

Is there a base class which I will fit my user? Or should I just create a class for the protocol which is a subclass of ns3::Object?


And furthermore, I have also seen the "install mechanism" in different examples like the following:
 "mobility.Install (nodes);"
  or
 "InternetStackHelper internet;
 internet.Install (nodes);"

In case there is no base class that I can use for my protocol, how could I install my protocol in to the nodes/wifinetdevices ?

Thank you very much,
Sergio

Tommaso Pecorella

unread,
Jan 15, 2018, 12:31:05 PM1/15/18
to ns-3-users
Hi,

though questions for a novice :D

Let's start from the bottom.
The "Install" function is provided by the Helper(s). Every protocol should have an Helper class that automates the tasks required to properly setup the protocol in the node.
The Install function can be simple or very complex, depending on the protocol. You should start by checking a simple one to understand what it does. A good example is CsmaHelper.

The protocol problem is more complex.
If you want something that is called by the NetDevice upon receiving a packet, the best solution is to develop a new protocol living above a NetDevice. It can be a L3 or a L2.5 protocol, it's not really important.
There is no fixed base class for such protocols, and you can (should) derive it from Object. The simplest one to check is IPv4.
In order to have packets passed to your protocol you'll need to "register" is with the node, the relevant function is:
void
Node::RegisterProtocolHandler (ProtocolHandler handler,
                               uint16_t protocolType
,
                               
Ptr<NetDevice> device,
                               
bool promiscuous)
Check the documentation for more info.

If you register your protocol, then any packet matching the criteria you gave will be passed to the handler, and you'll have your working protocol.

Happy coding,

T.

Sergio Domínguez

unread,
Jan 15, 2018, 4:07:11 PM1/15/18
to ns-3-...@googlegroups.com
Thanks a lot Tommaso.

That's exactly what I was looking for.  :)

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/Vu3XAMIKLb0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages