Simple flooding or ReBroadcasting (in Ad hoc network)

1,095 views
Skip to first unread message

Mseyt

unread,
Sep 1, 2015, 11:47:30 AM9/1/15
to ns-3-users
Hi,

I'd like to disseminate information to given area of nodes without any Routing protocols (such as olsr, aodv) (in Ad hoc network),
receiver nodes should rebroadcast (or forward/send) received messages ...

I have used "wave-simple-80211p" example and added some nodes by using RandomBoxPositionAllocator in a given area..., and managed Transmission range of nodes,
but, as the result - here communication is only one hop, nodes are not rebroadcasting

The objective is to disseminate information to whole network

is there already implemented Flooding algorithm in NS3 or could you give me any idea ...,



Thanks,
Mseyt.

Konstantinos

unread,
Sep 1, 2015, 12:06:18 PM9/1/15
to ns-3-users
Hi Mseyt,

In principle any forwarding method can be classified as a Routing Protocol. Flooding IS a routing protocol, not unicast as OLSR and AODV, so your description "without any routing protocol" is invalid. 
There is no flooding protocol implemented in NS-3 at the moment. Contributions are always welcome. 

You could easily implement a flooding mechanism at the application layer, i.e. when you receive a broadcast packet, re-broadcast it. Such mechanism can be found in the UdpEcho/Ping applications, where the server receives a packet and replies back with a new packet. In your case the packet would be send to the broadcast address.

Otherwise, you could implement a similar mechanism at the network layer.

Regards,
K.

Mseyt

unread,
Sep 19, 2015, 2:46:44 AM9/19/15
to ns-3-users
Hi Konstantinos, thank you for your answer.
I did not solve my problem yet.

I'd like to know Should I create new routing protocol (in ns3 - new module/model...) to implement Flooding algorithm? or may I copy and modify existing functions.

Actually I am working on (as I mentioned above) "wave-simple-80211p" example and added some nodes by using RandomBoxPositionAllocator in a given area..., and managed Transmission range of nodes, but, as the result - here communication is only one hop, nodes are not rebroadcasting
  
I found SendTo() function from Socket:
int Socket::SendTo (const uint8_t* buf, uint32_t size, uint32_t flags, const Address &toAddress) {...}

 and added it to ReceivePacket() function to "ReBroadcast" received packet

--> result: all received packets are ReBroadcasted (immediately, without any random delay, without any conditions...)

then, I added new "bool Received" variable - I made it Global variable - and initial value is "false", inside of ReceivePacket I checked it - if it is false SendTo and made it's value true. But, as I made it Global variable - it could be true from the first received packet...

So, my problems:
--> I need to check Received packets if it is received before or not Distributedly, not Globally - each node should has own Received variable to check..., but I don't know yet how to do it

--> I need other function like ForwardTo instead of using SendTo - who can forward Copy (Source info) of received packet instead of Creating new packet (as it is in SendTo) (--> I think I need to access packet header to copy Source information - but I don't know how to access packet header - GetSourceID,Address... and Set to)

Please could you help me to implement Flooding algorithm in my example:

- Source node should generate a packets (periodically with time interval) - it is ok - given in example.
- all other nodes should ReBroadcast received packets - but only one time ()

Thank you again,
Regards,
Mseyt

Tommaso Pecorella

unread,
Sep 19, 2015, 4:13:18 AM9/19/15
to ns-3-users
Hi,

I'm sorry to say, but you lack the basics for completing the assigned task. The approach you're following will lead to nowhere, or better, will lead you only to the sort of problems that have been solved already by real flooding protocols.
Again, sorry if this seems harsh, but I'd rather point you to the right direction.

First point: as Kostantinos mentioned already, flooding IS is routing protocol. You could try to bypass routing, but you'll only end up with a nightmare, simply because flooding is routing. Deal with it.
Now, routing can be done below (aka, mesh-under) or above (aka route-over) IP. In the first case you'll have to work with NetDevices and shim layers before the packets reach IP, in the second case you must obey the Ipv4RoutingProtocol interfaces (or the Ipv6RoutingProtocol). Note that the protocols in the "mesh" module are mesh-under.
If you work with mesh-under protocols, then you have no sockets at all. I you have sockets, you're route-over. I it's route.over, the routing is done in the RouteOutput and IpForward functions.
Moreover, you can NOT have a "bool Received" variable, because you need to recognize the packets. A "bool Received" would work or one packet only. As a side note, the question "each node should has own Received variable to check" means that you must give a second read to your C++ textbook. 

Summarizing:
1) Yes, you need a new module, or at least a new class in an existing module.
2) Yes, you need a way to [reliably] tell if a node has already forwarded a packet or not. This could be quite hard or very simple, depending on your assumptions. E.g., can you assume that there's a sequence header in the packet ? For sure you need an structre to hold the past packets you have seen and some timers to clean up the ones that are old enough.
3) You lack the design phase. Do *not* start coding without a good understanding of what you have to do and what parts of code you ned to change or add. Otherwise it's like trying to fix an engine without knowing how an engine works, and hoping that, by opening it and doing "something" you can fix it. It will not work.

