• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/common/parentnode.h

00001 // -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*-
00002 //
00003 // Time-stamp: <2000-09-15 12:52:53 haoboy>
00004 //
00005 
00006 /*
00007  * parentnode.h
00008  * Copyright (C) 2000 by the University of Southern California
00009  * $Id: parentnode.h,v 1.4 2005/08/25 18:58:02 johnh Exp $
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License,
00013  * version 2, as published by the Free Software Foundation.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00023  *
00024  *
00025  * The copyright of this module includes the following
00026  * linking-with-specific-other-licenses addition:
00027  *
00028  * In addition, as a special exception, the copyright holders of
00029  * this module give you permission to combine (via static or
00030  * dynamic linking) this module with free software programs or
00031  * libraries that are released under the GNU LGPL and with code
00032  * included in the standard release of ns-2 under the Apache 2.0
00033  * license or under otherwise-compatible licenses with advertising
00034  * requirements (or modified versions of such code, with unchanged
00035  * license).  You may copy and distribute such a system following the
00036  * terms of the GNU GPL for this module and the licenses of the
00037  * other code concerned, provided that you include the source code of
00038  * that other code when and as the GNU GPL requires distribution of
00039  * source code.
00040  *
00041  * Note that people who make modified versions of this module
00042  * are not obligated to grant this special exception for their
00043  * modified versions; it is their choice whether to do so.  The GNU
00044  * General Public License gives permission to release a modified
00045  * version without this exception; this exception also makes it
00046  * possible to release a modified version which carries forward this
00047  * exception.
00048  *
00049  */
00050 
00051 #ifndef ns_parentnode_h
00052 #define ns_parentnode_h
00053 
00054 #include "address.h"
00055 #include "classifier-addr.h"
00056 #include "rtmodule.h"
00057 
00058 class NsObject;
00059 
00060 /* Class ParentNode : from which all node types including Node, LanNode etc evolve */
00061 
00062 class ParentNode : public TclObject {
00063 public:
00064         ParentNode() : nodeid_(-1), address_(-1) {} 
00065         /*virtual int command(int argc, const char*const* argv) {}*/
00066         virtual inline int address() { return address_;}
00067         virtual inline int nodeid() { return nodeid_;}
00068         virtual void add_route (char *, NsObject *) {}
00069         virtual void delete_route (char *, NsObject *) {}
00070         virtual void set_table_size(int nn) {}
00071         virtual void set_table_size(int lev, int nn) {}
00072 protected:
00073   int nodeid_;
00074   int address_;
00075 };
00076 
00077 
00078 /* LanNode: Lan implementation as a virtual node: 
00079    LanNode mimics a real
00080    node and uses an address (id) from Node's address space */
00081 
00082 class LanNode : public ParentNode {
00083 public:
00084   LanNode() : ParentNode() {} 
00085   virtual int command(int argc, const char*const* argv);
00086 };
00087 
00088 
00089 /* AbsLanNode:
00090    It create an abstract LAN.
00091    An abstract lan is one in which the complex CSMA/CD 
00092    contention mechanism is replaced by a simple DropTail 
00093    queue mechanism. */
00094 
00095 class AbsLanNode : public ParentNode {
00096 public:
00097   AbsLanNode() : ParentNode() {} 
00098   virtual int command(int argc, const char*const* argv);
00099 };
00100 
00101 
00102 /* Node/Broadcast: used for sun's implementation of MIP;
00103    why is this version of MIP used when (CMU's) wireless 
00104    version is also available?? doesn't make sense to have both;
00105 */
00106 
00107 class BroadcastNode : public ParentNode {
00108 public:
00109         BroadcastNode() : ParentNode(), classifier_(NULL) {}
00110         virtual int command(int argc, const char*const* argv);
00111         virtual void add_route (char *dst, NsObject *target);
00112         virtual void delete_route (char *dst, NsObject *nullagent);
00113         //virtual void set_table_size(int nn) {}
00114         //virtual void set_table_size(int lev, int nn) {}
00115 private:
00116   BcastAddressClassifier *classifier_;
00117 };
00118   
00119 #endif /* ---ns_lannode_h */
00120 

Generated on Tue Aug 10 2010 16:16:06 for ns-2.33 by  doxygen 1.7.1