1. Evaluation of resource discovery protocol in ad-hoc-sharing networks
Submitted to
Dr. Kavitha Ranganathan
Associate Professor at IIM Ahmedabad
By
Ines Khandelwal
ines.khandelwal@gmail.com
Swayam Tibrewal
swayam2607@gmail.com
2. Objective:
Implementation of Scalable Broadcast Algorithm for file sharing in a Mobile Ad Hoc Network.
Software Used
Omnet++https://omnetpp.org/
Version : OMNeT++ 5.0b3 released Wednesday, 09 December 2015 15:09
Omnet++ is a discrete event simulator, which is an extensible modular component based C++
Simulation library and framework for building network simulators.
We chose Omnet because it is one of the most popular Open Source Open Source Network
Simulators used for MANETs and VANETs related simulations. As a trend we found that most
papers before 2008 used ns-2 (no longer under active development) as the simulator and after
that most of the papers preferred Omnet++ or the simulators built on top of it or the ones such
as MIXIM and MANET-INET which were later deprecated and became part of INET Framework.
Oment's biggest advantage is the presence of libraries such as INET which is built on top of
Omnet++ especially for wireless and mobile Networks.
INEThttps://inet.omnetpp.org/
Version: INET 3.2 Released Thursday, 17 December 2015 15:03
Operating System:
Ubuntu 14.04 LTS
Windows 10
However for debugging, only Ubuntu was used due to trouble with debugging on Windows. The
final implementation was however tested on both Machines
3. Installation Directions and Guidelines can be found in the respective sites. However if the
supplied zip is used, it will not be needed.
Scalable Broadcasting Algorithm
Source: On the Reduction of Broadcast Redundancy in Mobile Ad Hoc Networks (Wei Peng
Xi-Cheng Lu)
1) For source s, it just broadcasts messages to all its neighbors and ignores duplicate messages
received later.
2) For any other node, say u, when it receives a broadcast message m from node r, it performs
the following operations:
a) If N(u) is a subset of N(r) U {r}, then no rebroadcast need be performed and the duplications
received later will be dropped.
b) Or else, if the message is received firstly, then let C(u,m)=N(r) U {r}, and schedule a
rebroadcast by delaying the rebroadcast operation for a random period. In this period,
any successive duplicates will be discarded, and at the mean time the information of the nodes
covered by the transmissions will be recorded in the broadcast cover set. That is, if m is a
duplicate, then let C(u, m)=C(u, m) U N(r) U{ r}, and discard m.
c) After the delay period is expired, if N(u) is a subset of C(u, m), then cancel the rebroadcast; or
else, rebroadcast the message m. The duplicate messages received later will be ignored.
File Sharing Network
The aim is to simulate a Mobile Ad Hoc Network where a node needs a particular file, not
available to it.
In this process, it first searches for the file in the network and must first tabulate the routes to
all possible replicas. The route to these replicas must then be stored in a certain data structure
which must be a property of only that node and then depending on the calculation of stability
metric, we must decide on the route from where the node should receive the file.
Note: The implemented module is henceforth referred to as IIM Model.
Implementation
The IIM Model has been built on top of AODV.
In Spite of our primary work being that of broadcasting protocol, which was successfully
implemented using SBA; since routes back to a node must be stored, the routing protocols had
to be considered.
4. These ideas were borrowed from the AODV Routing Protocol which is already implemented in
the INET Framework.
The entire code has been written on top of AODV Framework. The original AODV Files were
taken renamed to IIM and then they were modified. Also by making changes in linkings in the
INET Namespace, we were able to ensure that IIM was registered as a proper protocol in the
INET Codebase.
INET Usage
INET maintains a separate structure for all layers as per the OSI Framework. For easy
references, all commands to be typed in the Terminal are in Bold Letters.
Building Source Files
Since IIM is implemented as a part of main INET Framework , the files must be built again and
again whenever a change is made to the files.
For this navigate to inet root Directory and in Terminal type
make makefiles
This command generates the makefile corresponding to the source files.
Then type
make
This command builds the source and if the files are built for the first time, it takes 20-25
minutes. In this scenario, it generates a libINET.so (library INET), a library which the simulations
will use. This library is created in the “inet/src” directory
Also do not try to modify the makefile after it has been created.
src Directory
The src Directory (“inet/src”) has the library and all the major sources.
Navigate to (“inet/src/inet/routing/iim”) to look at the source files for IIM Protocol
1. IIM.ned which defines the IIM simple module with its gates and
parameters, and contains its documentation as a comment (so that it can later
be extracted into HTML by the opp_neddoc tool)
2. IIMControlPacket.msg which defines the architeture of messages taht will besent
to nodes in IIM
3. IIMRouting.h which contains the simple module class (class IIMRouting : public
cSimpleModule) with its corresponding changes.
5. 4. IIMRouting.cc which contains the implementation (member functions) of the
IIMRouting class
5. IIMRouteData.h and IIMRouteData.cc which define a few parameters for the
Route taken by a packet.
Navigate to (“inet/src/inet/node/iim”) to look at the Router used in the IIM Simulation.
examples Directory
Navigate to (“inet/examples/iim”) to look at the files used in the simulation
There are two major files in this directory:
1. IIMNetwork.ned This file defines the simulation variables and parameters
2. omnetpp.ini : This file defines all the simulation parameters
Debugging
Using debuggers in INET has no proper documentation available. However the following trick
works. Instead of generating the library which occurs by default, an EXE file corresponding to
INET sources can be generated by tweaking the process of making makefiles. However for using
that the simulations need to be done differently
Tweak for makefiles:
For this navigate to inet root Directory and in Terminal type
make makefiles-exe
This command generates the makefile corresponding to the source files.
Then type
make
This command builds the source and if the files are built for the first time, it takes 20-25
minutes. In this scenario, it generates a INET (executable file).
For a few errors, this executable can then be tested using gdb and valgrind to analyze what is
happening. However it works only for segmentation faults and not for any other kind of faults
which may be causing the simulation to crash. In case of certain other faults, the log files of
simulation must be analyzed.
To run the executable all files in the example directory must either be given as a parameter or
shifted to the src directory.
File Matching Function
7. requests. This feature is removed in the IIM Model by forcing the node to send periodic Hello
messages to all its neighbours and the node now keeps tracks of all its neighbours by
generating new HELLO Messages after a certain fixed interval.
These two aspects ensure that the Routing table of RFC 3561 Specification is tweaked to act as
Neighbour Table too.
The stability metric was to be calculated on the basis of time at which nodes are created and
the routing table allows us to specify the time at which the route is created. This is inbuilt in
AODV as the routes become invalid if the Current SimTime- Time of Last Update rises above a
certain limit. These times which are a property of “route” stored in the Routing Table can be
used to determine using the same “Current SimTime- Time of Last Update” parameter the
stability of the route.
The IIM Model is extensible in this direction but this feature has not been implemented.
SBA Algorithm
Implementation Strategy:
1. We have a global variable of nodes the message has passed through. This is implemnted
as a set of visited Nodes which is available to all the nodes and is updated when the
broadcast message looking for files reaches them.
2. Most algorithms try to ensure that we are able to prevent duplicates by maintaining a
copy of which message was received or broadcasted. For instance if a neighbor of the
source broadcasts, it is natural that the source node will receive the message as well and
must handle it as well.
3. Once a node has broadcasted, all its neighbours and the node itself have already
been accounted for in the global set of visited nodes. Hence for the same simulation
run, that node cannot broadcast again. However there could be time complexities
associated in the process of comparing the list of visited nodes with the neighbour set
which could not been taken into account if the algorithm is scaled up.
4. Alternately a strategy of marking nodes as visited and setting them to stop or ignore all
messages after they have broadcasted or decided not to broadcast received subsequently
also poses problems if the simulation needs to be extended beyond resource discovery.
There can be more messages than those for resource allocation which cannot be ignored
5. Now if the node is the originator it’s neighbors are added and it always broadcasts.
6. Now we reach a Node A, and B and C are its neighbours.
8. 7.
1. B and C are already covered. Then this node simply deletes the packet
in question and won’t rebroadcast.
2. At least one of B and C is not there. There has to be a random delay.
After the delay there, are only two possibilities, A broadcasts or not. During the
delay, new nodes are covered accounted for.
i. To implement the delay, the node schedules a self message called
RADTimer which is scheduled after a certain random delay.
ii. This self message instructs the node to, after a certain delay proceed as it
did before, compare the global covered set and see if it should rebroadcast
or not.
Expanding Ring SBA
Here you first restrict yourself to say n hops and then n+m, n+2m hops and so on. Say each hop
takes one unit of time. We use the parameter TTL or Time to live as a measure of the number of
hops for which a message should survive.
Then the TTL or Time to Live of a message can be changed accordingly.
Initially TTL = m
On encountering a new node, decrease TTL by one, Omnet does this automatically
When TTL =0 and no reply has been sent back TTL = n.
Terminating Condition: Either all nodes are covered or a reply was received.
So if you are the originator send TTL of m and decrement it. If the TTL value becomes 0 then
increase it by n in subsequent runs.
Simulation Working
Hello messages occur throughout the simulation as per certain parameters defined in the .NED
file.
Broadcast Messages are generated by the node which wants to find the file.
Even though these are broadcast messages yet when they go back to their originator, they must
take back two things, the stability metric of the route and the route to that node in the routing
table
Eventually multiple routes will come and the protocol must choose the one with least hops as the
most optimal route.