[ns] Please help, my graduation in 2 wks depends on it! Adding
Routing Protocol For Wireless Nodes (fwd)
puneets@iitg.ernet.in
puneets@iitg.ernet.in
Fri May 3 10:40:02 2002
Try this,
Add this function to zrp.cc
ZRPAgent::command (int argc, const char*const* argv) {
return TCL_OK;
}
add the corresponding definition to zrp.h
Reason- When the first node is initialized, ns calls some functions
like "target" etc. of the routing agent. In case, "target" like functions
are not present. The names i.e. "target" are passed to command function.
Your implementation didnt contain the command function. So the error.
Hope it helps and best wishes for graduation
Puneet Sethi
BTech, IIT Guwahati
> --- pgi1 <pgi1@cornell.edu> wrote:
> >
> >
> > Sorry if this has already been answered, I couldn't
> > find any answers in
> > the list archive.
> > (I found many people asking about the same problem!)
> > (sidenote:It would be great if this was addressed in
> > the mobile
> > node chapter because there are some differences
> > regarding adding a
> > routing protocol to regular
> > node with regard to what files to change etc)
> >
> > I am using the latest ns-allinone-2.1b9 on Mandrake
> > Linux 7.2, installed
> > without a hitch.
> > I have also configured with tcl debugging on, but
> > I wasn't planning to do much debugging in that
> > langauage. I thought
> > I could plug in my protocol and make the right
> > changes in some Tcl
> > scripts for it to work.
> >
> > I have been trying to add Zone Routing Protocol
> > (ZRP), as an ad-hoc
> > protocol to the wireless
> > node architecture. Before I started adding all my
> > C++ code, I wanted to
> > first get a dummy agent
> > working as many people have tried before (many
> > without advertising their
> > success on the list
> > that I could tell). See my ZRPAgent.cc/.h below.
> >
> > But my script breaks the first time I create a node
> > and attach my
> > new ZRP agent. The entire error output is below:
> > I have also made changes to several other files. I
> > can see that each of
> > the available wireless
> > protocols have Tcl code in different places. So I
> > tried to do the
> > simplest change I could.
> >
> > Any help is appreciated, ie what to look for in the
> > Tcl debugger. You
> > can email me directly also,
> > and I can summarize my solution for the benefit of
> > the list group.
> >
> > [I did get a strange warning or something while
> > compile, see Addendum below]
> >
> > Thanks,
> > -Prashant
> >
> > Here is a list of changes to files I have made:
> >
> > 1) Makefile: added zrp.o
> >
> > 2) ns-default.tcl : added...
> > Agent/ZRP set packetSize_ 100 # I just made
> > this up
> > Agent/ZRP set sport_ 0
> > Agent/ZRP set dport_ 0
> >
> > 3) ns-lib.tcl added in 2 places, 1st is right after
> > switch, 2nd is a proc...
> > switch -exact $routingAgent_ {
> > ZRP {
> > set ragent [$self
> > create-zrp-agent $node]
> > }
> > DSDV {
> > set ragent [$self
> > create-dsdv-agent $node]
> > }
> > DSR {
> > ... etc
> >
> > Simulator instproc create-zrp-agent { node } {
> > # pgi Create ZRP routing agent
> > set ragent [new Agent/ZRP [$node id]]
> > $node set ragent_ $ragent
> > return $ragent
> > }
> >
> > 4) in ns-packet.tcl:
> > foreach prot {
> > AODV
> > ARP...
> > ZRP
> > Pushback
> > NV
> > } {
> > add-packet-header $prot
> > }
> >
> > 5) added a packet type and a line to p_info to
> > packet.h
> > enum packet_t {
> > PT_TCP,
> > ...
> > // insert new packet types here
> > PT_ZRP,
> > PT_NTYPE // This MUST be the LAST one
> > };
> >
> > class p_info {
> > public:
> > p_info() {
> > name_[PT_TCP]= "tcp";
> > name_[PT_UDP]= "udp";
> > name_[PT_CBR]= "cbr";
> > ...
> > name_[PT_ZRP]= "ZRP";
> > ...
> > }
> >
> > 5) at the end of ns-agent.tcl : added ...
> > Agent/ZRP instproc init args {
> >
> > $self next $args
> > }
> > Agent/ZRP set sport_ 0
> > Agent/ZRP set dport_ 0
> >
> > 6) I did not add anything under ./mobility. Some of
> > this code looks like
> > the "outdated" way of specifying a protocol (as
> > described in section 16.1.1
> > of the Ns manual). I assumed all the "regular" stuff
> > I need I would get done
> > by ns-lib.tcl.
> >
> > Addendum:
> > I got this at the end of my "make depend" under the
> > ns directorty:
> > emulate/net-pcap.cc:60:23: pcap/pcap.h: No such
> > file or directory
> > emulate/nat.cc:47:7: warning: extra tokens at
> > end of #endif directive
> > It doesn't seem to be an error? I can do a make and
> > there are no errors
> > there. I also get this
> > after a make, but doesn't give me an error:
> >
> >
> /ns2/ns-allinone-2.1b9/lib/libtcl8.3.a(tclUnixPipe.o):
> > In function
> > `TclpCreateTempFile':
> > tclUnixPipe.o(.text+0xf3): the use of `tmpnam'
> > is dangerous, better
> > use `mkstemp'
> >
> > Here is the implementation and output
> >
> >
> ==============================================================
> > zrp.h
> >
> ==============================================================
> > #ifndef _zrp_h_
> > #define _zrp_h_
> >
> > #include "config.h"
> > #include "agent.h"
> > #include "packet.h"
> > #include "ip.h"
> > #include "delay.h"
> > #include "scheduler.h"
> > #include "queue.h"
> > #include "trace.h"
> > #include "arp.h"
> > #include "ll.h"
> > #include "mac.h"
> > #include "priqueue.h"
> >
> >
> >
> > #if defined(WIN32) && !defined(snprintf)
> > #define snprintf _snprintf
> > #endif /* WIN32 && !snprintf */
> >
> >
> > #define ROUTER_PORT 0xff
> >
> > #define MAX_OUTBOUND_PENDING 20 // max queue for
> > pkts waiting for ierp
> > requests
> >
> > #define MAX_DETECTED_QUERIES 20 // max queries that
> > can be detected
> > #define IERP_REQUEST_TIMEOUT 30 // secs before
> > timeout on an ierp request
> > #define ZRP_STARTUP_JITTER 2.0 // secs to jitter
> > start of periodic
> > activity
> >
> > // zone radius related defines in rtable.h
> >
> > #define BEACON_PERIOD 1 // period of beacon
> > transmission in sec
> > #define NDP_SCAN_PERIOD 5
> >
> === message truncated ===
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
--
******************************************************************************
Puneet Sethi
Computer Sci & Engineering
IIT Guwahati
Email: sethi_puneet@yahoo.com
puneets@iitg.ernet.in
******************************************************************************