Jose Campos wrote On Fri Nov 21 03:40:02 2003 > Hi, I'm a new user of NS and in order to start with > the simulator, I have > been doing the examples which appeared in Marc Greis's > Tutorial. I have > tried to do one on my own, so I have copied the files > ping.h, ping.cc and > ping.tcl; but instead of putting the same name 'ping' > I have changed it by > 'prueba' and I have modified all the files indicated > in the tutorial. When > I've tried to compile two errors have ocurred. The > first one is that the > variable off_ip_ is not declared; I think that it > could be because it is not > declared in file 'ip.h' as off_ip_, but as offset_. > However, I've changed > it and the message is the same. The second error is > derived from the first > one because, as the program can't access to ip > header, it can't manage the > command 'hdrip->src_ >> > Address::instance().NodeShift[1]'. Thanks in > advance. Jose.
Such an old problem from Marc Greis' Tutorial For NS. I ran into it today, do some search on the web, and then so surprised to find that this annoying old problem, perhaps derived form version incompatiblity, is still left unanswerd for FIVE years...--! So I try to fix it by myself, hoping that may also help others. the error "off_ip_ was not declared in this scope" is simply because the variable really doesn't exist. To solve it, define it in the header file, just under the definition of off_ping_. And add "off_ip_ = hdr_ip::offset();" before using it in statement: " hdr_ip* hdrip = (hdr_ip*)pkt->access(off_ip_);". another error lies in the command : "hdrip->src_ >> Address::instance().NodeShift[1]" compiler complains about the operator ">>" i guess this usage is obsolete. To make the compiler work, comment this command out and replace it with "(hdrip->src_).addr_," Well, that should be all, except one embarrassing problem, another protocol PT_PING is already implemented in newer version of NS, so ... to get over the confliction, some modification in class name and struct name will be necessary. -- Regards NarcissusHuang -- Regards NarcissusHuang
