OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
CBR-DHT.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2007 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 __CBRDHT_H_
25
#define __CBRDHT_H_
26
27
#include <omnetpp.h>
28
29
#include <
OverlayKey.h
>
30
#include <
SHA1.h
>
31
#include <
CommonMessages_m.h
>
32
33
#include "
CBR-DHTMessage_m.h
"
34
#include "
DHTMessage_m.h
"
35
#include "
DHTDataStorage.h
"
36
37
#include "
BaseApp.h
"
38
#include <
RpcMacros.h
>
39
40
class
CoordBasedRouting
;
41
class
NeighborCache
;
42
48
class
CBRDHT
:
public
BaseApp
49
{
50
public
:
51
CBRDHT
();
52
virtual
~CBRDHT
();
53
54
protected
:
55
typedef
std::vector<NodeHandle>
ReplicaVector
;
56
57
struct
GetMapEntry
58
{
59
ReplicaVector
replica
;
60
std::map<BinaryValue, ReplicaVector>
hashes
;
61
int
numSent
;
62
int
numAvailableReplica
;
63
int
numResponses
;
64
int
teamNumber
;
65
DHTgetCAPICall
*
callMsg
;
66
ReplicaVector
*
hashVector
;
67
};
68
69
struct
PutMapEntry
70
{
71
int
numSent
;
72
int
numFailed
;
73
int
numResponses
;
74
DHTputCAPICall
*
callMsg
;
75
};
76
77
void
initializeApp
(
int
stage);
78
void
finishApp
();
79
void
handleTimerEvent
(cMessage* msg);
80
81
bool
handleRpcCall
(
BaseCallMessage
* msg);
82
void
handleRpcResponse
(
BaseResponseMessage
* msg, cPolymorphic *context,
83
int
rpcId, simtime_t rtt);
84
void
handleRpcTimeout
(
BaseCallMessage
* msg,
const
TransportAddress
& dest,
85
cPolymorphic* context,
int
rpcId,
86
const
OverlayKey
& destKey);
87
void
handleUpperMessage
(cMessage* msg);
88
void
handlePutRequest
(
DHTPutCall
* dhtMsg);
89
void
handleGetRequest
(
CBRDHTGetCall
* dhtMsg);
90
void
handlePutResponse
(
DHTPutResponse
* dhtMsg,
int
rpcId);
91
void
handleGetResponse
(
CBRDHTGetResponse
* dhtMsg,
int
rpcId);
92
void
handlePutCAPIRequest
(
DHTputCAPICall
* capiPutMsg);
93
void
handleGetCAPIRequest
(
DHTgetCAPICall
* capiGetMsg,
int
teamnum = 0);
94
95
void
handleDumpDhtRequest
(
DHTdumpCall
* call);
96
void
update
(
const
NodeHandle
& node,
bool
joined);
97
void
handleLookupResponse
(
LookupResponse
* lookupMsg);
98
99
int
resultValuesBitLength
(
DHTGetResponse
* msg);
100
101
102
int
numReplica
;
103
uint8_t
numReplicaTeams
;
104
105
double
maintenanceMessages
;
106
double
normalMessages
;
107
double
numBytesMaintenance
;
108
double
numBytesNormal
;
109
double
lastGetCall
;
110
std::map<unsigned int, BaseCallMessage*>
rpcIdMap
;
111
std::map<int, GetMapEntry>
getMap
;
112
std::map<int, PutMapEntry>
putMap
;
113
114
// module references
115
DHTDataStorage
*
dataStorage
;
116
CoordBasedRouting
*
coordBasedRouting
;
117
NeighborCache
*
neighborCache
;
118
};
119
120
#endif
src
common
cbr
CBR-DHT.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2