I was implementing a protocol, just for test purposes, and it wasn't
really working. Then, after observing some other codes, I saw that some of
them had this "cmh->addr_type()= NS_AF_INET;" somewhere, so I tried to
make the same in my code. And it worked ! I didn't understand why, can
someone explain me what is this NS_AF_INET addr_type?


Here is part of my code, which sends and answers packets:

   if (hdr->type==1) {
      printf("received..(%d,%d)\n",cmh->prev_hop_,hdr->id);
      // it was a broadcast.. I need to answer it
      hdr->type=0;
      cmh->next_hop() = cmh->prev_hop_;
      cmh->prev_hop_ = myaddr;
      cmh->addr_type()= NS_AF_INET;
      cmh->direction()= hdr_cmn::DOWN;
      send(pkt,0);
      return;
   } else {
      printf("sending..[%d]\n",myaddr);
      hdr->type=1;
      cmh->next_hop() = IP_BROADCAST;
      cmh->addr_type()= NS_AF_INET;
      cmh->prev_hop_ = myaddr;
      cmh->direction()= hdr_cmn::DOWN;
      send(pkt,0);
      return;
   }





Thx, Fernando.

Reply via email to