📄 umts.patch
字号:
diff -ur common/mobilenode.h ns-umts-extensions/code/mobilenode.h--- common/mobilenode.h 2001-02-07 10:25:35.000000000 +0000+++ ns-umts-extensions/code/mobilenode.h 2003-06-01 20:10:45.000000000 +0000@@ -1,5 +1,36 @@-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- +/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */++/* Modified and extended by Pablo Martin and Paula Ballester,+ * Strathclyde University, Glasgow.+ * June, 2003.+*/++/* Copyright (c) 2003 Strathclyde University of Glasgow, Scotland.+ * 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 and binary code must contain+ * the above copyright notice, this list of conditions and the following+ * disclaimer. *+ * 2. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed at Strathclyde University of+ * Glasgow, Scotland.+ *+ * 3. The name of the University may not be used to endorse or promote+ * products derived from this software without specific prior written+ * permission.+ * STRATHCLYDE UNIVERSITY OF GLASGOW, MAKES NO REPRESENTATIONS+ * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE+ * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software+ * is provided "as is" without express or implied warranty of any kind.+*/++/* * Copyright (c) 1997 Regents of the University of California. * All rights reserved. *@@ -117,7 +148,7 @@ MobileNode *node; }; -class MobileNode : public Node +class MobileNode : public Node { friend class PositionHandler; public:@@ -127,12 +158,11 @@ double distance(MobileNode*); double propdelay(MobileNode*); void start(void);- inline void getLoc(double *x, double *y, double *z) {- update_position(); *x = X_; *y = Y_; *z = Z_;- }- inline void getVelo(double *dx, double *dy, double *dz) {- *dx = dX_ * speed_; *dy = dY_ * speed_; *dz = 0.0;- }+ // P.M. & P.B. modifications, before there were two inlines + // not working properly, getLoc y getVelo+ void getLoc(double *x, double *y, double *z);+ void getVelo(double *dx, double *dy, double *dz);+ inline MobileNode* nextnode() { return link_.le_next; } inline int base_stn() { return base_stn_;} inline void set_base_stn(int addr) { base_stn_ = addr; }@@ -224,7 +254,11 @@ * Trace Target */ Trace* log_target_;- /* + /* P.M. & P.B. modifications+ * Link Layer+ */+ LL* ll_;+ /* * base_stn for mobilenodes communicating with wired nodes */ int base_stn_;diff -ur common/node.cc ns-umts-extensions/code/node.cc--- common/node.cc 2002-05-30 17:44:03.000000000 +0000+++ ns-umts-extensions/code/node.cc 2003-06-01 20:10:45.000000000 +0000@@ -1,5 +1,36 @@-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*-+/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */++/* Modified and extended by Pablo Martin and Paula Ballester,+ * Strathclyde University, Glasgow.+ * June, 2003.+*/++/* Copyright (c) 2003 Strathclyde University of Glasgow, Scotland.+ * 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 and binary code must contain+ * the above copyright notice, this list of conditions and the following+ * disclaimer.+ *+ * 2. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed at Strathclyde University of+ * Glasgow, Scotland.+ *+ * 3. The name of the University may not be used to endorse or promote+ * products derived from this software without specific prior written+ * permission.+ * STRATHCLYDE UNIVERSITY OF GLASGOW, MAKES NO REPRESENTATIONS+ * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE+ * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software+ * is provided "as is" without express or implied warranty of any kind.+*/++/* * Copyright (c) 1997 Regents of the University of California. * All rights reserved. *@@ -33,9 +64,9 @@ * * $Header: /nfs/jade/vint/CVSROOT/ns-2/common/node.cc,v 1.34 2002/05/30 17:44:03 haldar Exp $ *- * CMU-Monarch project's Mobility extensions ported by Padma Haldar, + * CMU-Monarch project's Mobility extensions ported by Padma Haldar, * 10/98.- */+ */ #include <stdio.h> #include <stdarg.h>@@ -47,6 +78,10 @@ #endif //HAVE_STL #include "node.h" +// P.M. & P.B. modifications+#include <ctype.h>++ static class LinkHeadClass : public TclClass { public: LinkHeadClass() : TclClass("Connector/LinkHead") {}@@ -57,7 +92,7 @@ LinkHead::LinkHead() : net_if_(0), node_(0), type_(0) { } -int32_t LinkHead::label() +int32_t LinkHead::label() { if (net_if_) return net_if_->intf_label();@@ -77,7 +112,7 @@ return TCL_ERROR; return TCL_OK; } else if(strcmp(argv[1], "setnode") == 0) {- node_ = (Node*) TclObject::lookup(argv[2]); + node_ = (Node*) TclObject::lookup(argv[2]); if (node_ == 0) return TCL_ERROR; return TCL_OK;@@ -86,7 +121,7 @@ return (Connector::command(argc, argv)); } -+ static class NodeClass : public TclClass { public: NodeClass() : TclClass("Node") {}@@ -97,12 +132,15 @@ struct node_head Node::nodehead_ = { 0 }; // replaces LIST_INIT macro +// P.M. & P.B. modifications+SLList *Node::list = new SLList();+ char Node::nwrk_[NODE_NAMLOG_BUFSZ]; /* Additions for NixRouting */ int NixRoutingUsed = -1; -Node::Node() : +Node::Node() : address_(-1), nodeid_ (-1), namChan_(0), rtnotif_(NULL), #ifdef HAVE_STL@@ -128,6 +166,11 @@ } #endif //HAVE_STL neighbor_list_ = NULL;++ // P.M. & P.B. modifications+ update_ = 0;+ bind("update_", &update_);+ } Node::~Node()@@ -135,6 +178,43 @@ LIST_REMOVE(this, entry); } +// P.M. & P.B. modifications+double Node::bw_atof(const char* s)+{+ char wrk[32];+ char* cp = wrk;+ while (isdigit(*s) || *s == 'e' || *s == '+' ||+ *s == '-' || *s == '.')+ *cp++ = *s++;+ *cp = 0;+ double v = atof(wrk);+ switch (s[0]) {+ case 'k':+ case 'K':+ v *= 1e3;+ break;+ case 'm':+ case 'M':+ v *= 1e6;+ break;+ case 'g':+ case 'G':+ v *= 1e9;+ break;+ case 't':+ case 'T':+ v *= 1e12;+ break;+ case 'p':+ case 'P':+ v *= 1e15;+ break;+ }+ return (v);+}+++ int Node::command(int argc, const char*const* argv) {@@ -215,7 +295,14 @@ addNeighbor(node); return TCL_OK; }- }+ // P.M. & P.B. modifications+ } else if (argc == 5) {+ if (strcmp(argv[3], "rate_") == 0) {+ int id = nodeid();+ list->AddANode(id, atoi(argv[1]), bw_atof(argv[4]), (char*)argv[2]);+ return TCL_OK;+ }+ } return ParentNode::command(argc,argv); } @@ -225,7 +312,7 @@ else rtnotif_->route_notify(rtm); }-+ void Node::unreg_route_notify(RoutingModule *rtm) { if (rtnotif_) { if (rtnotif_ == rtm) {@@ -264,13 +351,13 @@ neighbor_list_node* nlistItem = (neighbor_list_node *)malloc(sizeof(neighbor_list_node)); nlistItem->nodeid = neighbor->nodeid(); nlistItem->next = neighbor_list_;- neighbor_list_=nlistItem; + neighbor_list_=nlistItem; } void Node::namlog(const char* fmt, ...) { // Don't do anything if we don't have a log file.- if (namChan_ == 0) + if (namChan_ == 0) return; va_list ap; va_start(ap, fmt);@@ -282,9 +369,10 @@ { int n = 0; /* Otherwise nwrk_ isn't initialized */+ n = strlen(nwrk_); if (n >= NODE_NAMLOG_BUFSZ-1) {- fprintf(stderr, + fprintf(stderr, "Node::namdump() exceeds buffer size. Bail out.\n"); abort(); }@@ -300,12 +388,12 @@ } } -// Given an interface label for a NetworkInterface on this node, we return +// Given an interface label for a NetworkInterface on this node, we return // the head of that link NsObject* Node::intf_to_target(int32_t label) { LinkHead *lhp = linklisthead_.lh_first;- for (; lhp; lhp = lhp->nextlinkhead()) + for (; lhp; lhp = lhp->nextlinkhead()) if (label == lhp->label()) return ((NsObject*) lhp); return NULL;diff -ur common/node.h ns-umts-extensions/code/node.h--- common/node.h 2002-05-30 17:44:03.000000000 +0000+++ ns-umts-extensions/code/node.h 2003-06-01 20:10:45.000000000 +0000@@ -1,5 +1,36 @@-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- +/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */++/* Modified and extended by Pablo Martin and Paula Ballester,+ * Strathclyde University, Glasgow.+ * June, 2003.+*/++/* Copyright (c) 2003 Strathclyde University of Glasgow, Scotland.+ * 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 and binary code must contain+ * the above copyright notice, this list of conditions and the following+ * disclaimer.+ *+ * 2. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed at Strathclyde University of+ * Glasgow, Scotland. *+ * 3. The name of the University may not be used to endorse or promote+ * products derived from this software without specific prior written+ * permission.+ * STRATHCLYDE UNIVERSITY OF GLASGOW, MAKES NO REPRESENTATIONS+ * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE+ * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software+ * is provided "as is" without express or implied warranty of any kind.+*/++/* * Copyright (c) 1997-2000 Regents of the University of California. * All rights reserved. *@@ -59,6 +90,8 @@ #include "energy-model.h" #include "location.h" #include "rtmodule.h"+// P.M. & P.B. modifications+#include "wired-flows.h" class NixNode; class LinkHead;@@ -135,7 +168,7 @@ virtual int command(int argc, const char*const* argv); virtual void namlog(const char *fmt, ...); - NsObject* intf_to_target(int32_t); + NsObject* intf_to_target(int32_t); static struct node_head nodehead_; // static head of list of nodes inline void insert(struct node_head* head) {@@ -146,16 +179,16 @@ // The remaining objects handle a (static) linked list of nodes // Used by Tom's satallite code and the wireless code inline const struct if_head& ifhead() const { return ifhead_; }- inline const struct linklist_head& linklisthead() const { - return linklisthead_; + inline const struct linklist_head& linklisthead() const {+ return linklisthead_; }- + //neighbor list maintenance neighbor_list_node* neighbor_list_; void addNeighbor(Node *node);- + static Node* get_node_by_address(nsaddr_t);- + //routines for supporting routing void route_notify (RoutingModule *rtm); void unreg_route_notify(RoutingModule *rtm);@@ -164,6 +197,11 @@ void set_table_size(int nn); void set_table_size(int level, int csize); + // P.M. & P.B. modifications+ static SLList *list;+ inline int update() { return update_;}++ protected: LIST_ENTRY(Node) entry; // declare list entry structure int address_;@@ -171,9 +209,9 @@ // Nam tracing facility Tcl_Channel namChan_;- // Single thread ns, so we can use one global storage for all + // Single thread ns, so we can use one global storage for all // node objects- static char nwrk_[NODE_NAMLOG_BUFSZ]; + static char nwrk_[NODE_NAMLOG_BUFSZ]; void namdump(); struct if_head ifhead_; // list of phys for this node@@ -187,16 +225,21 @@ #endif /* STL */ public:- // XXX Energy related stuff. Should be moved later to a wireless + // XXX Energy related stuff. Should be moved later to a wireless // routing plugin module instead of sitting here. inline EnergyModel* energy_model() { return energy_model_; } inline Location* location() { return location_; } protected: EnergyModel* energy_model_;- // XXX Currently this is a placeholder only. It is supposed to - // hold the position-related stuff in MobileNode. Yet another + // XXX Currently this is a placeholder only. It is supposed to+ // hold the position-related stuff in MobileNode. Yet another // 'Under Construction' sign :( Location* location_;++ // P.M. & P.B. modifications
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -