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

[ns] New headers in ns



Hi, I'm trying to do my thesis with ns, but it isn't so easy :-)
For now, my problem is how to enable new headers in ns.
I write the following lines in xping.h:

... ...
struct hdr_xping
{
   char ret;
   double send_time;
   static int offset_;
   inline static int& offset() { return offset_; }
   inline static hdr_xping* access(const Packet* p)
   {
      return (hdr_xping*) p->access(offset_);
   }
};
... ...


and then in xping.cc

... ...
static class XPingHeaderClass : public PacketHeaderClass
{
   public:
      XPingHeaderClass() : PacketHeaderClass("PacketHeader/XPing",
sizeof(hdr_xping))
      {
         bind_offset(&hdr_xping::offset_);
      }
} class_xpinghdr;
... ...
I've also modified packet.h and ns-packet.tcl, but after compiling, the
linker give me these errors:

xping.o: In function `XPingAgent::command(int, char const *const *)':
xping.o(.text+0xac): undefined reference to `hdr_xping::offset_'
xping.o: In function `XPingAgent::recv(Packet *, Handler *)':
xping.o(.text+0x133): undefined reference to `hdr_xping::offset_'
xping.o(.text+0x1cc): undefined reference to `hdr_xping::offset_'
xping.o: In function `__static_initialization_and_destruction_0':
xping.o(.text+0x347): undefined reference to `hdr_xping::offset_'
collect2: ld returned 1 exit status
make: *** [ns] Error 1


How do I do to solve my problem?
Thanks to all,
   Max



-----------------------------
 Massimo Sotgiu
 [email protected]
 University of Udine - Italy
-----------------------------