Start with point 3, it's the most important. Moreover, controlled flooding is a topic that is very well explained in the literature. Find a good paper and study it.

T.

Mseyt

unread,
Sep 19, 2015, 7:03:29 AM9/19/15
to ns-3-users
Hello Tommaso, thank you very much for your quick response.

1) You are right, there are many papers explained flooding algorithm..., one of them is http://www.cs.berkeley.edu/~culler/cs294-f03/papers/bcast-storm.pdf
2) I knew that it is not good idea to add "bool Received" variable to check..., I will try to read one more time C++ textbooks - but, if possible could you explain me by two words what should I need to give more attention (object oriented...)
3) I found flooding algorithm implemented in NS2 - http://www.di.fc.ul.pt/~hmiranda/pampa/ (and other Counter-, Distance-...based algorithms)
and I found it even in NS3, but for nanoscale networks, used in Nano-Sim - http://telematics.poliba.it/index.php/en/nano-sim

Please could you give first directions/steps... to create new module (or class)

Should flooding protocol's design needs to be similar with (existing in ns3) AODV, DSDV, DRS, or OLSR, - please could you let me know in which level they have created - below or above IP - I think I need second one - above IP, I need to deal with sockets...

Should I follow the steps https://www.nsnam.org/docs/manual/html/new-modules.html
or could you recommend me any other ways...

And the last question for now: Should I update my ns3 to latest release (I have ns3.23)?

Thank you again,
Best Regards,
Mseyt.

Konstantinos

unread,
Sep 19, 2015, 6:15:10 PM9/19/15
to ns-3-users
Hi Mseyt,


On Saturday, September 19, 2015 at 12:03:29 PM UTC+1, Mseyt wrote:
Hello Tommaso, thank you very much for your quick response.

1) You are right, there are many papers explained flooding algorithm..., one of them is http://www.cs.berkeley.edu/~culler/cs294-f03/papers/bcast-storm.pdf
2) I knew that it is not good idea to add "bool Received" variable to check..., I will try to read one more time C++ textbooks - but, if possible could you explain me by two words what should I need to give more attention (object oriented...)
3) I found flooding algorithm implemented in NS2 - http://www.di.fc.ul.pt/~hmiranda/pampa/ (and other Counter-, Distance-...based algorithms)
and I found it even in NS3, but for nanoscale networks, used in Nano-Sim - http://telematics.poliba.it/index.php/en/nano-sim

Please could you give first directions/steps... to create new module (or class)

Should flooding protocol's design needs to be similar with (existing in ns3) AODV, DSDV, DRS, or OLSR, - please could you let me know in which level they have created - below or above IP - I think I need second one - above IP, I need to deal with sockets...


These are above IP.
 
Should I follow the steps https://www.nsnam.org/docs/manual/html/new-modules.html
or could you recommend me any other ways...


These steps should be followed to create the structure of the module.
 
And the last question for now: Should I update my ns3 to latest release (I have ns3.23)?

