Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-18-2012, 02:24 AM   #1
LQ Newbie
Registered: Mar 2012
Posts: 2

Rep: Reputation: Disabled

can u please explain me the function recv() in file--
the code is as follows--
AODV::recv(Packet *p, Handler*) {
struct hdr_cmn *ch = HDR_CMN(p);
struct hdr_ip *ih = HDR_IP(p);

//assert(p->incoming == 0);
// XXXXX NOTE: use of incoming flag has been depracated; In order to track direction of pkt flow, direction_ in hdr_cmn is used instead. see packet.h for details.

if(ch->ptype() == PT_AODV) {
ih->ttl_ -= 1;

* Must be a packet I'm originating...
if((ih->saddr() == index) && (ch->num_forwards() == 0)) {
* Add the IP Header.
* TCP adds the IP header too, so to avoid setting it twice, we check if
* this packet is not a TCP or ACK segment.
if (ch->ptype() != PT_TCP && ch->ptype() != PT_ACK) {
ch->size() += IP_HDR_LEN;
// Added by Parag Dadhania && John Novatnack to handle broadcasting
if ( (u_int32_t)ih->daddr() != IP_BROADCAST) {
* I received a packet that I sent. Probably
* a routing loop.
else if(ih->saddr() == index) {
* Packet I'm forwarding...
else {
* Check the TTL. If it is zero, then discard.
if(--ih->ttl_ == 0) {
drop(p, DROP_RTR_TTL);
if ( (u_int32_t)ih->daddr() != IP_BROADCAST)
forward((aodv_rt_entry*) 0, p, NO_DELAY);
please give detailed explanation.
please reply soon
Old 03-18-2012, 04:22 PM   #2
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,815

Rep: Reputation: 6317Reputation: 6317Reputation: 6317Reputation: 6317Reputation: 6317Reputation: 6317Reputation: 6317Reputation: 6317Reputation: 6317Reputation: 6317Reputation: 6317
Originally Posted by snehsrivastava View Post
can u please explain me the function recv() in file--
the code is as follows--

please give detailed explanation.
please reply soon
Spell out your words. And don't tell us to hurry up and answer you...we volunteer our time here.

The code is fairly clear and commented. What part of it isn't working? What error(s) are you getting?? Or is this a school project, and you want us to give you the answers?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
aodv protocol snehsrivastava Linux - Newbie 1 03-16-2012 08:30 AM
help me regarding aodv implementation ! Shruti Linux - Newbie 21 03-12-2012 08:05 AM
implementation of aodv+ in ns-2.33 rashween Linux - Networking 0 07-07-2011 12:23 AM
where to edit in AODV naren123.k Programming 2 04-11-2011 06:42 AM
AODV in eclipse tassadaque Programming 0 08-26-2008 03:21 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration