OverSim
BootstrapNodeHandle.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2008 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
24 #ifndef __BOOTSTRAP_NODE_HANDLE_H
25 #define __BOOTSTRAP_NODE_HANDLE_H
26 
28  DNSSD = 0,
29  MDNS = 1,
30  CACHE = 2,
31 };
32 
34 
35 private:
36  BootstrapNodePrioType nodePrio; //1: uDNS, 2: mDNS, 3: saved nodes from last run
37  simtime_t lastPing;
38 
39 public:
41  {
42  /* lowest priority */
43  nodePrio = CACHE;
44  }
45 
47  {
48  nodePrio = handle.nodePrio;
49  }
50 
53  {
54  this->ip = handle.getIp();
55  this->port = handle.getPort();
56  this->key = handle.getKey();
57  nodePrio = prio;
58  }
59 
61  const IPvXAddress &ip,
62  int port,
64  : NodeHandle(key, ip, port) {
65  nodePrio = prio;
66  }
67 
69  return nodePrio;
70  }
71 
73  this->nodePrio = nodePrio;
74  }
75 
76  inline simtime_t getLastPing() const {
77  return lastPing;
78  }
79 
80  inline void setLastPing(simtime_t lastPing) {
81  this->lastPing = lastPing;
82  }
83 };
84 #endif