Implementing new routing protocol

184 views
Skip to first unread message

Ricardo G.

unread,
Oct 2, 2014, 10:02:36 AM10/2/14
to ns-3-...@googlegroups.com
Hi,

I'm creating a new protocol. I have an Ipv4RoutingProtocol subclass that I've coded. But how do I get to control the nodes that have the protocol?

For instance:

UdpEchoClientHelper echoClient (interfaces.GetAddress(0), 9);
echoClient
.SetAttribute ("MaxPackets", UintegerValue (packets));
echoClient
.SetAttribute ("Interval", TimeValue (Seconds (0.01)));
echoClient
.SetAttribute ("PacketSize", UintegerValue (1024));

If I want a single node to send a message through my protocol, I think I have to code a helper (like the one mentioned above) to perform this, but I'm not sure. And if so, does anyone have an example or can recommend me some easy to helper to learn how to do it?

Something like this:

MyProtocol mp (nodes.GetNode(0));
mp
.SendMessage(destination, message, ....);

Thanks :)

Tommaso Pecorella

unread,
Oct 2, 2014, 1:35:36 PM10/2/14
to ns-3-...@googlegroups.com
Hi,

I'd strongly suggest you to study one of the already implemented routing protocols. And no, you do not need an helper to do what you are saying. But you'll need one for other purposes. Again, study an existing routing protocol implementation and its helper.

Cheers,

T.

Ricardo G.

unread,
Oct 3, 2014, 9:45:25 AM10/3/14
to ns-3-...@googlegroups.com
Hi,

is there some implemented routing protocol that you'd suggest me?

Thanks.

Tommaso Pecorella

unread,
Oct 3, 2014, 9:51:15 AM10/3/14
to ns-3-...@googlegroups.com
Ripng.

T.

JaNa

unread,
Oct 3, 2014, 10:14:48 AM10/3/14
to ns-3-...@googlegroups.com
Hi

Ricardo G,


If you wanna study a routing protocol implemented for IPV4 network, I can give my source code for you to study.

That routing protocol is also a distance vector Routing protocol. The routing protocol can be found in the following link.

https://github.com/westlab/ns-3-SoR-Routing

Regarding the helper call, actually it is not necessary to implement a helper. You can directly pass values. But you wanna have a Helper for some other purposes. 


If you get any questions, please feel free to ask.


JaNa


--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.



--
Best Regards..

    """""""""""
:)   JaNa     :) 
    """""""""""

Ricardo G.

unread,
Oct 5, 2014, 11:03:42 AM10/5/14
to ns-3-...@googlegroups.com
Hi Jana,

I saw the helper code of your routing protocol. It's so small, I don't get what are the helpers for.

My routing protocol is a geographic one, in order to send a message I need to assign the coordinates of the area of interest along the message itself. How can I achieve this?

For example:

NodeContainer nodes;
nodes.Create(30);

//This is the part I don't know how to achieve
MyProtocol
mp (nodes.GetNode(0)); //I select the node
mp
.SendMessage(message, x1, y1, x2, y2); //I specify the message and the coordinates
mp.Start(Seconds(5)); //The time when the message should be sent
 
Thank you.

Ricardo G.

unread,
Oct 6, 2014, 2:43:22 PM10/6/14
to ns-3-...@googlegroups.com
Hi,

I've successfully created the helper of the routing protocol. I still don't get what are the helpers exactly for though.

The protocol is running apparently ok, but to test it I need to send messages.

I still don't know how to tell a single node to send it. I created a method in the routing protocol to send the packet. Because I use my own packets the method receives the parameters to fill the packet fields and then sends it using an UPD socket.

Again, the issue is that I don't know how to select a single node in the main script (where I create the topology, the nodes, install the routing protocol and that stuff) and the time this single node should send a message, or multiple messages at diferent time.

Thank you.

Ricardo G.

unread,
Oct 6, 2014, 2:46:56 PM10/6/14
to ns-3-...@googlegroups.com
And I forgot to tell, Tommaso, I couldn't find the RIPng protocol anywhere in the ns3 doxygen page nor the ns.3-17 src folder :(

I've been using AODV to see how a protocol is coded in ns3.

Tommaso Pecorella

unread,
Oct 6, 2014, 4:44:51 PM10/6/14
to ns-3-...@googlegroups.com
Hi,

I'd strongly suggets to use 3.21. 3.17 is quite old, and... well, it missed a lot of thing (like RipNg).

Cheers,

T.

Ricardo G.

unread,
Oct 6, 2014, 7:03:53 PM10/6/14
to ns-3-...@googlegroups.com
Hi,

Okey, I'm gonna try to update it or create a fresh new install, I was aware of new versions of NS3 but I'm not a linux (ubuntu) experienced user and it's kinda hard to install (at least the first time it was), so I didn't want to ruin something so I decided to stay with the safe option.

By any chance do you know how to achieve my question about to select a single node and make it send a message in a given time?

Thanks.

Tommaso Pecorella

unread,
Oct 7, 2014, 1:13:49 AM10/7/14
to ns-3-...@googlegroups.com
Hi,

sending a packet at a given time is "easy" and should be explained in the tutorials. In particular 5th, 6th and 7th scripts are all sending packets from the main. Well, not exactly from the main function, but close enough. Search for "Simulator::Schedule".

Hope this helps,

T.

Ricardo G.

unread,
Oct 7, 2014, 9:56:56 AM10/7/14
to ns-3-...@googlegroups.com
Hi,

thank you for your quick answer, I'll look for that.

And about updating ns3, is there a way to upgrade my ns-3.17 to the latest? and also, is it possible to have two different versions of ns3 installed at the same time? I don't know if ns3 configures variables (for example NS3_HOME or something like that).

Regards.

Tommaso Pecorella

unread,
Oct 7, 2014, 11:23:42 AM10/7/14
to ns-3-...@googlegroups.com
Hi,

just follow the instructions here:
http://www.nsnam.org/docs/release/3.21/tutorial/singlehtml/index.html#document-getting-started

You can have as many ns-3 versions as you want, but I'd suggest to NOT use the one packetized for Ubuntu. If you have that one, just uninstall it before using the other ones (it may mess up with your own ones).

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages