Wednesday 11 February 2015

how to clone protocol in ns2

How to clone a protocol in ns2.35(AODV)

Step 1: Copy the file of aodv in the different folder name as taodv.

Step 2: Rename all the file names and inside document.

step 3: Replace aodv to taodv and AODV to TAODV.


Step 4: Go to #ns-allinone-2.35\ns-2.35\common\packet.h

typedef unsigned int packet_t;

static const packet_t PT_TCP = 0;
static const packet_t PT_UDP = 1;
static const packet_t PT_CBR = 2;
......
......
......
......
        // insert new packet types here
static const packet_t PT_TAODV = 73;  //newly added packet
static packet_t       PT_NTYPE = 74; // This MUST be the LAST one





class p_info {
public:
    p_info()
    {
        initName();
    }
    const char* name(packet_t p) const {
        if ( p <= p_info::nPkt_ ) return name_[p];
        return 0;
    }
........
........
........

static packetClass classify(packet_t type) {       
        if (type == PT_DSR ||
            type == PT_MESSAGE ||
            type == PT_TORA ||
            type == PT_PUMA ||
            type == PT_AODV ||
            type == PT_TAODV ||
            type == PT_MDART)
            return ROUTING;   
...........
..........
........
........

name_[PT_DCCP]="DCCP";
        name_[PT_DCCP_REQ]="DCCP_Request";
        name_[PT_DCCP_RESP]="DCCP_Response";
        name_[PT_DCCP_ACK]="DCCP_Ack";
        name_[PT_DCCP_DATA]="DCCP_Data";
        name_[PT_DCCP_DATAACK]="DCCP_DataAck";
        name_[PT_DCCP_CLOSE]="DCCP_Close";
        name_[PT_DCCP_CLOSEREQ]="DCCP_CloseReq";
        name_[PT_DCCP_RESET]="DCCP_Reset";
        name_[PT_TAODV]= "TAODV";
        name_[PT_NTYPE]= "undefined";


}

Step 5: #ns-allinone-2.35\ns-2.35\trace\cmu-trace.h

class CMUTrace : public Trace {
public:
    CMUTrace(const char *s, char t);
    void    recv(Packet *p, Handler *h);
    void    recv(Packet *p, const char* why);

