OverSim
DiscoveryMode.h
Go to the documentation of this file.
1 /*
2  * DiscoveryMode.h
3  *
4  * Created on: Sep 27, 2010
5  * Author: heep
6  */
7 
8 #ifndef DISCOVERYMODE_H_
9 #define DISCOVERYMODE_H_
10 
11 #include <RpcListener.h>
12 #include <NeighborCache.h>
13 #include <DiscoveryMode_m.h>
14 
15 class BasePastry;
16 
18 {
19  private:
21 
22  uint8_t numCloseNodes;
24 
25  double firstRtt;
26  double improvement;
27 
28  bool finished;
29 
31 
32  protected:
33  int16_t step;
34  uint8_t maxSteps;
35  int8_t spreadedSteps;
36  uint8_t queries;
37  int8_t maxIndex;
38  simtime_t nearNodeRtt;
41 
42  void proxCallback(const TransportAddress& node, int rpcId,
43  cPolymorphic *contextPointer, Prox prox);
44 
45  void sendNewRequest(DiscoveryNodesType type, uint8_t numNodes);
46 
47  public:
48  virtual ~DiscoveryMode() {};
49 
51  void start(const TransportAddress& bootstrapNode);
52  void stop();
53 
54  double getImprovement() { return improvement; };
55  bool isFinished() { return finished; };
56 
57  bool handleRpcCall(BaseCallMessage* msg);
58 
60  cPolymorphic* context,
61  int rpcId, simtime_t rtt);
62 
64  const TransportAddress& dest,
65  cPolymorphic* context, int rpcId,
66  const OverlayKey& destKey);
67 };
68 
69 #endif /* DISCOVERYMODE_H_ */