www.pudn.com > dsr-uu-0.2.rar > ns-2.28-aodvuu-0.9.1-dsruu-pre.patch
diff -uprN ns-2.28.orig/common/packet.h ns-2.28/common/packet.h
--- ns-2.28.orig/common/packet.h 2005-01-19 19:23:18.000000000 +0100
+++ ns-2.28/common/packet.h 2005-05-09 17:07:09.754886621 +0200
@@ -163,6 +163,11 @@ enum packet_t {
// XCP packet
PT_XCP,
+#ifdef AODV_UU
+ // AODV packets in AODV-UU
+ PT_AODVUU,
+#endif /* AODV_UU */
+
// insert new packet types here
PT_NTYPE // This MUST be the LAST one
};
@@ -252,6 +257,10 @@ public:
// smac
name_[PT_SMAC]="smac";
+#ifdef AODV_UU
+ // AODV packets in AODV-UU
+ name_[PT_AODVUU] = "AODVUU";
+#endif /* AODV_UU */
name_[PT_XCP]="xcp";
diff -uprN ns-2.28.orig/mac/wireless-phy.h~ ns-2.28/mac/wireless-phy.h~
--- ns-2.28.orig/mac/wireless-phy.h~ 2005-01-26 22:58:52.000000000 +0100
+++ ns-2.28/mac/wireless-phy.h~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,135 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- *
- *
- * Copyright (c) 1997 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Computer Systems
- * Engineering Group at Lawrence Berkeley Laboratory.
- * 4. Neither the name of the University nor of the Laboratory may be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Header$
- *
- * Ported from CMU/Monarch's code, nov'98 -Padma Haldar.
- *
- * wireless-phy.h
- * -- a SharedMedia network interface
- */
-
-#ifndef ns_WirelessPhy_h
-#define ns_WirelessPhy_h
-
-#include "propagation.h"
-#include "modulation.h"
-#include "omni-antenna.h"
-#include "phy.h"
-#include "mobilenode.h"
-#include "timer-handler.h"
-
-class Phy;
-class Propagation;
-class WirelessPhy;
-
-// For idle energy consumption -- Chalermek
-
-class Idle_Timer : public TimerHandler {
- public:
- Idle_Timer(WirelessPhy *a) : TimerHandler() { a_ = a; }
- protected:
- virtual void expire(Event *e);
- WirelessPhy *a_;
-};
-
-class WirelessPhy : public Phy {
-public:
- WirelessPhy();
-
- void sendDown(Packet *p);
- int sendUp(Packet *p);
-
- inline double getL() const {return L_;}
- inline double getLambda() const {return lambda_;}
- inline Node* node(void) const { return node_; }
- inline double getPtconsume() { return Pt_consume_; }
-
- double getDist(double Pr, double Pt, double Gt, double Gr, double hr,
- double ht, double L, double lambda);
-
- virtual int command(int argc, const char*const* argv);
- virtual void dump(void) const;
-
- //void setnode (MobileNode *node) { node_ = node; }
- void node_on();
- void node_off();
-
- /* -NEW- */
- inline double getAntennaZ() { return ant_->getZ(); }
- inline double getPt() { return Pt_; }
- inline double getRXThresh() { return RXThresh_; }
- inline double getCSThresh() { return CSThresh_; }
- inline double getFreq() { return freq_; }
- /* End -NEW- */
-
-protected:
- double Pt_; // transmitted signal power (W)
- double Pt_consume_; // power consumption for transmission (W)
- double Pr_consume_; // power consumption for reception (W)
- double P_idle_; // idle power consumption (W)
- double last_send_time_; // the last time the node sends somthing.
- double channel_idle_time_; // channel idle time.
- double update_energy_time_; // the last time we update energy.
-
- double freq_; // frequency
- double lambda_; // wavelength (m)
- double L_; // system loss factor
-
- double RXThresh_; // receive power threshold (W)
- double CSThresh_; // carrier sense threshold (W)
- double CPThresh_; // capture threshold (db)
-
- Antenna *ant_;
- Propagation *propagation_; // Propagation Model
- Modulation *modulation_; // Modulation Schem
-
- // Why phy has a node_ and this guy has it all over again??
-// MobileNode* node_; // Mobile Node to which interface is attached .
-
- Idle_Timer idle_timer_;
-
- enum ChannelStatus { IDLE, RECV, SEND };
- int status_;
-private:
- inline int initialized() {
- return (node_ && uptarget_ && downtarget_ && propagation_);
- }
- void UpdateIdleEnergy();
- // Convenience method
- EnergyModel* em() { return node()->energy_model(); }
-
- friend class Idle_Timer;
-};
-
-#endif /* !ns_WirelessPhy_h */
diff -uprN ns-2.28.orig/Makefile.in ns-2.28/Makefile.in
--- ns-2.28.orig/Makefile.in 2005-01-25 23:27:16.000000000 +0100
+++ ns-2.28/Makefile.in 2005-05-09 17:07:18.142645930 +0200
@@ -52,13 +52,26 @@ PERL = @PERL@
# for diffusion
#DIFF_INCLUDES = "./diffusion3/main ./diffusion3/lib ./diffusion3/nr ./diffusion3/ns"
+# AODV-UU: Name of subdirectory with AODV-UU files,
+# usually a symlink to the AODV-UU sources. If you change this,
+# ~ns/trace/cmu-trace.cc must be updated as well.
+AODV_UU_DIR = aodv-uu
+AODV_UU_LIB = libaodv-uu.a
+
+
+DSRUU_DIR = dsr-uu
+DSRUU_LIB = libdsr-uu.a
+
CCOPT = @V_CCOPT@
STATIC = @V_STATIC@
LDFLAGS = $(STATIC)
LDOUT = -o $(BLANK)
-DEFINE = -DTCP_DELAY_BIND_ALL -DNO_TK @V_DEFINE@ @V_DEFINES@ @DEFS@ -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=@CPP_NAMESPACE@ -DUSE_SINGLE_ADDRESS_SPACE -Drng_test
+# AODV-UU: Added "-DAODV_UU" and "-DNS_PORT" to enable AODV-UU
+DEFINE = -DTCP_DELAY_BIND_ALL -DNO_TK @V_DEFINE@ @V_DEFINES@ @DEFS@ -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=@CPP_NAMESPACE@ -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -DAODV_UU -DNS_PORT
+# AODV-UU: Added -I for AODV-UU directory, to allow custom-generated
+# endian.h to be found on systems which lack it.
INCLUDES = \
-I. @V_INCLUDE_X11@ \
@V_INCLUDES@ \
@@ -69,14 +82,19 @@ INCLUDES = \
-I./diffusion3/lib/nr -I./diffusion3/ns \
-I./diffusion3/filter_core -I./asim/ -I./qs \
-I./diffserv \
- -I./wpan
+ -I./wpan \
+ -I./$(AODV_UU_DIR) \
LIB = \
@V_LIBS@ \
@V_LIB_X11@ \
@V_LIB@ \
- -lm @LIBS@
+ -lm @LIBS@ \
+ -L$(AODV_UU_DIR) \
+ -laodv-uu \
+ -L$(shell pwd)/$(DSRUU_DIR) \
+ -ldsr-uu
# -L@libdir@ \
CFLAGS = $(CCOPT) $(DEFINE)
@@ -358,13 +376,28 @@ BUILD_NSE = @build_nse@
all: $(NS) $(BUILD_NSE) all-recursive
+# AODV-UU: Added phony targets for AODV-UU
+.PHONY: aodv-uu-clean dsruu-clean
+
+$(AODV_UU_DIR)/$(AODV_UU_LIB):
+ cd $(AODV_UU_DIR) && $(MAKE) $(AODV_UU_LIB) NS_DEFS='$(DEFINE)' OPTS='$(CCOPT)' NS_INC='$(subst -I.,-I$(shell pwd),$(INCLUDES))'
+
+aodv-uu-clean:
+ cd $(AODV_UU_DIR) && $(MAKE) clean
+
+$(DSRUU_DIR)/$(DSRUU_LIB): $(DSRUU_DIR)/*.c $(DSRUU_DIR)/*.h $(DSRUU_DIR)/Makefile
+ $(MAKE) -C $(DSRUU_DIR) $(DSRUU_LIB) NS_DEFS='$(DEFINE) -DNS2' OPTS='$(CCOPT)' NS_INC='$(subst -I.,-I$(shell pwd),$(INCLUDES))'
+
+dsruu-clean:
+ $(MAKE) -C $(DSRUU_DIR) clean
all-recursive:
for i in $(SUBDIRS); do ( cd $$i; $(MAKE) all; ) done
-$(NS): $(OBJ) common/tclAppInit.o Makefile
+# AODV-UU: Added "aodv-uu" as first dependency
+$(NS): $(AODV_UU_DIR)/$(AODV_UU_LIB) $(DSRUU_DIR)/$(DSRUU_LIB) $(OBJ) common/tclAppInit.o Makefile
$(LINK) $(LDFLAGS) $(LDOUT)$@ \
- common/tclAppInit.o $(OBJ) $(LIB)
+ common/tclAppInit.o $(OBJ) $(LIB) $(DSRUU_DIR)/*-ns.o
Makefile: Makefile.in
@echo "Makefile.in is newer than Makefile."
@@ -487,7 +520,7 @@ install-man: force
install-recursive: force
for i in $(SUBDIRS); do ( cd $$i; $(MAKE) install; ) done
-clean:
+clean: aodv-uu-clean dsruu-clean
$(RM) $(CLEANFILES)
AUTOCONF_GEN = tcl/lib/ns-autoconf.tcl
diff -uprN ns-2.28.orig/queue/priqueue.cc ns-2.28/queue/priqueue.cc
--- ns-2.28.orig/queue/priqueue.cc 2005-01-25 23:38:47.000000000 +0100
+++ ns-2.28/queue/priqueue.cc 2005-05-09 17:07:18.154644156 +0200
@@ -92,7 +92,11 @@ PriQueue::recv(Packet *p, Handler *h)
case PT_AODV:
recvHighPriority(p, h);
break;
-
+#ifdef AODV_UU
+ case PT_AODVUU:
+ recvHighPriority(p, h);
+ break;
+#endif /* AODV_UU */
default:
Queue::recv(p, h);
}
diff -uprN ns-2.28.orig/tcl/lib/ns-agent.tcl ns-2.28/tcl/lib/ns-agent.tcl
--- ns-2.28.orig/tcl/lib/ns-agent.tcl 2005-01-19 19:23:37.000000000 +0100
+++ ns-2.28/tcl/lib/ns-agent.tcl 2005-05-09 17:07:18.155644008 +0200
@@ -192,3 +192,10 @@ Agent/AODV instproc init args {
Agent/AODV set sport_ 0
Agent/AODV set dport_ 0
+# AODV-UU routing agent
+Agent/AODVUU instproc init args {
+ $self next $args
+}
+
+Agent/AODVUU set sport_ 0
+Agent/AODVUU set dport_ 0
diff -uprN ns-2.28.orig/tcl/lib/ns-default.tcl ns-2.28/tcl/lib/ns-default.tcl
--- ns-2.28.orig/tcl/lib/ns-default.tcl 2005-01-19 19:23:37.000000000 +0100
+++ ns-2.28/tcl/lib/ns-default.tcl 2005-05-09 17:07:18.160643268 +0200
@@ -1343,3 +1343,19 @@ Queue set util_records_ 0
# Quick Start definitions end here
Delayer set debug_ false
+
+# AODV-UU routing agent
+Agent/AODVUU set unidir_hack_ 0
+Agent/AODVUU set rreq_gratuitous_ 0
+Agent/AODVUU set expanding_ring_search_ 1
+Agent/AODVUU set local_repair_ 0
+Agent/AODVUU set receive_n_hellos_ 0
+Agent/AODVUU set hello_jittering_ 0
+Agent/AODVUU set wait_on_reboot_ 0
+Agent/AODVUU set debug_ 0
+Agent/AODVUU set rt_log_interval_ 0
+Agent/AODVUU set log_to_file_ 0
+Agent/AODVUU set optimized_hellos_ 0
+Agent/AODVUU set ratelimit_ 1
+Agent/AODVUU set llfeedback_ 1
+Agent/AODVUU set internet_gw_mode_ 0
diff -uprN ns-2.28.orig/tcl/lib/ns-lib.tcl ns-2.28/tcl/lib/ns-lib.tcl
--- ns-2.28.orig/tcl/lib/ns-lib.tcl 2005-01-24 21:03:43.000000000 +0100
+++ ns-2.28/tcl/lib/ns-lib.tcl 2005-05-09 17:07:18.172641494 +0200
@@ -597,9 +597,16 @@ Simulator instproc create-wireless-node
DSR {
$self at 0.0 "$node start-dsr"
}
+ DSRUU {
+ $self at 0.0 "$node start-dsr"
+ }
AODV {
set ragent [$self create-aodv-agent $node]
}
+ # AODV-UU routing agent
+ AODVUU {
+ $self at 0.0 "$node start-aodv"
+ }
TORA {
Simulator set IMEPFlag_ ON
set ragent [$self create-tora-agent $node]
@@ -652,7 +659,7 @@ Simulator instproc create-wireless-node
$ifqType_ $ifqlen_ $phyType_ $antType_ $topoInstance_ \
$inerrProc_ $outerrProc_ $FECProc_
# Attach agent
- if {$routingAgent_ != "DSR"} {
+ if {$routingAgent_ != "DSR" && $routingAgent_ != "DSRUU" && $routingAgent_ != "AODVUU"} {
$node attach $ragent [Node set rtagent_port_]
}
if {$routingAgent_ == "DIFFUSION/RATE" ||
@@ -672,7 +679,7 @@ Simulator instproc create-wireless-node
# Bind routing agent and mip agent if existing basestation
# address setting
if { [info exist wiredRouting_] && $wiredRouting_ == "ON" } {
- if { $routingAgent_ != "DSR" } {
+ if { $routingAgent_ != "DSR" && $routingAgent_ != "DSRUU" && $routingAgent_ != "AODVUU"} {
$node mip-call $ragent
}
}
@@ -721,10 +728,14 @@ Simulator instproc create-wireless-node
Simulator instproc create-node-instance args {
$self instvar routingAgent_
# DSR is a special case
- if {$routingAgent_ == "DSR"} {
+ if {$routingAgent_ == "DSR" || $routingAgent_ == "DSRUU"} {
set nodeclass [$self set-dsr-nodetype]
} else {
- set nodeclass Node/MobileNode
+ if { $routingAgent_ == "AODVUU"} {
+ set nodeclass Node/MobileNode/AODVNode
+ } else {
+ set nodeclass Node/MobileNode
+ }
}
return [eval new $nodeclass $args]
}
diff -uprN ns-2.28.orig/tcl/lib/ns-mobilenode.tcl ns-2.28/tcl/lib/ns-mobilenode.tcl
--- ns-2.28.orig/tcl/lib/ns-mobilenode.tcl 2005-01-26 00:29:14.000000000 +0100
+++ ns-2.28/tcl/lib/ns-mobilenode.tcl 2005-05-09 17:07:18.174641198 +0200
@@ -775,7 +775,12 @@ SRNodeNew instproc init args {
# Use the default mash and shift
set dmux_ [new Classifier/Port]
}
- set dsr_agent_ [new Agent/DSRAgent]
+
+ if { [$ns set routingAgent_] == "DSRUU" } {
+ set dsr_agent_ [new Agent/DSRUU]
+ } else {
+ set dsr_agent_ [new Agent/DSRAgent]
+ }
# setup address (supports hier-address) for dsragent
$dsr_agent_ addr $address_
@@ -856,3 +861,104 @@ SRNodeNew instproc reset args {
eval $self next $args
$dsr_agent_ reset
}
+##############################################################################
+# A MobileNode Class for AODV which is modeled after the SRNode Class
+# but with modifications.
+##############################################################################
+Class Node/MobileNode/AODVNode -superclass Node/MobileNode
+
+Node/MobileNode/AODVNode instproc init args {
+ $self instvar ragent_ dmux_ classifier_ entry_point_ address_
+
+ set ns [Simulator instance]
+
+ eval $self next $args ;# parent class constructor
+
+ if {$dmux_ == "" } {
+ # Use the default mash and shift
+ set dmux_ [new Classifier/Port]
+ }
+ set ragent_ [new Agent/AODVUU [$self id ]]
+
+ # setup address (supports hier-address) for AODV agent
+ $self addr $address_
+ $ragent_ addr $address_
+ $ragent_ node $self
+
+ # Add the node's own address to the port demuxer
+ $self add-route $address_ $dmux_
+
+ if { [Simulator set RouterTrace_] == "ON" } {
+ # Recv Target
+ set rcvT [$self mobility-trace Recv "RTR"]
+ set namfp [$ns get-nam-traceall]
+ if { $namfp != "" } {
+ $rcvT namattach $namfp
+ }
+ $rcvT target $ragent_
+ set entry_point_ $rcvT
+ } else {
+ # Recv Target
+ set entry_point_ $ragent_
+ }
+
+ $self set ragent_ $ragent_
+
+ # The target of the routing agent is the address classifier
+ $ragent_ target $classifier_
+
+ set nullAgent_ [$ns set nullAgent_]
+
+ # The default target in the classifier is set to the
+ # nullAgent, since the routing agent already handled whatever
+ # needs to be handled
+ $classifier_ defaulttarget $nullAgent_
+
+ # Packets to the routing agent and default port should be
+ # dropped, since we've already handled them in the routing
+ # agent at the entry.
+ $dmux_ install [Node set rtagent_port_] $nullAgent_
+ $dmux_ defaulttarget $nullAgent_
+
+ return $self
+}
+
+Node/MobileNode/AODVNode instproc start-aodv {} {
+ $self instvar ragent_
+ $ragent_ start
+}
+
+Node/MobileNode/AODVNode instproc entry {} {
+ $self instvar entry_point_
+ return $entry_point_
+}
+
+Node/MobileNode/AODVNode instproc add-interface args {
+ eval $self next $args
+
+ $self instvar ragent_ ll_ mac_ ifq_
+
+ set ns [Simulator instance]
+
+ if { [Simulator set RouterTrace_] == "ON" } {
+ # Send Target
+ set sndT [$self mobility-trace Send "RTR"]
+ set namfp [$ns get-nam-traceall]
+ if {$namfp != "" } {
+ $sndT namattach $namfp
+ }
+ $sndT target $ll_(0)
+ $ragent_ add-ll $sndT
+ } else {
+ # Send Target
+ $ragent_ add-ll $ll_(0)
+ }
+
+ $ragent_ if-queue $ifq_(0)
+}
+
+Node/MobileNode/AODVNode instproc reset args {
+ $self instvar ragent_
+ eval $self next $args
+ $ragent_ reset
+}
diff -uprN ns-2.28.orig/tcl/lib/ns-packet.tcl ns-2.28/tcl/lib/ns-packet.tcl
--- ns-2.28.orig/tcl/lib/ns-packet.tcl 2005-01-26 00:29:15.000000000 +0100
+++ ns-2.28/tcl/lib/ns-packet.tcl 2005-05-09 17:07:18.174641198 +0200
@@ -158,6 +158,7 @@ foreach prot {
SCTP
Smac
NV
+ AODVUU
} {
add-packet-header $prot
}
diff -uprN ns-2.28.orig/trace/cmu-trace.cc ns-2.28/trace/cmu-trace.cc
--- ns-2.28.orig/trace/cmu-trace.cc 2005-02-03 19:29:19.000000000 +0100
+++ ns-2.28/trace/cmu-trace.cc 2005-05-09 17:07:18.000000000 +0200
@@ -51,6 +51,9 @@
#include //TORA
#include // IMEP
#include //AODV
+#ifdef AODV_UU
+#include // AODV-UU
+#endif /* AODV_UU */
#include
#include
#include
@@ -872,6 +875,170 @@ CMUTrace::format_aodv(Packet *p, int off
abort();
}
}
+#ifdef AODV_UU
+void CMUTrace::format_aodvuu(Packet *p, int offset) {
+
+ struct hdr_ip *ih = HDR_IP(p);
+ hdr_aodvuu *ah = HDR_AODVUU(p);
+ AODV_msg *aodv_msg = (AODV_msg *) ah;
+
+ RREQ *aodv_rreq = (RREQ *) aodv_msg;
+ RREP *aodv_rrep = (RREP *) aodv_msg;
+ RREP_ack *aodv_rrep_ack = (RREP_ack *) aodv_msg;
+ RERR *aodv_rerr = (RERR *) aodv_msg;
+
+ switch (aodv_msg->type) {
+
+ case AODV_RREQ:
+
+ if (pt_->tagged()) {
+ // Tagged format currently not supported
+ } else if (newtrace_) {
+
+ sprintf(pt_->buffer() + offset,
+ "-P aodvuu -Pt 0x%x -Ph %d -Pb %d -Pd %d -Pds %d -Ps %d -Pss %d -Pc REQUEST ",
+ aodv_rreq->type,
+ aodv_rreq->hcnt,
+ aodv_rreq->rreq_id,
+ (nsaddr_t) aodv_rreq->dest_addr,
+ aodv_rreq->dest_seqno,
+ (nsaddr_t) aodv_rreq->orig_addr,
+ aodv_rreq->orig_seqno);
+
+ } else {
+
+ sprintf(pt_->buffer() + offset,
+ "[0x%x %d %d [%d %d] [%d %d]] (REQUEST)",
+ aodv_rreq->type,
+ aodv_rreq->hcnt,
+ ntohl(aodv_rreq->rreq_id),
+ (nsaddr_t) aodv_rreq->dest_addr,
+ aodv_rreq->dest_seqno,
+ (nsaddr_t) aodv_rreq->orig_addr,
+ aodv_rreq->orig_seqno);
+ }
+
+ break;
+
+ case AODV_HELLO:
+
+ /* FALLS THROUGH (HELLO:s are sent as RREP:s) */
+
+ case AODV_RREP:
+
+ if (pt_->tagged()) {
+ // Tagged format currently not supported
+ } else if (newtrace_) {
+
+ sprintf(pt_->buffer() + offset,
+ "-P aodvuu -Pt 0x%x -Ph %d -Pd %d -Pds %d -Ps %d -Pl %f -Pc %s ",
+ aodv_rrep->type,
+ aodv_rrep->hcnt,
+ (nsaddr_t) aodv_rrep->dest_addr,
+ aodv_rrep->dest_seqno,
+ (nsaddr_t) aodv_rrep->orig_addr,
+ (double) aodv_rrep->lifetime,
+ (ih->daddr() == (nsaddr_t) AODV_BROADCAST &&
+ ih->ttl() == 1) ? "HELLO" : "REPLY");
+ } else {
+
+ sprintf(pt_->buffer() + offset,
+ "[0x%x %d [%d %d] [%d] %f] (%s)",
+ aodv_rrep->type,
+ aodv_rrep->hcnt,
+ (nsaddr_t) aodv_rrep->dest_addr,
+ aodv_rrep->dest_seqno,
+ (nsaddr_t) aodv_rrep->orig_addr,
+ (double) aodv_rrep->lifetime,
+ (ih->daddr() == (nsaddr_t) AODV_BROADCAST &&
+ ih->ttl() == 1) ? "HELLO" : "REPLY");
+ }
+
+ break;
+
+ case AODV_RERR:
+
+ /*
+ Note 1:
+
+ The "hop count" (-Ph and its corresponding field in
+ the old trace format) is actually the DestCount.
+
+ This is a reminiscence from the AODV trace format,
+ where RREP:s, RERR:s and HELLO:s are treated equally
+ in terms of logging.
+
+ Note 2:
+
+ Lifetime field does not exist for RERR:s.
+ Again a reminiscence from the AODV trace format
+ (where that field isn't even initialized!).
+ Therefore lifetime is set to 0.0 all the time for RERR:s.
+ */
+
+ if (pt_->tagged()) {
+ // Tagged format currently not supported
+ } else if (newtrace_) {
+
+ sprintf(pt_->buffer() + offset,
+ "-P aodvuu -Pt 0x%x -Ph %d -Pd %d -Pds %d -Pl %f -Pc ERROR ",
+ aodv_rerr->type,
+ aodv_rerr->dest_count,
+ (nsaddr_t) aodv_rerr->dest_addr,
+ aodv_rerr->dest_seqno,
+ 0.0);
+ } else {
+
+ sprintf(pt_->buffer() + offset,
+ "[0x%x %d [%d %d] %f] (ERROR)",
+ aodv_rerr->type,
+ aodv_rerr->dest_count,
+ (nsaddr_t) aodv_rerr->dest_addr,
+ aodv_rerr->dest_seqno,
+ 0.0);
+ }
+
+ break;
+
+ case AODV_RREP_ACK:
+
+ /*
+ Note 3:
+
+ RREP-ACK logging didn't exist in the AODV trace format.
+ */
+
+ if (pt_->tagged()) {
+ // Tagged format currently not supported
+ } else if (newtrace_) {
+
+ sprintf(pt_->buffer() + offset,
+ "-P aodvuu -Pt 0x%x RREP-ACK ",
+ aodv_rrep_ack->type);
+ } else {
+
+ sprintf(pt_->buffer() + offset,
+ "[%d] (RREP-ACK)",
+ aodv_rrep_ack->type);
+ }
+
+ break;
+
+ default:
+
+#ifdef WIN32
+ fprintf(stderr,
+ "CMUTrace::format_aodvuu: invalid AODVUU packet type\n");
+#else
+ fprintf(stderr,
+ "%s: invalid AODVUU packet type\n", __FUNCTION__);
+#endif
+ abort();
+
+ break;
+ }
+}
+#endif /* AODV_UU */
void
CMUTrace::nam_format(Packet *p, int offset)
@@ -1167,6 +1334,13 @@ void CMUTrace::format(Packet* p, const c
case PT_GAF:
case PT_PING:
break;
+#ifdef AODV_UU
+ case PT_ENCAPSULATED:
+ break;
+ case PT_AODVUU:
+ format_aodvuu(p, offset);
+ break;
+#endif /* AODV_UU */
default:
/*
fprintf(stderr, "%s - invalid packet type (%s).\n",
diff -uprN ns-2.28.orig/trace/cmu-trace.h ns-2.28/trace/cmu-trace.h
--- ns-2.28.orig/trace/cmu-trace.h 2005-01-26 00:29:16.000000000 +0100
+++ ns-2.28/trace/cmu-trace.h 2005-05-09 17:07:18.000000000 +0200
@@ -132,6 +132,9 @@ private:
void format_tora(Packet *p, int offset);
void format_imep(Packet *p, int offset);
void format_aodv(Packet *p, int offset);
+#ifdef AODV_UU
+ void format_aodvuu(Packet *p, int offset);
+#endif /* AODV_UU */
};
#endif /* __cmu_trace__ */