BootstrapNodeHandle.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2008 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 __BOOTSTRAP_NODE_HANDLE_H
00025 #define __BOOTSTRAP_NODE_HANDLE_H
00026 
00027 enum  BootstrapNodePrioType{
00028     DNSSD = 0,
00029     MDNS = 1,
00030     CACHE = 2,
00031 };
00032 
00033 class BootstrapNodeHandle : public NodeHandle {
00034 
00035 private:
00036     BootstrapNodePrioType nodePrio; //1: uDNS, 2: mDNS, 3: saved nodes from last run
00037     simtime_t lastPing;
00038 
00039 public:
00040     BootstrapNodeHandle() : NodeHandle()
00041     {
00042         /* lowest priority */
00043         nodePrio = CACHE;
00044     }
00045 
00046     BootstrapNodeHandle(const BootstrapNodeHandle &handle) : NodeHandle(handle)
00047     {
00048         nodePrio = handle.nodePrio;
00049     }
00050 
00051     BootstrapNodeHandle(const NodeHandle &handle,
00052                         BootstrapNodePrioType prio = CACHE)
00053     {
00054         this->ip = handle.getAddress();
00055         this->port = handle.getPort();
00056         this->key = handle.getKey();
00057         nodePrio = prio;
00058     }
00059 
00060     BootstrapNodeHandle(const OverlayKey &key,
00061                         const IPvXAddress &ip,
00062                         int port,
00063                         BootstrapNodePrioType prio = CACHE)
00064                         : NodeHandle(key, ip, port)   {
00065         nodePrio = prio;
00066     }
00067 
00068     inline BootstrapNodePrioType getNodePrio() const {
00069         return nodePrio;
00070     }
00071 
00072     inline void setNodePrio(BootstrapNodePrioType nodePrio) {
00073         this->nodePrio = nodePrio;
00074     }
00075 
00076     inline simtime_t getLastPing() const {
00077         return lastPing;
00078     }
00079 
00080     inline void setLastPing(simtime_t lastPing) {
00081         this->lastPing = lastPing;
00082     }
00083 };
00084 #endif
Generated on Wed May 26 16:21:13 2010 for OverSim by  doxygen 1.6.3