[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ns] ARP and next_hop



Hi,

is this valid for every routing protocol? What if I use static or manual
routing? Do I need to attach a route module to every node in the simulation?

Jose Juan

-----Mensaje original-----
De: [email protected] [mailto:[email protected]]En nombre de
Stefan Rank
Enviado el: martes, 25 de septiembre de 2001 22:33
Para: [email protected]
CC: [email protected]
Asunto: Re: [ns] ARP and next_hop


Hi,

you get the next hop from the routing protocol, e.g. in /dsdv/dsdv.cc if
you're using dsdv routing
the function, which sets the next hop is:

void DSDV_Agent::forwardPacket (Packet * p)

there you can also find how to set the addr_type

Stefan

Jose Juan Iglesias wrote:
>
> Hi all ns users!
>
> I want to perform ARP to resolve the address of the next hop of a packet.
> I'm trying not to use lanrouter nor varp. Then, looking at the code of
ll.cc,
> ch->addr_type_ must be NS_AF_INET and ch->next_hop_ must contain the next
hop
> address...
>
>          nsaddr_t dst =
> (nsaddr_t)Address::instance().get_nodeaddr(ih->daddr());
>
>          ...
>
>          switch(ch->addr_type()) {
>
>          case NS_AF_ILINK:
>                  mac_->hdr_dst((char*) HDR_MAC(p), ch->next_hop());
>                  break;
>
>          case NS_AF_INET:
>                  dst = ch->next_hop();
>                  /* FALL THROUGH */
>
>          case NS_AF_NONE:
>
>                  if (IP_BROADCAST == (u_int32_t) dst)
>                  {
>                          mac_->hdr_dst((char*) HDR_MAC(p), MAC_BROADCAST);
>                          break;
>                  }
>                  /* Assuming arptable is present, send query */
>                  if (arptable_) {
>                          tx = arptable_->arpresolve(dst, p, this);
>                          break;
>                  }
>                  //if (varp_) {
>                  //tx = varp_->arpresolve(dst, p);
>                  //break;
>
>                  //}
>                  /* FALL THROUGH */
>
>          ...
>
> How can I get the next hop of a packet in C++? How can I set the field
> addr_type_ of a packet to NS_AF_INET?
>
> Thanks in advance.
> --
> =====================================================
> Jose Juan Iglesias
> =====================================================