Hajer, thank you for your advice. I've try it and it does work. Now i
can go on to do modification on MYAODV and compare it with original
AODV.

I really appreciate your help.

And also thank for other people's info.

On 21/06/06, Mohammad Abu Zaid <[EMAIL PROTECTED]> wrote:
> Hi
> I think you have to change
>         # Special processing for MYAODV
>         set myaodvonly [string first "MYAODV" [$agent info class]]
>         if {$myaodvonly != -1 } {
>                 $agent if-queue [$self set ifq_(0)]   ;# ifq between LL and 
> MAC
>         }
On 21/06/06, Larry Zhang <[EMAIL PROTECTED]> wrote:
> Hi,
>   I can tell another way which I think is simpler to do this clone stuff,
> for your reference only.
>   You can directly change the AODV codes in the ns/aodv/ directory
> without change the name of the directory and files (of
> course you'd better backup the oringal codes first), and rebuild the codes.
>   This approach would cause less problems related to the makefile and
> ns-lib.tcl kind of things, so maybe worth a shot.
> good luck
> Larry
On 21/06/06, Pedro Vale Estrela <[EMAIL PROTECTED]> wrote:
> yes, directly hacking any protocol is fine for small localizations,
> but cloning is one way to go when you need to compare
> your routing protocol to another standard one.
> (other benefit is that I've seen __complete protocols__ hacked inside
> and interleaved with standard ones, and believe me that
> is an horrible mess.)
> Other complixier but cleaner option is to subclass the original protocol,
> but is complex when Otcl comes into the way.
> Pedro Estrela
On 21/06/06, Hajer FERJANI <[EMAIL PROTECTED]> wrote:
> Hi,
> Make sure "packet.cc" is recompiled by doing "touch packet.cc" and
> then make. Because as changes are done in .h file, the makefile does
> not see changes in .cc and in most cases, changes are not taken into
> account.
> Hope it helps.
> Ciao.
>
>
> On 6/18/06, Sylvester Yorke <[EMAIL PROTECTED]> wrote:
> >
> > Hello, NS-users:
> >
> > I want to create a routing protocol according to AODV, so my first
> > task is to clone AODV. After seeing other ns-users' posts, i do my
> > work in following steps.
> >
> >
> > First, i copy all the files in $NS\aodv\ to a new folder called
> > aodv_lsa and rename all files (i.e. from filename.cc and filename.h to
> > myfilename.cc and myfilename.h), and then i change all the names of
> > C++ classes, packet headers, variables, TCL bindings, ...
> >
> >
> > Second, i make some essential changes according to
> > http://masimum.dif.um.es/nsrt-howto/html/
> >
> >
> > $NS\common\packet.h
> > enum packet_t {
> >        PT_TCP,
> >        PT_UDP,
> >        PT_CBR,
> >        ......
> >        ......
> >        PT_AODV,
> >        PT_MYAODV,  //added by Xinhao Yu
> >        PT_IMEP,
> >        ......
> >        ......
> >        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_AODV]= "AODV";
> >                name_[PT_MYAODV]= "MYAODV";  //added by Xinhao Yu
> >                name_[PT_IMEP]= "IMEP";
> >                ......
> >                ......
> >                name_[PT_NTYPE]= "undefined";
> >        }
> >        ......
> >        ......
> > };
> >
> >
> > $NS\trace\cmu-trace.h
> > class CMUTrace : public Trace {
> >        ......
> >        ......
> >        void    format_aodv(Packet *p, int offset);
> >        void    format_myaodv(Packet *p, int offset);  //added by Xinhao Yu
> > };
> >
> >
> > $NS\trace\cmu-trace.cc
> > #include <aodv_lsa/myaodv_packet.h>  //added by Xinhao Yu
> > ......
> > ......
> > //added by Xinhao Yu
> > void
> > CMUTrace::format_myaodv(Packet *p, int offset)
> > {
> >        struct hdr_myaodv *ah = HDR_MYAODV(p);
> >        struct hdr_myaodv_request *rq = HDR_MYAODV_REQUEST(p);
> >        struct hdr_myaodv_reply *rp = HDR_MYAODV_REPLY(p);
> >
> >
> >        switch(ah->ah_type) {
> >        case MYAODVTYPE_RREQ:
> >
> >                if (pt_->tagged()) {
> >                    sprintf(pt_->buffer() + offset,
> >                            "-myaodv:t %x -myaodv:h %d -myaodv:b %d 
> > -myaodv:d %d "
> >                            "-myaodv:ds %d -myaodv:s %d -myaodv:ss %d "
> >                            "-myaodv:c REQUEST ",
> >                            rq->rq_type,
> >                            rq->rq_hop_count,
> >                            rq->rq_bcast_id,
> >                            rq->rq_dst,
> >                            rq->rq_dst_seqno,
> >                            rq->rq_src,
> >                            rq->rq_src_seqno);
> >                } else if (newtrace_) {
> >
> >                    sprintf(pt_->buffer() + offset,
> >                        "-P myaodv -Pt 0x%x -Ph %d -Pb %d -Pd %d -Pds %d -Ps 
> > %d -Pss %d -Pc
> > REQUEST ",
> >                        rq->rq_type,
> >                        rq->rq_hop_count,
> >                        rq->rq_bcast_id,
> >                        rq->rq_dst,
> >                        rq->rq_dst_seqno,
> >                        rq->rq_src,
> >                        rq->rq_src_seqno);
> >
> >
> >                } else {
> >
> >                    sprintf(pt_->buffer() + offset,
> >                        "[0x%x %d %d [%d %d] [%d %d]] (RREQ)",
> >                        rq->rq_type,
> >                        rq->rq_hop_count,
> >                        rq->rq_bcast_id,
> >                        rq->rq_dst,
> >                        rq->rq_dst_seqno,
> >                        rq->rq_src,
> >                        rq->rq_src_seqno);
> >                }
> >                break;
> >
> >        case MYAODVTYPE_RREP:
> >        case MYAODVTYPE_HELLO:
> >        case MYAODVTYPE_RERR:
> >
> >                if (pt_->tagged()) {
> >                    sprintf(pt_->buffer() + offset,
> >                            "-myaodv:t %x -myaodv:h %d -myaodv:d %d 
> > -myadov:ds %d "
> >                            "-myaodv:l %f -myaodv:c %s ",
> >                            rp->rp_type,
> >                            rp->rp_hop_count,
> >                            rp->rp_dst,
> >                            rp->rp_dst_seqno,
> >                            rp->rp_lifetime,
> >                            rp->rp_type == MYAODVTYPE_RREP ? "REPLY" :
> >                            (rp->rp_type == MYAODVTYPE_RERR ? "ERROR" :
> >                             "HELLO"));
> >                } else if (newtrace_) {
> >
> >                        sprintf(pt_->buffer() + offset,
> >                            "-P myaodv -Pt 0x%x -Ph %d -Pd %d -Pds %d -Pl %f 
> > -Pc %s ",
> >                                rp->rp_type,
> >                                rp->rp_hop_count,
> >                                rp->rp_dst,
> >                                rp->rp_dst_seqno,
> >                                rp->rp_lifetime,
> >                                rp->rp_type == MYAODVTYPE_RREP ? "REPLY" :
> >                                (rp->rp_type == MYAODVTYPE_RERR ? "ERROR" :
> >                                 "HELLO"));
> >                } else {
> >
> >                        sprintf(pt_->buffer() + offset,
> >                                "[0x%x %d [%d %d] %f] (%s)",
> >                                rp->rp_type,
> >                                rp->rp_hop_count,
> >                                rp->rp_dst,
> >                                rp->rp_dst_seqno,
> >                                rp->rp_lifetime,
> >                                rp->rp_type == MYAODVTYPE_RREP ? "RREP" :
> >                                (rp->rp_type == MYAODVTYPE_RERR ? "ERROR" :
> >                                 "HELLO"));
> >                }
> >                break;
> >
> >        default:
> > #ifdef WIN32
> >                fprintf(stderr,
> >                        "CMUTrace::format_myaodv: invalid MYAODV packet 
> > type\n");
> > #else
> >                fprintf(stderr,
> >                        "%s: invalid MYAODV packet type\n", __FUNCTION__);
> > #endif
> >                abort();
> >        }
> > }
> > ......
> > ......
> > //added by Xinhao Yu
> > void CMUTrace::format(Packet* p, const char *why)
> > {
> >        ......
> >        ......
> >        default:
> >        ......
> >        ......
> >                case PT_AODV:
> >                        format_aodv(p, offset);
> >                        break;
> >                case PT_MYAODV:
> >                        format_myaodv(p, offset);
> >                        break;
> >        ......
> >        ......
> > }
> >
> >
> > $NS\tcl\lib\ns-packet.tcl
> > foreach prot {
> >        AODV
> >        MYAODV  ;#added by Xinhao Yu
> >        ......
> >        ......
> > }
> >
> >
> > $NS\tcl\lib\ns-lib.tcl
> > Simulator instproc create-wireless-node args {
> >        ......
> >        ......
> >        switch -exact $routingAgent_ {
> >            ......
> >            ......
> >            AODV {
> >                    set ragent [$self create-aodv-agent $node]
> >            }
> >            MYAODV {
> >                    set ragent [$self create-myaodv-agent $node]  ;#added by 
> > Xinhao Yu
> >            }
> >            ......
> >            ......
> >        }
> >        ......
> >        ......
> > }
> > ......
> > ......
> > # added by Xinhao Yu
> > Simulator instproc create-myaodv-agent { node } {
> >        #  Create MYAODV routing agent
> >        set ragent [new Agent/MYAODV [$node node-addr]]
> >        $self at 0.0 "$ragent start"     ;# start BEACON/HELLO Messages
> >        $node set ragent_ $ragent
> >        return $ragent
> > }
> >
> >
> > $NS\queue\priqueue.cc
> > //added by Xinhao Yu
> > void
> > PriQueue::recv(Packet *p, Handler *h)
> > {
> >                ......
> >                ......
> >                case PT_AODV:
> >                case PT_MYAODV:
> >                ......
> >                ......
> > }
> >
> >
> > $NS\Makefile
> > OBJ_CC = \
> >        ......
> >        ......
> >        aodv/aodv_logs.o aodv/aodv.o \
> >        aodv/aodv_rtable.o aodv/aodv_rqueue.o \
> >        aodv_lsa/myaodv_logs.o aodv_lsa/myaodv.o \
> >        aodv_lsa/myaodv_rtable.o aodv_lsa/myaodv_rqueue.o \
> >        ......
> >        ......
> >        $(OBJ_STL)
> >
> >
> > To be safe, i also modify $NS\tcl\lib\ns-agent.tcl and
> > $NS\tcl\lib\ns-mobilenode.tcl
> >
> > $NS\tcl\lib\ns-agent.tcl
> > Agent/AODV instproc init args {
> >
> >         $self next $args
> > }
> >
> > Agent/AODV set sport_   0
> > Agent/AODV set dport_   0
> >
> > # added by Xinhao Yu
> > Agent/MYAODV instproc init args {
> >
> >         $self next $args
> > }
> >
> > Agent/MYAODV set sport_   0
> > Agent/MYAODV set dport_   0
> >
> >
> > $NS\tcl\lib\ns-mobilenode.tcl
> > Node/MobileNode instproc add-target { agent port } {
> >        ......
> >        ......
> >        # Special processing for AODV
> >        set aodvonly [string first "AODV" [$agent info class]]
> >        if {$aodvonly != -1 } {
> >                $agent if-queue [$self set ifq_(0)]   ;# ifq between LL and 
> > MAC
> >        }
> >        # added by Xinhao Yu
> >        # Special processing for MYAODV
> >        set aodvonly [string first "MYAODV" [$agent info class]]
> >        if {$aodvonly != -1 } {
> >                $agent if-queue [$self set ifq_(0)]   ;# ifq between LL and 
> > MAC
> >        }
> >        ......
> >        ......
> > }
> >
> >
> > Third, i compile ns again.
> > After 'make depend', there is no error. Then 'make' and everything is ok.
> > Then i use a simple tcl script to test my new ns model. I replace AODV
> > with MYAODV.
> >
> > set val(rp)             MYAODV                       ;# Routing: MYAODV
> >
> > Tcl script runs fine. I get a trace file. Following is a part of it.
> >
> > r 10.000000000 _0_ RTR  --- 0 cbr 500 [0 0 0 0] ------- [0:0 6:0 32 0] [0] 
> > 0 0
> > s 10.000000000 _0_ RTR  --- 0 IMEP 48 [0 0 0 0] ------- [0:255 -1:255
> > 30 0] [0x2 1 1 [6 0] [0 4]] (RREQ)
> > r 10.001360033 _2_ RTR  --- 0 IMEP 48 [0 ffffffff 0 800] -------
> > [0:255 -1:255 30 0] [0x2 1 1 [6 0] [0 4]] (RREQ)
> > r 10.001360033 _1_ RTR  --- 0 IMEP 48 [0 ffffffff 0 800] -------
> > [0:255 -1:255 30 0] [0x2 1 1 [6 0] [0 4]] (RREQ)
> > s 10.001502080 _2_ RTR  --- 0 IMEP 48 [0 ffffffff 0 800] -------
> > [2:255 -1:255 29 0] [0x2 2 1 [6 0] [0 4]] (RREQ)
> > s 10.002241260 _1_ RTR  --- 0 IMEP 48 [0 ffffffff 0 800] -------
> > [1:255 -1:255 29 0] [0x2 2 1 [6 0] [0 4]] (RREQ)
> > r 10.002722107 _3_ RTR  --- 0 IMEP 48 [0 ffffffff 2 800] -------
> > [2:255 -1:255 29 0] [0x2 2 1 [6 0] [0 4]] (RREQ)
> > r 10.002722113 _0_ RTR  --- 0 IMEP 48 [0 ffffffff 2 800] -------
> > [2:255 -1:255 29 0] [0x2 2 1 [6 0] [0 4]] (RREQ)
> > r 10.003936160 _0_ RTR  --- 0 IMEP 48 [0 ffffffff 1 800] -------
> > [1:255 -1:255 29 0] [0x2 2 1 [6 0] [0 4]] (RREQ)
> > r 10.003936177 _7_ RTR  --- 0 IMEP 48 [0 ffffffff 1 800] -------
> > [1:255 -1:255 29 0] [0x2 2 1 [6 0] [0 4]] (RREQ)
> > s 10.010324829 _7_ RTR  --- 0 IMEP 48 [0 ffffffff 1 800] -------
> > [7:255 -1:255 28 0] [0x2 3 1 [6 0] [0 4]] (RREQ)
> > s 10.010886867 _3_ RTR  --- 0 IMEP 48 [0 ffffffff 2 800] -------
> > [3:255 -1:255 28 0] [0x2 3 1 [6 0] [0 4]] (RREQ)
> > r 10.011484852 _6_ RTR  --- 0 IMEP 48 [0 ffffffff 7 800] -------
> > [7:255 -1:255 28 0] [0x2 3 1 [6 0] [0 4]] (RREQ)
> > s 10.011484852 _6_ RTR  --- 0 IMEP 44 [0 0 0 0] ------- [6:255 0:255
> > 30 7] [0x4 1 [6 4] 10.000000] (RREP)
> > r 10.012026894 _2_ RTR  --- 0 IMEP 48 [0 ffffffff 3 800] -------
> > [3:255 -1:255 28 0] [0x2 3 1 [6 0] [0 4]] (RREQ)
> > r 10.016279017 _7_ RTR  --- 0 IMEP 44 [13a 7 6 800] ------- [6:255
> > 0:255 30 7] [0x4 1 [6 4] 10.000000] (RREP)
> > f 10.016279017 _7_ RTR  --- 0 IMEP 44 [13a 7 6 800] ------- [6:255
> > 0:255 29 1] [0x4 2 [6 4] 10.000000] (RREP)
> >
> > But i see that the 7th column packet type in the trace file is IMEP
> > not MYAODV. Could anyone explain to me what's the matter?
> >
> > Thank you in advance.
> >
> > --
> >
> > Best Regards,
> >
> > Xinhao Yu
> >
> >
>


-- 
Best Regards

Xinhao Yu

Reply via email to