how to make a custom new protocol in ns3?

334 views
Skip to first unread message

Anjana Bhadra

unread,
May 11, 2021, 12:30:55 PM5/11/21
to ns-3-users
hello hope all are well in pandemic. i just want to know the procedure how to make a custom protocol in ns3? will need only .cc file or a total folder that contains helper, example,wscrpit and etc.
or anything i don't know kindly suggest me the steps.
thanks in advance.

Brian O'Neill

unread,
May 11, 2021, 3:19:27 PM5/11/21
to ns-3-users
Hi,

I'm still very new to ns3 myself, but for getting started a new protocol I ran ./utils/create-module.py contrib/new-module to create the structure you hinted at with the helper example etc. and then I turned that new-module folder into a git repository for versioning. Here's the man page on that method: https://www.nsnam.org/docs/manual/html/new-modules.html

However, you also have the option to only create a .cc file in the scratch folder which will be compiled without any additional work.

So, my understanding is that both are options for getting started.

You could consider starting with testing with a file in the scratch folder and then moving to a folder in contrib.

- Brian

Tom Henderson

unread,
May 11, 2021, 4:53:55 PM5/11/21
to ns-3-...@googlegroups.com, Brian O'Neill
On 5/11/21 12:19 PM, Brian O'Neill wrote:
> Hi,
>
> I'm still very new to ns3 myself, but for getting started a new
> protocol I ran ./utils/create-module.py contrib/new-module to create
> the structure you hinted at with the helper example etc. and then I
> turned that new-module folder into a git repository for versioning.
> Here's the man page on that
> method: https://www.nsnam.org/docs/manual/html/new-modules.html
>
> However, you also have the option to only create a .cc file in the
> scratch folder which will be compiled without any additional work.
>
> So, my understanding is that both are options for getting started.

Yes, with the caveat that one can create more than a single .cc in the
scratch folder.  This is not well documented, but if you create a
subfolder in scratch and put multiple .cc and .h files there, with one
of the .cc files containing a main(), Waf will build and link all of
them together and you can run by specifying the name of the subdirectory.

However, for a new model or protocol, I never use scratch for this, I
create a new module, as described here:

https://www.nsnam.org/docs/manual/html/new-modules.html

- Tom
Reply all
Reply to author
Forward
0 new messages