BootstrapList.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00025 #ifndef __BOOTSTRAPLIST_H_
00026 #define __BOOTSTRAPLIST_H_
00027
00028 #include <omnetpp.h>
00029 #include <BaseApp.h>
00030 #include <BootstrapNodeHandle.h>
00031 #include <NodeVector.h>
00032 #include <oversim_mapset.h>
00033
00034 class BaseOverlay;
00035 class ZeroconfConnector;
00036
00037 typedef std::pair<TransportAddress, BootstrapNodeHandle*> NodePair;
00038
00039 typedef UNORDERED_MAP<TransportAddress, BootstrapNodeHandle*,
00040 TransportAddress::hashFcn> BootstrapNodeSet;
00041
00053 class BootstrapList : public BaseApp
00054 {
00055
00056 public:
00057 BootstrapList();
00058 ~BootstrapList();
00059
00065 const TransportAddress getBootstrapNode();
00066
00072 void locateBootstrapNode(const NodeHandle& node);
00073
00081 bool insertBootstrapCandidate(const NodeHandle& node,
00082 BootstrapNodePrioType prio = DNSSD);
00083
00084 bool insertBootstrapCandidate(BootstrapNodeHandle& node);
00085
00091 void removeBootstrapCandidate(const TransportAddress &addr);
00092
00093 void removeBootstrapNode(const NodeHandle& node);
00094
00095 void registerBootstrapNode(const NodeHandle& node);
00096
00097 protected:
00098
00099 virtual void pingResponse(PingResponse* pingResponse,
00100 cPolymorphic* context, int rpcId,
00101 simtime_t rtt);
00102
00103
00104 virtual void pingTimeout(PingCall* pingCall,
00105 const TransportAddress& dest,
00106 cPolymorphic* context,
00107 int rpcId);
00108
00109
00110 virtual CompType getThisCompType() { return BOOTSTRAPLIST_COMP; };
00111
00112 private:
00113 BootstrapNodeSet bootstrapList;
00114
00115
00116 virtual void initializeApp(int stage);
00117
00118
00119 virtual void finishApp();
00120
00121
00122 void handleTimerEvent(cMessage *msg);
00123
00127 void handleBootstrapListTimerExpired();
00128
00129
00130 void handleRpcResponse(BaseResponseMessage* msg,
00131 cPolymorphic* context, int rpcId,
00132 simtime_t rtt);
00133
00140 void handleLookupResponse(LookupResponse* msg);
00141
00142 static const int timerInterval = 10;
00144 cMessage* timerMsg;
00145 ZeroconfConnector* zeroconfConnector;
00146 bool mergeOverlayPartitions;
00147 bool maintainList;
00148 };
00149
00150 #endif