AccessNet.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
00003 //
00004 // This program is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU General Public License
00006 // as published by the Free Software Foundation; either version 2
00007 // of the License, or (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 //
00018 
00024 #ifndef __ACCESSNET_H__
00025 #define __ACCESSNET_H__
00026 
00027 #include <omnetpp.h>
00028 
00029 #include <InitStages.h>
00030 
00031 class IInterfaceTable;
00032 class InterfaceEntry;
00033 class IRoutingTable;
00034 class IPRoute;
00035 
00039 class NodeInfo
00040 {
00041 public:
00042     uint32 IPAddress; 
00043     cModule* module; 
00044     IInterfaceTable* interfaceTable; 
00045     IRoutingTable* routingTable; 
00046     simtime_t createdAt; 
00047 
00055     friend std::ostream& operator<<(std::ostream& os, NodeInfo& n);
00056 };
00057 
00061 class TerminalInfo : public NodeInfo
00062 {
00063 public:
00064     cModule* PPPInterface; 
00065     cModule* remotePPPInterface; 
00066     InterfaceEntry* interfaceEntry; 
00067     InterfaceEntry* remoteInterfaceEntry; 
00068     IInterfaceTable* remoteInterfaceTable; 
00069     IPRoute* remoteRoutingEntry; 
00070     IPRoute* routingEntry; 
00071 };
00072 
00076 class AccessNet : public cSimpleModule
00077 {
00078 public:
00079 
00085     virtual int size()
00086     {
00087         return overlayTerminal.size();
00088     }
00089 
00095     virtual cModule* getAccessNode()
00096     {
00097         return router.module;
00098     }
00099 
00108     virtual int addOverlayNode(cModule* overlayNode, bool migrate = false);
00109 
00113     int getRandomNodeId();
00114 
00118     virtual cModule* removeOverlayNode(int ID);
00119 
00126     virtual cModule* getOverlayNode(int ID);
00127 
00134     void selectChannel(const std::string& typeRx, const std::string &typeTx)
00135     {
00136         channelTypeRxStr = typeRx;
00137         channelTypeTxStr = typeTx;
00138     }
00139 
00140 protected:
00141 
00142     NodeInfo router; 
00143     std::vector<TerminalInfo> overlayTerminal; 
00144 
00150     virtual int numInitStages() const
00151     {
00152         return MAX_STAGE_UNDERLAY + 1;
00153     }
00154 
00158     virtual void initialize(int stage);
00159 
00165     virtual void handleMessage(cMessage* msg);
00166 
00170     virtual void updateDisplayString();
00171 
00172     uint32_t lastIP; 
00173 
00174     std::vector<std::string> channelTypesRx; 
00175     std::string channelTypeRxStr; 
00176     std::vector<std::string> channelTypesTx; 
00177     std::string channelTypeTxStr; 
00178 
00179     // statistics
00180     cOutVector lifetimeVector; 
00181 };
00182 
00190 cGate* firstUnusedGate(cModule* owner, const char* name, cGate::Type type = cGate::NONE);
00191 
00192 
00193 
00194 #endif
Generated on Wed May 26 16:21:13 2010 for OverSim by  doxygen 1.6.3