Yes, now would be a good time to update. NS-3.24 is out, and you have nothing to lose (you have not developed any code to be ported), only to gain by using the latest. 

Mseyt

unread,
Oct 2, 2015, 12:03:36 PM10/2/15
to ns-3-users
Hi Konstantinos,

I'd like to know does flooding need RouteOutput and RouteInput methods
(and do I need to create new module, folder in src/flooding like src/aodv, src/dsr,...
 but for flooding maybe we can need only files one for header and one for protocol?)

because it does not need routing tables, ...

... Receiver node needs to forward a packet if it is not received before...

simple operations Send, Receive, Check, Forward, ...

Thank you,
Regards,
Mseyt.

Konstantinos

unread,
Oct 2, 2015, 12:27:15 PM10/2/15
to ns-3-users
Hi, 

This question seems familiar and I think I have already answered it again.
Perhaps the same tutor has given the same exercise to two students...

See the answers inline

On Friday, October 2, 2015 at 5:03:36 PM UTC+1, Mseyt wrote:
Hi Konstantinos,

I'd like to know does flooding need RouteOutput and RouteInput methods
(and do I need to create new module, folder in src/flooding like src/aodv, src/dsr,...
 but for flooding maybe we can need only files one for header and one for protocol?)

because it does not need routing tables, ...


Yes, it does need RouteOutput/RouteInput if you design it to be inherited by Ipv4RoutingProtocol class, such as AODV. 
DSR does not have, as it the developers followed a different approach (which IMHO has lead to problems in its usage/comparison).

The number of files that you will create within that module it's up to you. It will depend on how many classes you will need etc.
It's a design decision by the developer (YOU).
 
... Receiver node needs to forward a packet if it is not received before...

simple operations Send, Receive, Check, Forward, ...


I haven't said anywhere that the operations need to be complex. However, there are certain 'rules' to be followed.
For example the operation 'send' is masked under the RouteOutput method.
Similarly the 'receive' is masked under the RouteInput method. 
The check/forward operations are part of the RouteInput since after you receive it you check what to do with it.

Mseyt

unread,
Oct 2, 2015, 12:49:59 PM10/2/15
to ns-3-users
Thank you very much Konstantinos,

My problem was that I followed mainly DSR :

for me DSR was nearest one from existing in ns3 routing protocols
(OLSR and DSDV - proactive, AODV has Routing tables..., but DSR also has routing table, but - I thought its "dynamicity"-DynamicSR)

so, from now I will study AODV structure...

Thank you again,
Regards,
Mseyt.

Konstantinos

unread,
Oct 2, 2015, 1:02:04 PM10/2/15
to ns-3-users
You should not study how DSR/AODV or any other protocols function, as all of them are unicast and yours is broadcast.
What you should study is the NS-3 manual on Internet/Routing https://www.nsnam.org/docs/models/html/routing-overview.html
and how you can design a routing protocol.
I would recommend to have a look at the RIPng protocol as it has the simplest implementation of all protocols in ns-3.
Have you studied the tutorial/discussion I have posted in my previous reply?
Again, I would like to stress first to design your protocol on paper, UML diagram or any other method before you start coding. 
Think about what you need, perhaps you might not even need a specific header, you can use existing (IP header), but that will come after your design.

Regards,
K.

dear...@hotmail.com

unread,
Oct 6, 2015, 3:30:57 PM10/6/15
to ns-3-users
Hola, 

thanks for the help Sirs , I'm having the same problem I will work on creating new routing protocol my quesiton is 

I need to keep track of neighbours of  each node in addition to their locations I know that this can be acheived using hello messages,  I looked at CLWPR , OLSR and GPSR I found that GPSR hello messages are the easier 

can I fallow the method of GPSR to implement it in my protocol I managed to send location X and Y of the sender just for test based on simple ad hoc example... 

when I looked at CLWPR and OLSR headr files it was so hard on me to understand special that I'm new to ns3  


Gracias,

Jamila 
Reply all
Reply to author
Forward
0 new messages