Amar, Correction on Line #6,
6. In case you like to know if a destination node received a packet, you can do so by comparing a packet's destination ip address with the node_id of a node receiving the packet ***at MAC layer*** rgds Saravanan K On Thu, Feb 7, 2013 at 2:19 PM, Saravanan Kandasamy <svana...@gmail.com> wrote: > Dear Amar, > > I think you have confused with between mac::recv() and aodv::recv() > > 1. mac::recv() able to listen every packet in a channel as long as it > is above CSThresh and decode a packet if it is above RXThresh. > > 2.This is not the same for aodv::recv(), you would need to understand, how > a)AODV protocol works and the components of AODV Table built at nodes > b)wireless mobile node schematic in the NS2 manual. > > 3.Not every packet received by mac::recv() is sent upstack to > aodv::recv(), only those need to be forwarded will be sent to > aodv::recv(). Thus the final destination node would not go through > aodv:recv but the data packet received by mac:recv will be directly > sent to AGT via LL using uptarget_ > > 4.If you yet to understand this, let me illustrate this in a small > scenario. We have 3 nodes (N3, N4 and N5) arranged in series. N5 sends > one packet to N3. > > You will see something as below, > > Node: _5 _ recvd data packet at time: 11.500000000, PacketType: 61, UID: 4 > Node: _4 _ recvd data packet at time: 11.501782848, PacketType: 61, UID: 4 > > if you invoke the below at aodv::recv(), > > if(DATA_PACKET(ch->ptype())) {fprintf(stdout,"\nNode: _%i _ recvd data > packet at time: %.9lf, PacketType: %i, UID: %i", index, CURRENT_TIME, > ch->ptype(), ch->uid());} > > You will see the destination node, i.e N3 is missing. > > 5. Do compare this with your trace file results, > > Line#01 - s 11.500000000 _5_ AGT --- 4 Poisson 1500 [0 0 0 0 Y Y] > ------- [5:1 3:1 32 0 0] > Line#02 - r 11.500000000 _5_ RTR --- 4 Poisson 1500 [0 0 0 0 Y Y] > ------- [5:1 3:1 32 0 0] > Line#03 - s 11.500000000 _5_ RTR --- 4 Poisson 1520 [0 0 0 0 Y Y] > ------- [5:1 3:1 30 2 4] > Line#04 - s 11.500435000 _5_ MAC --- 4 Poisson 1578 [13a 4 5 800 Y Y] > ------- [5:1 3:1 30 2 4] > Line#05 - r 11.501757848 _4_ MAC --- 4 Poisson 1520 [13a 4 5 800 Y Y] > ------- [5:1 3:1 30 2 4] > Line#06 - s 11.501767848 _4_ MAC --- 0 ACK 38 [0 5 4 0 Y Y] > Line#07 - r 11.501782848 _4_ RTR --- 4 Poisson 1520 [13a 4 5 800 Y Y] > ------- [5:1 3:1 30 2 4] > Line#08 - f 11.501782848 _4_ RTR --- 4 Poisson 1520 [13a 4 5 800 Y Y] > ------- [5:1 3:1 29 1 3] > Line#09 - r 11.502072515 _5_ MAC --- 0 ACK 38 [0 5 4 0 Y Y] > Line#10 - s 11.502481848 _4_ MAC --- 4 Poisson 1578 [13a 3 4 800 Y Y] > ------- [5:1 3:1 29 1 3] > Line#11 - r 11.503804697 _3_ MAC --- 4 Poisson 1520 [13a 3 4 800 Y Y] > ------- [5:1 3:1 29 1 3] > Line#12 - s 11.503814697 _3_ MAC --- 0 ACK 38 [0 4 3 0 Y Y] > Line#13 - r 11.503829697 _3_ AGT --- 4 Poisson 1520 [13a 3 4 800 Y Y] > ------- [5:1 3:1 29 1 3] > Line#14 - r 11.504119364 _4_ MAC --- 0 ACK 38 [0 4 3 0 Y Y] > > You will see RTR (i.e AODV) is received only by the source node and > the intermediary nodes (where forward event need to be executed) > except the destination node. > > 6. In case you like to know if a destination node received a packet, > you can do so by comparing a packet's destination ip address with > the node_id of a node receiving the packet > > Good Luck. > > rgds > Saravanan K > > On Wed, Feb 6, 2013 at 3:51 PM, AmarNath Patra <amarnath.pa...@gmail.com> > wrote: >> >> Hello Everyone, >> >> If I add the following statement in the beginning of the code in the >> function, AODV::recv(Packet *p, Handler*), in aodv.cc : >> >> if(DATA_PACKET(ch->ptype())) { printf("\nNode: _%i _ recvd data packet at >> time: %.4lf", index, CURRENT_TIME); } >> >> Then it prints for all active nodes except for the destination. Why is it >> happening? >> If not in this function/file, then where can I check whether the >> destination received a data packet? >> >> I just tried to implement the NULL agent's recv function in c++ source >> code, and added the above statement in it. >> Here the print function gets executed for the case of destination node. Is >> this correct? >> >> Can't I recognize the/a destination node in the aodv,cc file itself? >> >> -amar