    static void addPacketTracer(PacketTracer *pt);

..........
.........
..........
..........

void    format_imep(Packet *p, int offset);
        void    format_aodv(Packet *p, int offset);
        void    format_taodv(Packet *p, int offset);
    void    format_aomdv(Packet *p, int offset);
    void    format_mdart(Packet *p, int offset);
}


Step 6: #ns-allinone-2.35\ns-2.35\trace\cmu-trace.cc
#include <taodv/taodv_packet.h>

//Newly added
void
CMUTrace::format_taodv(Packet *p, int offset)
    {
      struct hdr_taodv *ah = HDR_TAODV(p);
      struct hdr_taodv_request *rq = HDR_TAODV_REQUEST(p);
      struct hdr_taodv_reply *rp = HDR_TAODV_REPLY(p);


      switch(ah->ah_type) {
      case TAODVTYPE_RREQ:

                if (pt_->tagged()) {
                    sprintf(pt_->buffer() + offset,
                            "- taodv:t %x - taodv:h %d - taodv:b %d -taodv:d %d "
                            "- taodv:ds %d - taodv:s %d - taodv:ss %d "
                            "- taodv: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  taodv -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 TAODVTYPE_RREP:
        case TAODVTYPE_HELLO:
        case TAODVTYPE_RERR:

                if (pt_->tagged()) {
                    sprintf(pt_->buffer() + offset,
                            "- taodv:t %x - taodv:h %d - taodv:d %d -tadov:ds %d "
                            "- taodv:l %f - taodv:c %s ",
                            rp->rp_type,
                            rp->rp_hop_count,
                            rp->rp_dst,
                            rp->rp_dst_seqno,
                            rp->rp_lifetime,
                            rp->rp_type == TAODVTYPE_RREP ? "REPLY" :
                            (rp->rp_type == TAODVTYPE_RERR ? "ERROR" :
                             "HELLO"));
                } else if (newtrace_) {

                        sprintf(pt_->buffer() + offset,
                           "-P  taodv -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 == TAODVTYPE_RREP ?"REPLY" :
                                 (rp->rp_type == TAODVTYPE_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 == TAODVTYPE_RREP ? "RREP":
                                (rp->rp_type == TAODVTYPE_RERR ?"ERROR" :
                                  "HELLO"));
                }
                break;

        default:
          #ifdef WIN32
          fprintf(stderr,"CMUTrace::format_ taodv: invalid TAODV packet type\n");
          #else
              fprintf(stderr,"%s: invalid TAODV packet type\n",__FUNCTION__);
        #endif
                abort();
        }
 }
 
...... ......
 //Newly added
 void CMUTrace::format(Packet* p, const char *why)
  {
         ......
        ......
        default:
        ......
        ......
                case PT_AODV:
            format_aodv(p, offset);
                        break;
                case PT_TAODV:                //Newly added
                        format_taodv(p, offset);

                        break;
             break;
        ......
        ......
 }

Step 7: #ns-allinone-2.35\ns-2.35\tcl\lib\ns-packet.tcl



set protolist {
# Common:
    Common
    Flags
    IP     # IP
.......
.......
.......
# Mobility, Ad-Hoc Networks, Sensor Nets:
    AODV     # routing protocol for ad-hoc networks
    TAODV     # routing protocol for ad-hoc networks
.........
........
.........

}

Step 8: #ns-allinone-2.35\ns-2.35\tcl\lib\ns-lib.tcl
Simulator instproc create-wireless-node args {
         ......
        ......
        switch -exact $routingAgent_ {
            ......
            ......
            AODV {
                    set ragent [$self create-aodv-agent $node]
            }
           TAODV {
           set ragent [$self create-taodv-agent $node]            

        }
                
......
                 ......
             }
             ......
             ......
      }
      ......
      ......
      # Newly added
      Simulator instproc create-taodv-agent { node } {
             #  Create TAODV routing agent
             set ragent [new Agent/TAODV [$node node-addr]]
             $self at 0.0 "$ragent start"    ;# start BEACON/HELLO messages
             $node set ragent_ $ragent
             return $ragent
      }


Step 9: #ns-allinone-2.35\ns-2.35\queue\priqueue.cc

//Newly added
      void
      PriQueue::recv(Packet *p, Handler *h)
      {
                     ......
                     ......
                     case PT_AODV:
                     case PT_TAODV:                //Newly added
                     ......
                     ......
      }

Step 10: #ns-allinone-2.35\ns-2.35\Makefile

OBJ_CC = \
             ......
             ......
             aodv/aodv_logs.o aodv/aodv.o \
             aodv/aodv_rtable.o aodv/aodv_rqueue.o \
             taodv/taodv_logs.o taodv/taodv.o \
             taodv/taodv_rtable.o taodv/taodv_rqueue.o \

             ......
             ......
             $(OBJ_STL)
    
    
   *** Make sure you are making the same changes in makefile.vc and Makefile.in otherwise after ./configure
    it will not take into account and object file will not generate.


Step 11: #ns-allinone-2.35\ns-2.35\tcl\lib\ns-agent.tcl
      Agent/AODV instproc init args {
    
              $self next $args
      }
    
      Agent/AODV set sport_   0
      Agent/AODV set dport_   0
    
      # Newly added
      Agent/TAODV instproc init args {
    
              $self next $args
      }
    
      Agent/TAODV set sport_   0
      Agent/TAODV set dport_   0


Step 12: #ns-allinone-2.35\ns-2.35\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
             }
             # Newly added
             # Special processing for TAODV
             set taodvonly [string first "TAODV" [$agent info class]]
             if {$taodvonly != -1 } {
        $agent if-queue [$self set ifq_(0)]   ;# ifq between LL and MAC
             }
            
......
             ......
      }

Step 13: #ns-allinone-2.35\ns-2.35\queue\rtqueue.cc
 
      Do not make any changes just go through the Packet Queue used by AODV.

Step 14: #ns-allinone-2.35\ns-2.35\routing\rtable.h

    class Neighbor {
        friend class AODV;
    friend class TAODV;    //Newly added
        friend class rt_entry;
        ......
        ......
        }
       
        class rt_entry {
        friend class rttable;
        friend class AODV;
    friend class TAODV;    //Newly added
    friend class TAODVLocalRepairTimer; //modified
    .....
    .....
    .....
    }
 Step 15: #ns-allinone-2.35\ns-2.35\wpan\p802_15_4nam.cc

    packet_t nam_pktName2Type(const char *name)
    {
        //not all types included

        return (strcmp(packet_info.name(PT_TCP),name) == 0)?PT_TCP:
        ......
        ......
        ......
        (strcmp(packet_info.name(PT_AODV),name) == 0)?PT_AODV:
       (strcmp(packet_info.name(PT_TAODV),name) == 0)?PT_TAODV:
       
      }

Step 16: #ns-allinone-2.35\dei80211mr-1.1.4\src\InitTCL.cc

PacketHeaderManager set tab_(PacketHeader/SR) 1\n\
PacketHeaderManager set tab_(PacketHeader/AODV) 1\n\
PacketHeaderManager set tab_(PacketHeader/TAODV) 1\n\  

Step 17: Rename every aodv file with taodv name inside taodv folder

Step 18: Open each and every file and rename aodv to taodv and AODV to TAODV
Step 19: Rename every timer class in taodv.h and taodv.cc

 E.g. In taodv.h

class TAODVBroadcastTimer : public Handler {
public:
    TAODVBroadcastTimer(TAODV* a) : agent(a) {}
        void    handle(Event*);
private:
        TAODV    *agent;
        Event   intr;
};

.......
......
.....





....
.....
.....
class TAODV: public Tap,public Agent {


....
.....
friend class TAODVBroadcastTimer;
......
......

TAODVBroadcastTimer  btimer;
.....
......




}


 *note rename every timer otherwise it will give an error

E.G.
In taodv.cc


void TAODVHelloTimer::handle(Event* p) {


    agent->sendHello();
    double interval = MinHelloInterval +
    ((MaxHelloInterval - MinHelloInterval) * Random::uniform());
    assert(interval >= 0);
    Scheduler::instance().schedule(this, &intr, interval);


}
*note rename every timer otherwise it will give an error

Step 20: Edit taodv_rtable.h

class taodv_rt_entry {
        friend class taodv_rtable;
        friend class TAODV;
        friend class LocalRepairTimer;
        friend class TAODVLocalRepairTimer; 

 ......
 ......
......


}
 

Step 21: Recompilation:
Step 1: We should recompiled ``packet.cc`` as the ``packet.h'' is modified.
        this can be done by  : ``touch common/packet.cc''
Step 2: ./configure (if this fails go to step 22)
Step 3: make clean
Step 4: make
Step 5: make install

Step 22: If ./configure fails then run ./install

 $cd ns-allinone-2.35
 $./install
 $cd ns-allinone-2.35/ns-2.35
 $sudo make install

You are now done with complete cloning of aodv routing protocol!

74 comments:

  1. Recompilation steps are not working in my case

    ReplyDelete
    Replies
    1. Make sure you have followed the steps exactly as it is.
      if compilation fails at step 21
      go to step 22

      Delete
    2. Actually I don't have folder named ns-allinone-2.35, I have folder named ns-2.35. I am not able to run ./install command , I had checked that ./install exe is present in the ns-2.35 folder, also I had navigated to that folder (ns-2.35) before executing command through command prompt in ubuntu

      Delete
  2. Getting this error while running tcl file with my new protocol

    num_nodes is set 100

    (_o14 cmd line 1)
    invoked from within
    "_o14 cmd addr"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o14" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o14 addr"
    ("eval" body line 1)
    invoked from within
    "eval $node addr $args"
    ("default" arm line 2)
    invoked from within
    "switch -exact $routingAgent_ {
    DSDV {
    set ragent [$self create-dsdv-agent $node]
    }
    DSR {
    $self at 0.0 "$node start-dsr"
    }
    AODV {
    set ragent [$self cre..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
    "_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
    "eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
    "$ns_ node"
    ("for" body line 2)
    invoked from within
    "for {set i 0} {$i < $val(nn)} {incr i} {
    set node_($i) [$ns_ node]
    $node_($i) random-motion 0 ;# disable random motion
    }"
    (file "vanetiaodv.tcl" line 59)
    shyju@ubuntu:~/SHYJU/ns-allinone-2.35/ns-2.35/sumo$

    ReplyDelete
    Replies
    1. i am also getting the same proble.Did you find any solution for thsi problem??

      Delete
    2. It works for me fine... i have been seeing this error for long time and i fixed it.
      1. Things that should get focused is step 10. most of the time if ur ns2 installation is wrong u wouldn't get the right makefile. So be serious on the installation first than the paths... finally u will get the right makefile as well as the other files on their directory. then everything will be fine.
      finally if it is not working till now. try dual installation of Ubuntu.
      i was seeing the above error when i was on vmware.
      good luck!

      Delete
    3. I am also getting the same error. If the object file of the cloned protocol are getting created successfully, Can we then consider that the steps were followed correctly or the makefile is ok? or is it possible that the makefile is incorrect but it still created object files of cloned protocol.

      Delete
  3. Check your steps once again
    For more clarification check out my video tutorial on YouTube.

    ReplyDelete
  4. I m also getting the same error while running from TAODV
    At compilation time it is showing no error. but while calling from tcl script shows the error.
    I ve watched your video .

    ReplyDelete
  5. num_nodes is set 22

    (_o14 cmd line 1)
    invoked from within
    "_o14 cmd addr"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o14" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o14 addr"
    ("eval" body line 1)
    invoked from within
    "eval $node addr $args"
    ("default" arm line 2)
    invoked from within
    "switch -exact $routingAgent_ {
    DSDV {
    set ragent [$self create-dsdv-agent $node]
    }
    DSR {
    $self at 0.0 "$node start-dsr"
    }
    AODV {
    set ragent [$self cre..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
    "_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
    "eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
    "$ns_ node"
    invoked from within
    "set Server1 [$ns_ node]"
    (file "example3.tcl" line 79)

    ReplyDelete
    Replies
    1. i am also getting the same problem.Did you solved this problem ??

      Delete
    2. same problem, kindly let me know about the solution if you have.

      Delete
    3. i am also getting the same problem. help me pleaze

      Delete
    4. i am also getting the same problem. please help me

      Delete
  6. After completing all the steps when i run my code m getting lines sayng [code omitted because of length ] invalid command name "agent /TAODV"
    while executing "agent/TAODV indtproc init args{
    $self next $args
    }
    Whats the problem

    ReplyDelete
  7. sir can i use this procedure for WFRP

    ReplyDelete
  8. i did the same thing as you did but i get segmentation error (core dumped) every time i try my colned protocol help !

    ReplyDelete
    Replies
    1. I have made video tutorial for this on YouTube. Refer that video and make sure you have followed all the steps exactly as it is.

      Delete
    2. i have followed each and every step from the video and this blog, i am still getting the same segmentation error. as i run my ns taodv.tcl file, at the end it shows this error.

      Delete
  9. I need to clone DSR. There are differences at some steps. Please help

    ReplyDelete
    Replies
    1. You can take this as reference for cloning DSR. Try match this procedure for DSR protocol.

      Delete
    2. I try to do the same steps to clone DSR to LDSR. I got the following error message after I made ./install

      trace/cmu-trace.cc: In member function ‘void CMUTrace::format_ldsr(Packet*, int)’:
      trace/cmu-trace.cc:595:2: error: ‘lhdr_sr’ was not declared in this scope
      trace/cmu-trace.cc:595:11: error: ‘srh’ was not declared in this scope
      trace/cmu-trace.cc:595:17: error: ‘lhdr_sr’ is not a class or namespace
      make: *** [trace/cmu-trace.o] Error 1
      Ns make failed!
      ------------------------------------------------------------
      At step 7 the DSR is not included at the # Mobility, Ad-Hoc Networks, Sensor Nets so I confused.
      Some steps I couldn't make them for DSR. Step11, Step 12, Step 14, Step 16 and Step 20

      Delete
    3. i also want do the same have you done this ...
      appreciate if you help . Thanks in advance .

      Delete
    4. i tried the same procedure for DSR , but as i found that DSR is an optional case.there is more changes needed(tried that also but ..) . Help ..

      Delete
  10. Following error I got when try to change aodv to ieerp

    trace/cmu-trace.cc:54:40: fatal error: ieerp/ieerp_packet.h: No such file or directory
    #include //IEERP
    ^
    compilation terminated.
    make: *** [trace/cmu-trace.o] Error 1
    kindly help me out..

    ReplyDelete
  11. I have recompiled the new protocol in ns2, but it works only for old protocol.I don't know how to modify in the tcl script in ns2. Please, reply as quickly as possible.It will be very helpful for me to implement my project.

    ReplyDelete
    Replies
    1. Place protocol name as TMAODV in tcl script.

      Delete
  12. Getting this error while running tcl file with my new protocol

    num_nodes is set 50

    (_o14 cmd line 1)
    invoked from within
    "_o14 cmd addr"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o14" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o14 addr"
    ("eval" body line 1)
    invoked from within
    "eval $node addr $args"
    ("default" arm line 2)
    invoked from within
    "switch -exact $routingAgent_ {
    DSDV {
    set ragent [$self create-dsdv-agent $node]
    }
    DSR {
    $self at 0.0 "$node start-dsr"
    }
    AODV {
    set ragent [$self cre..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
    "_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
    "eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
    "$ns_ node"
    ("for" body line 2)
    invoked from within
    "for {set i 0} {$i < $val(nn)} {incr i} {
    set node_($i) [$ns_ node]
    }"
    (file "LANDYWIFI.tcl" line 72)

    check your video and follow the same steps and still I get this error. Please help me urgently.

    ReplyDelete
    Replies
    1. https://drive.google.com/file/d/0B57T1posDTHgOG5naFAwWGV4Nms/edit

      Try to use this TCL file.
      If you can not access it here from the link then just google for "aodv18.tcl" and you would get it at the first link. Then you would just need to change the protocol name inside TCL file if you are running for the cloned one.

      Delete
  13. Awesome work, It makes me able to run TAODV but when I followed the same steps to some other routing protocol, whom author have shared the simulation codes with me then I am getting errors from trace/cmu-trace.cc while running the make command. May I know whether we can follow these same steps to add any new routing protocol or its just for cloning of the pre-defined one. I would like you to explain for me how we can add new routing protocol to NS2 or AquaSim1.0. regards

    ReplyDelete
    Replies
    1. Hello, which one did you try doing? I wanted to do it for CBRP.

      Delete
  14. I am stuck with this error
    Segmentation fault (core dumped)
    please some body help me.

    ReplyDelete
    Replies
    1. i tried so many solutions for this but never got succeed.
      honestly i tried this in the end :

      1. reinstall the ns 2 or if any of your friend has working ns 2. than copy their ns2.x folder and replace it in your machine .

      Delete
  15. hello suraj,
    i wanted to implement security in dsr and wanna modify the route request packet. can u plzz suggest where the modification is to be done?

    ReplyDelete
    Replies
    1. I'm doin the same thing which strategy r u implementing ?

      Delete
  16. sir,i want to add rtcp real time control protocol in my ns2,ns-2.35.please sir help me.give me some instruction for this

    ReplyDelete
  17. I got this error. Even following after 6th step
    trace/cmu-trace.cc:53:37: fatal error: aodv/aodv_packet.h: No such file or directory
    #include //AODV
    ^
    compilation terminated.
    make: *** [trace/cmu-trace.o] Error 1
    Ns make failed!

    ReplyDelete
  18. Sir, I want to implement Modified AODV routing protocol. I want to make changes in HELLO and RREQ packets. Can u please suggest where the modifications are to be done?

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete
  20. I am getting 2 errors...please help!!
    maodv/maodv.cc: In member function ‘virtual void MAODV::recv(Packet*, Handler*)’: maodv/maodv.cc:712:7: error: ‘struct hdr_cmn’ has no member named ‘maodv_salvage_count_’ ch->maodv_salvage_count_ = 0; ^

    maodv/maodv.cc: In member function ‘void MAODV::nb_delete(nsaddr_t)’: maodv/maodv.cc:1756:49: error: ‘struct hdr_cmn’ has no member named ‘maodv_salvage_count_’ if ( rt && (rt->rt_flags == RTF_UP) && (ch -> maodv_salvage_count_ < MAODV_MAX_SALVAGE_COUNT) ) { ^ maodv/maodv.cc:1757:9: error: ‘struct hdr_cmn’ has no member named ‘maodv_salvage_count_’ ch -> maodv_salvage_count_ += 1; ^

    ReplyDelete
  21. sir getting the same error
    (_o14 cmd line 1)
    invoked from within
    "_o14 cmd addr"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o14" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o14 addr"
    ("eval" body line 1)
    invoked from within
    "eval $node addr $args"
    ("default" arm line 2)
    invoked from within
    "switch -exact $routingAgent_ {
    DSDV {
    set ragent [$self create-dsdv-agent $node]
    }
    DSR {
    $self at 0.0 "$node start-dsr"
    }
    AODV {
    set ragent [$self cre..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
    "_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
    "eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
    "$ns node"
    ("for" body line 2)
    invoked from within
    "for {set i 0} {$i < $val(nn) } { incr i } {
    set node_($i) [$ns node]
    $node_($i) set X_ [ expr 10+round(rand()*480) ]
    $node_($i..."
    (file "aodv18.tcl" line 54)

    ReplyDelete
    Replies
    1. I like you, if you have overcome please help me. If you email them please help me. Thank you!

      Delete
    2. i am also getting the same problem. please help me "Le Tan" if you are find solution

      Delete
  22. Is it possible for you to upload your ns allinone-2.35 package on your google drive.You can create a rar file for reducing the size plz sir do help..!!

    ReplyDelete
  23. Sir i was able to clone aodv to other protocol which i named it maodv however in the trace file produced of the new cloned protocol it still shows aodv.. plzz do help..!!

    ReplyDelete
  24. sir ,,i tried all these steps to add aodv clone but after make its gives error as follows:

    taodv/taodv.o: In function `BroadcastTimer::handle(Event*)':
    taodv.cc:(.text+0x468): multiple definition of `BroadcastTimer::handle(Event*)'
    aodv/aodv.o:aodv.cc:(.text+0x468): first defined here
    taodv/taodv.o: In function `RouteCacheTimer::handle(Event*)':
    taodv.cc:(.text+0x54a): multiple definition of `RouteCacheTimer::handle(Event*)'
    aodv/aodv.o:aodv.cc:(.text+0x54a): first defined here
    taodv/taodv.o: In function `HelloTimer::handle(Event*)':
    taodv.cc:(.text+0x4ae): multiple definition of `HelloTimer::handle(Event*)'
    aodv/aodv.o:aodv.cc:(.text+0x4ae): first defined here
    taodv/taodv.o: In function `NeighborTimer::handle(Event*)':
    taodv.cc:(.text+0x508): multiple definition of `NeighborTimer::handle(Event*)'
    aodv/aodv.o:aodv.cc:(.text+0x508): first defined here
    taodv/taodv.o: In function `LocalRepairTimer::handle(Event*)':
    taodv.cc:(.text+0x590): multiple definition of `LocalRepairTimer::handle(Event*)'
    aodv/aodv.o:aodv.cc:(.text+0x590): first defined here
    collect2: ld returned 1 exit status
    make: *** [ns] Error 1

    please help..i m not able to figure out,,!!!

    ReplyDelete
    Replies
    1. remove timers in taodv.cc,
      they already existed in aodv.cc

      Delete
  25. awesome..very clear steps..its working

    ReplyDelete
  26. Should I follow the same to clone the protocol sctp?please help me

    ReplyDelete
  27. Should I follow the same to clone the protocol sctp

    ReplyDelete
  28. heloo suraj, i did exactly like you did but
    ./common/ptypes2tcl > gen/ptypes.cc
    Segmentation fault (core dumped)
    make: *** [gen/ptypes.cc] Error 139
    Ns make failed!
    ???

    ReplyDelete
  29. (_o15 cmd line 1)
    invoked from within
    "_o15 cmd addr"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o15" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o15 addr"
    ("eval" body line 1)
    invoked from within
    "eval $node addr $args"
    ("default" arm line 2)
    invoked from within
    "switch -exact $routingAgent_ {
    DSDV {
    set ragent [$self create-dsdv-agent $node]
    }
    DSR {
    $self at 0.0 "$node start-dsr"
    }
    AODV {
    set ragent [$self cre..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
    "_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
    "eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
    "$ns_ node"
    ("for" body line 2)
    invoked from within
    "for {set i 0} {$i < $val(nnaodv)} {incr i} {
    set node_($i) [$ns_ node]
    $node_($i) random-motion 0 ;#disable random motion
    }"
    (file "pgodlla.tcl" line 49)

    help me!

    ReplyDelete
  30. I need to hire a NS2 expert. I have a program and i need it to be coded on NS2. The program is about Wireless sensor networks. Anyone interested can contact me at silverhawk.jeff@gmail.com

    ReplyDelete
  31. Sir could you please tell me how to create fake route request for non existing node in aodv?

    ReplyDelete
  32. g++ -c -O2 -Wall -Wno-write-strings -DTCP_DELAY_BIND_ALL -DNO_TK -DTCLCL_CLASSINSTVAR -DNDEBUG -DLINUX_TCP_HEADER -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_14 -DHAVE_OTCL_H -DHAVE_LIBTK8_5 -DHAVE_TK_H -DHAVE_LIBTCL8_5 -DHAVE_TCLINT_H -DHAVE_TCL_H -DHAVE_CONFIG_H -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=std -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -I. -I. -I/home/ns2/ns-allinone-2.35/tclcl-1.20 -I/home/ns2/ns-allinone-2.35/otcl -I/home/ns2/ns-allinone-2.35/tk8.5.10/generic -I/home/ns2/ns-allinone-2.35/tcl8.5.10/generic -I/home/ns2/ns-allinone-2.35/tcl8.5.10/generic -I/usr/include/pcap -I./tcp -I./sctp -I./common -I./link -I./queue -I./adc -I./apps -I./mac -I./mobile -I./trace -I./routing -I./tools -I./classifier -I./mcast -I./diffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o trace/cmu-trace.o trace/cmu-trace.cc
    trace/cmu-trace.cc:53:32: fatal error: saodv/saodv_packet.h: No such file or directory
    #include
    ^
    compilation terminated.
    make: *** [trace/cmu-trace.o] Error 1
    ns2@ubuntu:~/ns-allinone-2.35/ns-2.35$

    what next???
    num_nodes is set 24

    (_o14 cmd line 1)
    invoked from within
    "_o14 cmd addr"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o14" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o14 addr"
    ("eval" body line 1)
    invoked from within
    "eval $node addr $args"
    ("default" arm line 2)
    invoked from within
    "switch -exact $routingAgent_ {
    DSDV {
    set ragent [$self create-dsdv-agent $node]
    }
    DSR {
    $self at 0.0 "$node start-dsr"
    }
    AODV {
    set ragent [$self cre..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
    "_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
    "eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
    "$ns_ node"
    invoked from within
    "set Server1 [$ns_ node]"
    (file "saodv.tcl" line 72)
    ns2@ubuntu:~/Desktop/MYNS2EX/007srinu_saodv1$

    ReplyDelete
  33. trace/cmu-trace.cc:67:32: fatal error: raodv/raodv_packet.h: No such file or directory
    #include
    ^
    compilation terminated.
    make: *** [trace/cmu-trace.o] Error 1

    ReplyDelete
  34. Iam getting error on step 6:
    after removing step6 it runs smoothly then I try to run tcl file it shows the error
    [code omitted because of length]
    : invalid command name "Agent/RAODV"
    while executing
    "Agent/RAODV instproc init args {

    $self next $args
    } "


    help me

    ReplyDelete
  35. where did you write the definition of new protocol i mean logic of the new protocol ?

    ReplyDelete
  36. can we follow all same steps for implementing other parameters for ns2 other than protocols...for example mobility mode

    ReplyDelete
  37. ‘lrtimer’ was not declared in this scope

    ReplyDelete
  38. taodv/taodv.cc:187:1: error: ‘TAODVLocalRepairTimer’ has not been declared

    ihav ealready follow all stpes but error after ./install

    ReplyDelete
  39. ns-allinone-2.35\dei80211mr-1.1.4\src\InitTCL.cc this step INitTCL.cc file is not there how to get these file

    ReplyDelete
  40. it is very nice to help us
    please sir if you can send to me the steps to clone DSR routing protocol on ns2.35

    ReplyDelete
  41. After making a clone of DSR protocol in ns2.35, the following errors arise. Looking forward your response
    num_nodes is set 12
    warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl

    (_o14 cmd line 1)
    invoked from within
    "_o14 cmd addr"
    invoked from within
    "catch "$self cmd $args" ret"
    invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
    (procedure "_o14" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o14 addr"
    ("eval" body line 1)
    invoked from within
    "eval $node addr $args"
    ("default" arm line 2)
    invoked from within
    "switch -exact $routingAgent_ {
    DSDV {
    set ragent [$self create-dsdv-agent $node]
    }
    DSR {
    $self at 0.0 "$node start-dsr"
    }
    AODV {
    set ragent [$self cre..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
    "_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
    "eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
    "$ns node"
    ("for" body line 2)
    invoked from within
    "for {set i 0} {$i < $val(nn) } { incr i } {
    set node_($i) [$ns node]
    $node_($i) set X_ [ expr 10+round(rand()*480) ]
    $node_($i..."
    (file "gbdsr.tcl" line 54)

    ReplyDelete
  42. hellp please i want ur helping about in Randomized AODV

    ReplyDelete
  43. Thanks for this,its really work.

    ReplyDelete
  44. The code has no any errors. But I also faced above errors. Bcz of my patched routing protocols which I previously installed. (HWMP)

    ReplyDelete
  45. Fairplay casino sites to bet on sports?
    Fairplay is 메리트 카지노 고객센터 a brand new online 제왕 카지노 casino, where you'll be able to bet on sports. The site is also live on the Internet, 샌즈카지노 thanks to the addition of the

    ReplyDelete