OverSim
PeerInfo.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 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 
25 #ifndef __PEERINFO_H__
26 #define __PEERINFO_H__
27 
28 #include <sstream>
29 
30 #include <omnetpp.h>
31 
32 class PeerInfo;
33 class BaseOverlay;
34 
39 class PeerInfo
40 {
41  friend class PeerStorage;
42 public:
46  PeerInfo(uint32_t type, int moduleId, cObject** context);
47 
48 
49  virtual ~PeerInfo() {};
50 
56  int getModuleID() { return moduleId; };
57 
63  int8_t getNpsLayer() { return npsLayer; };
64 
68  void setNpsLayer(int8_t layer) { npsLayer = layer; }
69 
75  uint32_t getTypeID() { return type; };
76 
82  bool isPreKilled() { return preKilled; };
83 
89  void setPreKilled(bool killed = true) { preKilled = killed; };
90 
96  bool isMalicious() { return malicious; };
97 
98  cObject** getContext() { return context; };
99 
100 
109  friend std::ostream& operator<<(std::ostream& os, const PeerInfo info);
110 
111 private:
112  virtual void dummy();
119  void setMalicious(bool malic = true) { malicious = malic; };
120 
121  bool malicious;
122  bool preKilled;
123  int moduleId;
124  uint32_t type;
125  int8_t npsLayer;
126  cObject** context;
127 };
128 
129 #endif