Beruflich Dokumente
Kultur Dokumente
As we need one random value based on one seed, we have to fix the seed. So in
aodv.cc file we have to add one constant. (This constant can should be added in aodv.h file. I have
added in aodv.cc file as I added it in between the implementation and it will take time to compile if it will be added
in aodv.h file. So while doing changes in the aodv.h file, do the as many changes together as possible.)
When source want to send the RREQ packet, it has to first sign it. For sending RREQ
packet function sendRequest() is defined in aodv.cc file where implementation of
AODV class is there. Here any method for digital signature can be added or called.
//--------------DIGITAL SIGNATURE BY SWATI----------------------------rq->sign=index+5;
printf("Source: At node %d Sign : %d \n",index,rq->sign);
//-----------------END OF DIGITAL SIGNATURE----------------------------------
Source have sent the RREQ. Any intermediate node, who will receive this packet
has to verify the digital signature and hash function. So this verification code can be
put in receiveRequest() function. In this unction we will add this code after the
code where request duplication is checked and before we record broadcast id.
Before we set up reverse path.
id_insert(rq->rq_src, rq->rq_bcast_id); //after this line
//-----------------DIGITAL SIGNATURE BY SWATI------------------if((
{
}
else
{
( (ih->src_).addr_ )
+ 5 )!= rq->sign)
}
//-------END OF DIGITAL SIGNATURE------------------------//----------------HASH FUNCTION BY SWATI-----------------------int i =0;
int temp=1;
for( i=0 ; i < rq->max_hop_count ; i++ )
temp *= RANDOM_SEED * RANDOM_SEED;
if(temp==rq->top_hash)
printf("Hash function varified at %d\n",index);
else
printf("Hash function not varified at %d\n",index);
//------------------END OF HASH FUNCTION---------------aodv_rt_entry *rt0; // rt0 is the reverse route //before this line
Changes are done in the files. Now we have to compile the ns2.
For this go to the ns2.34 folder in terminal, and write the commands:
make clean
make