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

[ns] [router ID]




Hi, ns-experts:

Assumming I create three nodes 

	0 ----- 1------ 2

and I can identify the nodes as the number (0, 1, 2). It seems to me
thatthe node ID is the number (0, 1, 2 ) , like IP address.

Now when I send packet from node 0 to node 2, I can see the sourc and
destination addr as following

  hdr_ip *hdrip=hdr_ip::access(pkt) //pkt is the incoming packet

  the source IP address:
   hdrip->src_.addr_

  and the dst addr:
   hdrip->dst_.addr_

Now If I create a monitor fuction in the middle router (node 2), I will
send out a monitor packet (itrace packet) from node 2 to destination node
3.
Therefore I need to set the src and dst addresses as following:

  Packet * pkt =allocpkt();
  hdr_ip * hip=hdr_ip::access(pkt);
  ns_addr_t here_; //router ID?

  hip->dst_.addr_=hdrip->dst_.addr_; // copy the dst addr from the
                                     //   incoming  packet.

  hip->src_.addr_=here_.addr_; // I respect the hip-src_.addr_
                               // should be 2 (node 2),
                               // However, I get the addr is not 2
                               // its format like :
                               // the nodeID =138711728

So, How can I get the router ID as "2" , if I send the monitor packet from
node 2?

Can anybody help?

Thanks,


Chien-Lung Wu 



****************************************************************************
Chien-Lung Wu						[email protected]
Graduate Student of ECE 				(O) 919-513-1894
at North Carolina State University			(H) 919-233-6724
****************************************************************************