?? ns-2.26-aodv-uu-0.8.patch
字號:
++ 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 -urN ns-2.26/tcl/lib/ns-packet.tcl ../../mod-2.26/ns-allinone-2.26/ns-2.26/tcl/lib/ns-packet.tcl--- ns-2.26/tcl/lib/ns-packet.tcl 2003-02-26 23:09:37.000000000 +0100+++ ../../mod-2.26/ns-allinone-2.26/ns-2.26/tcl/lib/ns-packet.tcl 2004-02-13 13:09:46.000000000 +0100@@ -33,7 +33,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. #-# @(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/tcl/lib/ns-packet.tcl,v 1.46 2002/01/14 20:05:43 xuanc Exp $+# @(#) $Header: /it/project/fo/core/ape/cvsroot/ape-sources/src/aodv-uu/ns-2.26/tcl/lib/ns-packet.tcl,v 1.1 2003/04/16 18:34:46 bjwi7937 Exp $ # # set up the packet format for the simulation # (initial version)@@ -155,6 +155,7 @@ UMP Pushback NV+ AODVUU } { add-packet-header $prot }diff -urN ns-2.26/trace/cmu-trace.cc ../../mod-2.26/ns-allinone-2.26/ns-2.26/trace/cmu-trace.cc--- ns-2.26/trace/cmu-trace.cc 2003-02-26 23:11:29.000000000 +0100+++ ../../mod-2.26/ns-allinone-2.26/ns-2.26/trace/cmu-trace.cc 2004-02-13 13:09:55.000000000 +0100@@ -34,7 +34,7 @@ * Ported from CMU/Monarch's code, appropriate copyright applies. * nov'98 -Padma. *- * $Header: /nfs/jade/vint/CVSROOT/ns-2/trace/cmu-trace.cc,v 1.72 2003/02/22 03:53:35 buchheim Exp $+ * $Header: /it/project/fo/core/ape/cvsroot/ape-sources/src/aodv-uu/ns-2.26/trace/cmu-trace.cc,v 1.2 2003/10/13 20:24:40 erikn Exp $ */ #include <packet.h>@@ -49,6 +49,11 @@ #include <tora/tora_packet.h> //TORA #include <imep/imep_spec.h> // IMEP #include <aodv/aodv_packet.h> //AODV++#ifdef AODV_UU+#include <aodv-uu/aodv-uu.h> // AODV-UU+#endif /* AODV_UU */+ #include <cmu-trace.h> #include <mobilenode.h> @@ -707,6 +712,169 @@ } } +#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,+ ntohl(aodv_rreq->rreq_id),+ (nsaddr_t) ntohl(aodv_rreq->dest_addr),+ ntohl(aodv_rreq->dest_seqno),+ (nsaddr_t) ntohl(aodv_rreq->orig_addr),+ ntohl(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) ntohl(aodv_rreq->dest_addr),+ ntohl(aodv_rreq->dest_seqno),+ (nsaddr_t) ntohl(aodv_rreq->orig_addr),+ ntohl(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 -Pl %f -Pc %s ",+ aodv_rrep->type,+ aodv_rrep->hcnt,+ (nsaddr_t) ntohl(aodv_rrep->dest_addr),+ ntohl(aodv_rrep->dest_seqno),+ (double) ntohl(aodv_rrep->lifetime),+ (ih->daddr() == (nsaddr_t) AODV_BROADCAST &&+ ih->ttl() == 1) ? "HELLO" : "REPLY");+ } else {++ sprintf(pt_->buffer() + offset,+ "[0x%x %d [%d %d] %f] (%s)",+ aodv_rrep->type,+ aodv_rrep->hcnt,+ (nsaddr_t) ntohl(aodv_rrep->dest_addr),+ ntohl(aodv_rrep->dest_seqno),+ (double) ntohl(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) ntohl(aodv_rerr->dest_addr),+ ntohl(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) ntohl(aodv_rerr->dest_addr),+ ntohl(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) {@@ -941,6 +1109,14 @@ 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", __PRETTY_FUNCTION__, packet_info.name(ch->ptype()));diff -urN ns-2.26/trace/cmu-trace.h ../../mod-2.26/ns-allinone-2.26/ns-2.26/trace/cmu-trace.h--- ns-2.26/trace/cmu-trace.h 2003-02-26 23:11:30.000000000 +0100+++ ../../mod-2.26/ns-allinone-2.26/ns-2.26/trace/cmu-trace.h 2004-02-13 13:09:55.000000000 +0100@@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *- * $Header: /nfs/jade/vint/CVSROOT/ns-2/trace/cmu-trace.h,v 1.18 2003/02/22 03:53:35 buchheim Exp $+ * $Header: /it/project/fo/core/ape/cvsroot/ape-sources/src/aodv-uu/ns-2.26/trace/cmu-trace.h,v 1.1 2003/04/16 18:34:46 bjwi7937 Exp $ */ /* Ported from CMU/Monarch's code, nov'98 -Padma.*/@@ -122,6 +122,11 @@ 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__ */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -