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

[ns] ip header



Hi

 The following code  forms part of recv function in dsdv.cc
 According to the code if a node is originating a packet an IP header is
added.
 src= myaddr_ is a condition to check whether the node is originating a
packet.
 But src forms part of  the ipheader information which is not yet added.
 How is this possible.Please Clarify



  hdr_ip *iph = (hdr_ip*)p->access(off_ip_);
  hdr_cmn *cmh = (hdr_cmn *)p->access (off_cmn_);
  int src = Address::instance().get_nodeaddr(iph->saddr());
  int dst = cmh->next_hop();
  /*
   *  Must be a packet I'm originating...
   */
  if(src == myaddr_ && cmh->num_forwards() == 0) {
    /*
     * Add the IP Header
     */
    cmh->size() += IP_HDR_LEN;
    iph->ttl_ = IP_DEF_TTL;
}


Thanking you in advance
Madhan