|
OverSim
|
Kademlia overlay module. More...
#include <Kademlia.h>
Public Member Functions | |
| Kademlia () | |
| ~Kademlia () | |
| void | initializeOverlay (int stage) |
| Initializes derived-class-attributes. | |
| void | finishOverlay () |
| collects statistical data in derived class | |
| void | joinOverlay () |
| Join the overlay with a given nodeID in thisNode.key. | |
| bool | isSiblingFor (const NodeHandle &node, const OverlayKey &key, int numSiblings, bool *err) |
| Query if a node is among the siblings for a given key. | |
| int | getMaxNumSiblings () |
| Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay protocol. | |
| int | getMaxNumRedundantNodes () |
| Query the maximum number of redundant next hop nodes that are returned by findNode(). | |
| void | handleTimerEvent (cMessage *msg) |
| bool | handleRpcCall (BaseCallMessage *msg) |
| Processes Remote-Procedure-Call invocation messages. | |
| void | handleUDPMessage (BaseOverlayMessage *msg) |
| Processes messages from underlay. | |
| virtual void | proxCallback (const TransportAddress &node, int rpcId, cPolymorphic *contextPointer, Prox prox) |
Public Member Functions inherited from BaseOverlay | |
| BaseOverlay () | |
| virtual | ~BaseOverlay () |
| Virtual destructor. | |
| States | getState () |
| bool | isMalicious () |
| Returns true, if node is malicious. | |
| bool | isInSimpleMultiOverlayHost () |
| Returns true if overlay is one in an array, inside a SimpleMultiOverlayHost. | |
| const simtime_t & | getCreationTime () |
| void | join (const OverlayKey &nodeID=OverlayKey::UNSPECIFIED_KEY) |
| Join the overlay with a given nodeID. | |
| virtual NodeVector * | local_lookup (const OverlayKey &key, int num, bool safe) |
| finds nodes closest to the given OverlayKey | |
| virtual NodeVector * | neighborSet (int num) |
| void | sendMessageToUDP (const TransportAddress &dest, cPacket *msg, simtime_t delay=SIMTIME_ZERO) |
| Sends message to underlay. | |
| void | sendToKey (const OverlayKey &key, BaseOverlayMessage *message, int numSiblings=1, const std::vector< TransportAddress > &sourceRoute=TransportAddress::UNSPECIFIED_NODES, RoutingType routingType=DEFAULT_ROUTING) |
| Sends a message to an overlay node, with the generic routing algorithm. | |
| void | registerComp (CompType compType, cModule *module) |
| cModule * | getCompModule (CompType compType) |
| cGate * | getCompRpcGate (CompType compType) |
| void | sendMessageToAllComp (cMessage *msg, CompType srcComp) |
| bool | providesKbr () |
| virtual uint8_t | getBitsPerDigit () |
| bool | getMeasureAuthBlock () |
| BootstrapList & | getBootstrapList () const |
| virtual OverlayKey | estimateMeanDistance () |
| returns mean distance between OverlayKeys in the network | |
| virtual uint32_t | estimateOverlaySize () |
| estimates the current number of nodes online | |
Public Member Functions inherited from BaseRpc | |
| BaseRpc () | |
| const NodeHandle & | getThisNode () |
| Returns the NodeHandle of this node. | |
| simtime_t | getUdpTimeout () |
Public Member Functions inherited from RpcListener | |
| virtual | ~RpcListener () |
| destructor | |
Public Member Functions inherited from BaseTcpSupport | |
| virtual void | socketDataArrived (int connId, void *yourPtr, cPacket *msg, bool urgent) |
| virtual void | socketEstablished (int connId, void *yourPtr) |
| virtual void | socketPeerClosed (int connId, void *yourPtr) |
| virtual void | socketFailure (int connId, void *yourPtr, int code) |
| virtual void | socketStatusArrived (int connId, void *yourPtr, TCPStatusInfo *status) |
Public Member Functions inherited from TopologyVis | |
| TopologyVis () | |
| void | showOverlayNeighborArrow (const NodeHandle &neighbor, bool flush=true, const char *displayString=NULL) |
| Draws an arrow from this node to neighbor. | |
| void | deleteOverlayNeighborArrow (const NodeHandle &neighbor) |
| Removes an arrow from this node to neighbor. | |
Protected Member Functions | |
| NodeVector * | findNode (const OverlayKey &key, int numRedundantNodes, int numSiblings, BaseOverlayMessage *msg) |
| Implements the find node call. | |
| void | handleRpcResponse (BaseResponseMessage *msg, cPolymorphic *context, int rpcId, simtime_t rtt) |
| This method is called if an RPC response has been received. | |
| void | handleRpcTimeout (BaseCallMessage *msg, const TransportAddress &dest, cPolymorphic *context, int rpcId, const OverlayKey &destKey) |
| This method is called if an RPC timeout has been reached. | |
| void | handleBucketRefreshTimerExpired () |
| handle a expired bucket refresh timer | |
| OverlayKey | distance (const OverlayKey &x, const OverlayKey &y, bool useAlternative=false) const |
| This method should implement the distance between two keys. | |
| void | updateTooltip () |
| updates information shown in GUI | |
| virtual void | lookupFinished (bool isValid) |
| virtual void | handleNodeGracefulLeaveNotification () |
| This method gets call **.gracefulLeaveDelay seconds before it is killed if this node is among the gracefulLeaveProbability nodes. | |
Protected Member Functions inherited from BaseOverlay | |
| int | numInitStages () const |
| Sets init stage. | |
| void | bindToPort (int port) |
| Tells UDP we want to get all packets arriving on the given port. | |
| virtual void | route (const OverlayKey &key, CompType destComp, CompType srcComp, cPacket *msg, const std::vector< TransportAddress > &sourceRoute=TransportAddress::UNSPECIFIED_NODES, RoutingType routingType=DEFAULT_ROUTING) |
| Routes message through overlay. | |
| void | callDeliver (BaseOverlayMessage *msg, const OverlayKey &destKey) |
| Calls deliver function in application. | |
| void | callForward (const OverlayKey &key, BaseRouteMessage *msg, const NodeHandle &nextHopNode) |
| Calls forward function in application. | |
| void | callUpdate (const NodeHandle &node, bool joined) |
| Informs application about state changes of nodes or newly joined nodes. | |
| void | handleMessage (cMessage *msg) |
| Checks for message type and calls corresponding method. | |
| void | handleBaseOverlayMessage (BaseOverlayMessage *msg, const OverlayKey &destKey=OverlayKey::UNSPECIFIED_KEY) |
| Handles a BaseOverlayMessage | |
| virtual void | handleAppMessage (cMessage *msg) |
| Processes "timer" self-messages. | |
| virtual void | receiveChangeNotification (int category, const cPolymorphic *details) |
| callback-method for events at the NotificationBoard | |
| virtual void | handleTransportAddressChangedNotification () |
| This method gets call if the node has a new TransportAddress (IP address) because he changed his access network. | |
| virtual void | handleNodeLeaveNotification () |
| This method gets call **.gracefulLeaveDelay seconds before it is killed. | |
| virtual void | recordOverlaySentStats (BaseOverlayMessage *msg) |
| Collect overlay specific sent messages statistics. | |
| void | setOverlayReady (bool ready) |
| Sets the overlay ready icon and register/deregisters the node at the GlobalNodeList. | |
| virtual AbstractLookup * | createLookup (RoutingType routingType=DEFAULT_ROUTING, const BaseOverlayMessage *msg=NULL, const cPacket *findNodeExt=NULL, bool appLookup=false) |
| Creates an abstract iterative lookup instance. | |
| virtual void | removeLookup (AbstractLookup *lookup) |
| Removes the abstract lookup instance. | |
| virtual void | joinForeignPartition (const NodeHandle &node) |
| Join another overlay partition with the given node as bootstrap node. | |
| virtual bool | handleFailedNode (const TransportAddress &failed) |
| Handles a failed node. | |
| virtual void | lookupRpc (LookupCall *call) |
| virtual void | nextHopRpc (NextHopCall *call) |
| void | countFindNodeCall (const FindNodeCall *call) |
| void | countFailedNodeCall (const FailedNodeCall *call) |
| bool | internalHandleRpcCall (BaseCallMessage *msg) |
| Handles internal rpc requests. | |
| void | internalHandleRpcResponse (BaseResponseMessage *msg, cPolymorphic *context, int rpcId, simtime_t rtt) |
| Handles rpc responses internal in base classes | |
| void | internalHandleRpcTimeout (BaseCallMessage *msg, const TransportAddress &dest, cPolymorphic *context, int rpcId, const OverlayKey &destKey) |
| Handles rpc timeouts internal in base classes | |
| void | internalSendRouteRpc (BaseRpcMessage *message, const OverlayKey &destKey, const std::vector< TransportAddress > &sourceRoute, RoutingType routingType) |
| CompType | getThisCompType () |
| Return the component type of this module. | |
Protected Member Functions inherited from BaseRpc | |
| void | initRpcs () |
| Initializes Remote-Procedure state. | |
| void | finishRpcs () |
| Deinitializes Remote-Procedure state. | |
| virtual void | internalHandleRpcMessage (BaseRpcMessage *msg) |
| Handles incoming rpc messages and delegates them to the corresponding listeners or handlers. | |
| uint32_t | sendRouteRpcCall (CompType destComp, const TransportAddress &dest, const OverlayKey &destKey, BaseCallMessage *msg, cPolymorphic *context=NULL, RoutingType routingType=DEFAULT_ROUTING, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL) |
| Routes a Remote-Procedure-Call message to an OverlayKey. | |
| uint32_t | sendRouteRpcCall (CompType destComp, const OverlayKey &destKey, BaseCallMessage *msg, cPolymorphic *context=NULL, RoutingType routingType=DEFAULT_ROUTING, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL) |
| Routes a Remote-Procedure-Call message to an OverlayKey. | |
| uint32_t | sendRouteRpcCall (CompType destComp, const TransportAddress &dest, BaseCallMessage *msg, cPolymorphic *context=NULL, RoutingType routingType=DEFAULT_ROUTING, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL) |
| Sends a Remote-Procedure-Call message using the overlay's UDP port This replaces ROUTE_DIRECT calls! | |
| uint32_t | sendUdpRpcCall (const TransportAddress &dest, BaseCallMessage *msg, cPolymorphic *context=NULL, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL) |
| Sends a Remote-Procedure-Call message to the underlay | |
| uint32_t | sendInternalRpcCall (CompType destComp, BaseCallMessage *msg, cPolymorphic *context=NULL, simtime_t timeout=-1, int retries=0, int rpcId=-1, RpcListener *rpcListener=NULL) |
| Sends an internal Remote-Procedure-Call between two tiers | |
| void | cancelRpcMessage (uint32_t nonce) |
| Cancels a Remote-Procedure-Call. | |
| void | cancelAllRpcs () |
| Cancels all RPCs. | |
| void | sendRpcResponse (TransportType transportType, CompType destComp, const TransportAddress &dest, const OverlayKey &destKey, BaseCallMessage *call, BaseResponseMessage *response) |
| Send Remote-Procedure response message and deletes call message. | |
| void | sendRpcResponse (BaseCallMessage *call, BaseResponseMessage *response) |
| Send Remote-Procedure response message to UDP and deletes call message. | |
| int | pingNode (const TransportAddress &dest, simtime_t timeout=-1, int retries=0, cPolymorphic *context=NULL, const char *caption="PING", RpcListener *rpcListener=NULL, int rpcId=-1, TransportType transportType=INVALID_TRANSPORT) |
| ping a node by its TransportAddress | |
| virtual void | pingResponse (PingResponse *pingResponse, cPolymorphic *context, int rpcId, simtime_t rtt) |
| virtual void | pingTimeout (PingCall *pingCall, const TransportAddress &dest, cPolymorphic *context, int rpcId) |
| bool | internalHandleMessage (cMessage *msg) |
Protected Member Functions inherited from RpcListener | |
| virtual void | handleRpcResponse (BaseResponseMessage *msg, const RpcState &rpcState, simtime_t rtt) |
| This method is called if an RPC response has been received. | |
| virtual void | handleRpcTimeout (const RpcState &rpcState) |
| This method is called if an RPC timeout has been reached. | |
Protected Member Functions inherited from BaseTcpSupport | |
| void | handleTCPMessage (cMessage *msg) |
| Member function to handle incoming TCP messages. | |
| void | bindAndListenTcp (int port) |
| Member function to bind service to the specified port and listen afterwards. | |
| bool | isAlreadyConnected (TransportAddress address) |
| Member function to check if the service is already connected. | |
| void | establishTcpConnection (TransportAddress address) |
| Member function to establish a connection to the specified node. | |
| void | sendTcpData (cPacket *msg, TransportAddress address) |
| Member function to send TCP data to the specified node. | |
| virtual void | handleConnectionEvent (EvCode code, TransportAddress address) |
| Member function to handle passive connection events. | |
| virtual void | handleDataReceived (TransportAddress address, cPacket *msg, bool urgent) |
| Member function to handle incoming data. | |
| virtual void | handleIncomingConnection (TransportAddress address) |
| Member function to handle newly opened connections. | |
| void | closeTcpConnection (TransportAddress address) |
| Member function to close an established connection. | |
| void | setTcpOut (cGate *gate) |
| Member function to set local gate towards the TCP module during init phase. | |
| cGate * | getTcpOut () |
| Member function to get local gate towards the TCP module. | |
Protected Member Functions inherited from TopologyVis | |
| void | initVis (cModule *terminal) |
Protected Attributes | |
| uint32_t | k |
| uint32_t | b |
| uint32_t | s |
| uint32_t | maxStaleCount |
| bool | exhaustiveRefresh |
| bool | pingNewSiblings |
| bool | secureMaintenance |
| if true, ping not authenticated nodes before adding them to a bucket | |
| bool | newMaintenance |
| bool | enableReplacementCache |
| bool | replacementCachePing |
| uint | replacementCandidates |
| int | siblingRefreshNodes |
| int | bucketRefreshNodes |
| bool | activePing |
| bool | proximityRouting |
| bool | proximityNeighborSelection |
| bool | altRecMode |
| simtime_t | minSiblingTableRefreshInterval |
| simtime_t | minBucketRefreshInterval |
| simtime_t | siblingPingInterval |
| cMessage * | bucketRefreshTimer |
| cMessage * | siblingPingTimer |
Protected Attributes inherited from BaseOverlay | |
| int | numAppDataForwarded |
| number of forwarded app data packets | |
| int | bytesAppDataForwarded |
| number of forwarded app data bytes at out-gate | |
| int | numAppLookupForwarded |
| number of forwarded app lookup packets | |
| int | bytesAppLookupForwarded |
| number of forwarded app lookup bytes at out-gate | |
| int | numMaintenanceForwarded |
| number of forwarded maintenance packets | |
| int | bytesMaintenanceForwarded |
| number of forwarded maintenance bytes at out-gate | |
| int | numFindNodeSent |
| int | bytesFindNodeSent |
| int | numFindNodeResponseSent |
| int | bytesFindNodeResponseSent |
| int | numFailedNodeSent |
| int | bytesFailedNodeSent |
| int | numFailedNodeResponseSent |
| int | bytesFailedNodeResponseSent |
| std::vector< HopDelayRecord * > | singleHopDelays |
| simtime_t | creationTime |
| simtime when the node has been created | |
| GlobalNodeList * | globalNodeList |
| pointer to GlobalNodeList in this node | |
| NotificationBoard * | notificationBoard |
| pointer to NotificationBoard in this node | |
| UnderlayConfigurator * | underlayConfigurator |
| pointer to UnderlayConfigurator in this node | |
| BootstrapList * | bootstrapList |
| pointer to the BootstrapList module | |
| GlobalParameters * | globalParameters |
| pointer to the GlobalParameters module | |
| uint32_t | overlayId |
| identifies the overlay this node belongs to (used for multiple overlays) | |
| bool | debugOutput |
| debug output ? | |
| RoutingType | defaultRoutingType |
| bool | useCommonAPIforward |
| forward messages to applications? | |
| bool | collectPerHopDelay |
| collect delay for single hops | |
| bool | routeMsgAcks |
| send ACK when receiving route message | |
| uint32_t | recNumRedundantNodes |
| numRedundantNodes for recursive routing | |
| bool | recordRoute |
| record visited hops on route | |
| bool | drawOverlayTopology |
| bool | rejoinOnFailure |
| bool | sendRpcResponseToLastHop |
| needed by KBR protocols for NAT support | |
| bool | dropFindNodeAttack |
| if node is malicious, it tries a findNode attack | |
| bool | isSiblingAttack |
| if node is malicious, it tries a isSibling attack | |
| bool | invalidNodesAttack |
| if node is malicious, it tries a invalidNode attack | |
| bool | dropRouteMessageAttack |
| if node is malicious, it drops all received BaseRouteMessages | |
| int | localPort |
| used UDP-port | |
| int | hopCountMax |
| maximum hop count | |
| bool | measureAuthBlock |
| if true, measure the overhead of signatures in rpc messages | |
| bool | restoreContext |
| if true, a node rejoins with its old nodeId and malicious state | |
| int | numDropped |
| number of dropped packets | |
| int | bytesDropped |
| number of dropped bytes | |
| cOutVector | delayVector |
| statistical output vector for packet-delays | |
| cOutVector | hopCountVector |
| statistical output vector for hop-counts | |
| States | state |
| IterativeLookupConfiguration | iterativeLookupConfig |
| RecursiveLookupConfiguration | recursiveLookupConfig |
| LookupSet | lookups |
| bool | kbr |
| set this to true, if the overlay provides KBR services | |
Protected Attributes inherited from BaseRpc | |
| NodeHandle | thisNode |
| NodeHandle to this node. | |
| BaseOverlay * | overlay |
| bool | debugOutput |
| debug output ? | |
| GlobalStatistics * | globalStatistics |
| pointer to GlobalStatistics module in this node | |
| CompType | thisCompType |
| NeighborCache * | neighborCache |
| pointer to the neighbor cache | |
| CryptoModule * | cryptoModule |
| pointer to CryptoModule | |
| int | numPingSent |
| int | bytesPingSent |
| int | numPingResponseSent |
| int | bytesPingResponseSent |
Protected Attributes inherited from TopologyVis | |
| cModule * | thisTerminal |
| GlobalNodeList * | globalNodeList |
| pointer to corresponding node | |
Private Member Functions | |
| void | routingInit () |
| void | routingDeinit () |
| int | routingBucketIndex (const OverlayKey &key, bool firstOnLayer=false) |
| Returns the index of the bucket the key would reside with respect to Kademlia parameters. | |
| KademliaBucket * | routingBucket (const OverlayKey &key, bool ensure) |
Returns a Bucket or NULL if the bucket has not yet allocated. | |
| bool | routingAdd (const NodeHandle &handle, bool isAlive, simtime_t rtt=MAXTIME, bool maintenanceLookup=false) |
| Adds a node to the routing table. | |
| bool | routingTimeout (const OverlayKey &key, bool immediately=false) |
| Removes a node after a number of timeouts or immediately if immediately is true (behaves like routingRemove). | |
| void | refillSiblingTable () |
| void | sendSiblingFindNodeCall (const TransportAddress &dest) |
| void | setBucketUsage (const OverlayKey &key) |
| bool | recursiveRoutingHook (const TransportAddress &dest, BaseRouteMessage *msg) |
| bool | handleFailedNode (const TransportAddress &failed) |
Private Attributes | |
| uint32_t | bucketRefreshCount |
| uint32_t | siblingTableRefreshCount |
| uint32_t | nodesReplaced |
| KeyDistanceComparator < KeyXorMetric > * | comparator |
| KademliaBucket * | siblingTable |
| std::vector< KademliaBucket * > | routingTable |
| int | numBuckets |
Friends | |
| class | KademliaLookupListener |
Additional Inherited Members | |
Public Types inherited from BaseOverlay | |
| enum | States { INIT = 0, BOOTSTRAP = 1, DISCOVERY = 2, PREJOIN = 3, JOIN = 4, POSTJOIN = 5, READY = 6, REFRESH = 7, SHUTDOWN = 8, FAILED = 9, RSET = JOIN, BSET = POSTJOIN } |
Protected Types inherited from BaseOverlay | |
| typedef UNORDERED_SET < AbstractLookup *, lookupHashFcn, lookupHashFcn > | LookupSet |
Kademlia overlay module.
This class implements the Kademlia protocol described in P. Maymounkov and D. Mazières, "Kademlia: A Peer-to-Peer Information System Based on the XOR Metric", Lecture Notes in Computer Science, Peer-to-Peer Systems: First International Workshop (IPTPS 2002). Revised Papers, 2002, 2429/2002, 53-65
The recursive routing mode (R/Kademlia) is described in B. Heep, "R/Kademlia: Recursive and Topology-aware Overlay Routing", Proceedings of the Australasian Telecommunication Networks and Applications Conference 2010 (ATNAC 2010), Auckland, New Zealand, 2010
The security extensions (S/Kademlia) are described in I. Baumgart and S. Mies, "S/Kademlia: A Practicable Approach Towards Secure Key-Based Routing", Proceedings of the 13th International Conference on Parallel and Distributed Systems (ICPADS '07), Hsinchu, Taiwan, 2007
Definition at line 61 of file Kademlia.h.
| Kademlia::Kademlia | ( | ) |
Definition at line 162 of file Kademlia.cc.
| Kademlia::~Kademlia | ( | ) |
Definition at line 170 of file Kademlia.cc.
|
protectedvirtual |
This method should implement the distance between two keys.
It may be overloaded to implement a new metric. The default implementation uses the standard-metric d = abs(x-y).
| x | Left-hand-side Key |
| y | Right-hand-side key |
| useAlternative | use an alternative distance metric |
Reimplemented from BaseOverlay.
Definition at line 1421 of file Kademlia.cc.
|
protectedvirtual |
Implements the find node call.
This method simply returns the closest nodes known in the corresponding routing topology. If the node is a sibling for this key (isSiblingFor(key) = true), this method returns all numSiblings siblings, with the closest neighbor to the key first.
| key | The lookup key. |
| numRedundantNodes | Maximum number of next hop nodes to return. |
| numSiblings | number of siblings to return |
| msg | A pointer to the BaseRouteMessage or FindNodeCall message of this lookup. |
Reimplemented from BaseOverlay.
Definition at line 969 of file Kademlia.cc.
Referenced by recursiveRoutingHook().
|
virtual |
collects statistical data in derived class
Reimplemented from BaseOverlay.
Definition at line 180 of file Kademlia.cc.
|
virtual |
Query the maximum number of redundant next hop nodes that are returned by findNode().
Reimplemented from BaseOverlay.
Definition at line 280 of file Kademlia.cc.
|
virtual |
Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay protocol.
Reimplemented from BaseOverlay.
Definition at line 275 of file Kademlia.cc.
Referenced by findNode(), isSiblingFor(), sendSiblingFindNodeCall(), and setBucketUsage().
|
protected |
handle a expired bucket refresh timer
Definition at line 1323 of file Kademlia.cc.
Referenced by handleTimerEvent().
|
private |
Definition at line 846 of file Kademlia.cc.
|
protectedvirtual |
This method gets call **.gracefulLeaveDelay seconds before it is killed if this node is among the gracefulLeaveProbability nodes.
Reimplemented from BaseOverlay.
Definition at line 831 of file Kademlia.cc.
|
virtual |
Processes Remote-Procedure-Call invocation messages.
This method should be overloaded when the overlay provides RPC functionality.
Reimplemented from BaseRpc.
Definition at line 1159 of file Kademlia.cc.
|
protectedvirtual |
This method is called if an RPC response has been received.
| msg | The response message. |
| context | Pointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code |
| rpcId | The RPC id. |
| rtt | The Round-Trip-Time of this RPC |
Reimplemented from RpcListener.
Definition at line 1183 of file Kademlia.cc.
|
protectedvirtual |
This method is called if an RPC timeout has been reached.
| msg | The original RPC message. |
| dest | The destination node |
| context | Pointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code |
| rpcId | The RPC id. |
| destKey | the destination OverlayKey |
Reimplemented from RpcListener.
Definition at line 1250 of file Kademlia.cc.
|
virtual |
Reimplemented from BaseRpc.
Definition at line 1121 of file Kademlia.cc.
|
virtual |
Processes messages from underlay.
| msg | Message from UDP |
Reimplemented from BaseOverlay.
Definition at line 1139 of file Kademlia.cc.
|
virtual |
Initializes derived-class-attributes.
Initializes derived-class-attributes, called by BaseOverlay::initialize(). By default this method is called once. If more stages are needed one can overload numInitStages() and add more stages.
| stage | the init stage |
Reimplemented from BaseOverlay.
Definition at line 95 of file Kademlia.cc.
|
virtual |
Query if a node is among the siblings for a given key.
Query if a node is among the siblings for a given key. This means, that the nodeId of this node is among the closest numSiblings nodes to the key and that by a local findNode() call all other siblings to this key can be retrieved.
| node | the NodeHandle |
| key | destination key |
| numSiblings | The nodes knows all numSiblings nodes close to this key |
| err | return false if the range could not be determined |
Reimplemented from BaseOverlay.
Definition at line 755 of file Kademlia.cc.
Referenced by findNode().
|
virtual |
Join the overlay with a given nodeID in thisNode.key.
Join the overlay with a given nodeID in thisNode.key. This method may be called by an application to join the overlay with a specific nodeID. It is also called if the node's IP address changes.
Reimplemented from BaseOverlay.
Definition at line 204 of file Kademlia.cc.
Referenced by handleRpcTimeout(), and lookupFinished().
|
protectedvirtual |
Definition at line 1302 of file Kademlia.cc.
Referenced by KademliaLookupListener::lookupFinished().
|
virtual |
Implements ProxListener.
Definition at line 1290 of file Kademlia.cc.
|
private |
Definition at line 889 of file Kademlia.cc.
|
private |
Definition at line 700 of file Kademlia.cc.
Referenced by handleFailedNode(), and routingTimeout().
|
private |
Adds a node to the routing table.
| handle | handle to add |
| isAlive | true, if it is known that the node is alive |
| rtt | measured round-trip-time to node |
| maintenanceLookup | true, if this node was learned from a maintenance lookup |
maintenanceLookup ||
Definition at line 320 of file Kademlia.cc.
Referenced by handleRpcCall(), handleRpcResponse(), handleUDPMessage(), proxCallback(), recursiveRoutingHook(), and routingTimeout().
|
private |
Returns a Bucket or NULL if the bucket has not yet allocated.
If ensure is true, the bucket allocation is ensured.
| key | The key of the node |
| ensure | If true, the bucket allocation is ensured |
Definition at line 304 of file Kademlia.cc.
Referenced by routingAdd(), routingTimeout(), and setBucketUsage().
|
private |
Returns the index of the bucket the key would reside with respect to Kademlia parameters.
| key | The key of the node |
| firstOnLayer | If true bucket with smallest index on same layer is returned |
Definition at line 285 of file Kademlia.cc.
Referenced by findNode(), refillSiblingTable(), routingAdd(), and routingBucket().
|
private |
Definition at line 255 of file Kademlia.cc.
Referenced by joinOverlay(), and ~Kademlia().
|
private |
Definition at line 239 of file Kademlia.cc.
Referenced by joinOverlay().
|
private |
Removes a node after a number of timeouts or immediately if immediately is true (behaves like routingRemove).
| key | Node's key to remove |
| immediately | If true, the node is removed immediately |
Definition at line 630 of file Kademlia.cc.
Referenced by handleRpcTimeout(), proxCallback(), and refillSiblingTable().
|
private |
Definition at line 193 of file Kademlia.cc.
Referenced by handleBucketRefreshTimerExpired(), and joinOverlay().
|
private |
Definition at line 739 of file Kademlia.cc.
Referenced by handleBucketRefreshTimerExpired(), handleRpcResponse(), and handleRpcTimeout().
|
protected |
updates information shown in GUI
Definition at line 1429 of file Kademlia.cc.
Referenced by handleFailedNode(), routingAdd(), routingInit(), and routingTimeout().
|
friend |
Definition at line 155 of file Kademlia.h.
Referenced by handleBucketRefreshTimerExpired(), and handleRpcResponse().
|
protected |
Definition at line 84 of file Kademlia.h.
Referenced by initializeOverlay(), and routingAdd().
|
protected |
Definition at line 87 of file Kademlia.h.
Referenced by initializeOverlay(), and recursiveRoutingHook().
|
protected |
Definition at line 66 of file Kademlia.h.
Referenced by handleBucketRefreshTimerExpired(), initializeOverlay(), and routingBucketIndex().
|
private |
Definition at line 165 of file Kademlia.h.
Referenced by finishOverlay(), handleBucketRefreshTimerExpired(), and initializeOverlay().
|
protected |
Definition at line 81 of file Kademlia.h.
Referenced by handleBucketRefreshTimerExpired(), and initializeOverlay().
|
protected |
Definition at line 93 of file Kademlia.h.
Referenced by handleBucketRefreshTimerExpired(), handleRpcResponse(), handleTimerEvent(), initializeOverlay(), joinOverlay(), Kademlia(), lookupFinished(), and ~Kademlia().
|
private |
Definition at line 169 of file Kademlia.h.
Referenced by initializeOverlay(), Kademlia(), refillSiblingTable(), routingBucket(), routingDeinit(), routingInit(), and ~Kademlia().
|
protected |
Definition at line 77 of file Kademlia.h.
Referenced by initializeOverlay(), routingAdd(), and routingTimeout().
|
protected |
Definition at line 72 of file Kademlia.h.
Referenced by handleBucketRefreshTimerExpired(), and initializeOverlay().
|
protected |
Definition at line 65 of file Kademlia.h.
Referenced by getMaxNumRedundantNodes(), initializeOverlay(), recursiveRoutingHook(), refillSiblingTable(), and routingBucket().
|
protected |
Definition at line 69 of file Kademlia.h.
Referenced by initializeOverlay(), and routingTimeout().
|
protected |
Definition at line 90 of file Kademlia.h.
Referenced by handleBucketRefreshTimerExpired(), and initializeOverlay().
|
protected |
Definition at line 89 of file Kademlia.h.
Referenced by handleBucketRefreshTimerExpired(), and initializeOverlay().
|
protected |
Definition at line 75 of file Kademlia.h.
Referenced by handleBucketRefreshTimerExpired(), handleRpcResponse(), initializeOverlay(), lookupFinished(), and routingAdd().
|
private |
Definition at line 167 of file Kademlia.h.
Referenced by finishOverlay(), initializeOverlay(), and routingTimeout().
|
private |
Definition at line 173 of file Kademlia.h.
Referenced by findNode(), and initializeOverlay().
|
protected |
Definition at line 73 of file Kademlia.h.
Referenced by initializeOverlay(), and routingAdd().
|
protected |
Definition at line 86 of file Kademlia.h.
Referenced by initializeOverlay(), and routingAdd().
|
protected |
Definition at line 85 of file Kademlia.h.
Referenced by findNode(), and initializeOverlay().
|
protected |
Definition at line 78 of file Kademlia.h.
Referenced by initializeOverlay(), and routingAdd().
|
protected |
Definition at line 79 of file Kademlia.h.
Referenced by initializeOverlay(), and routingAdd().
|
private |
Definition at line 172 of file Kademlia.h.
Referenced by findNode(), handleBucketRefreshTimerExpired(), handleFailedNode(), initializeOverlay(), refillSiblingTable(), routingBucket(), and routingDeinit().
|
protected |
Definition at line 67 of file Kademlia.h.
Referenced by getMaxNumSiblings(), handleBucketRefreshTimerExpired(), handleRpcResponse(), initializeOverlay(), and recursiveRoutingHook().
|
protected |
if true, ping not authenticated nodes before adding them to a bucket
Definition at line 74 of file Kademlia.h.
Referenced by initializeOverlay(), joinOverlay(), refillSiblingTable(), and routingAdd().
|
protected |
Definition at line 91 of file Kademlia.h.
Referenced by handleRpcResponse(), handleTimerEvent(), initializeOverlay(), and joinOverlay().
|
protected |
Definition at line 94 of file Kademlia.h.
Referenced by handleRpcResponse(), handleTimerEvent(), initializeOverlay(), joinOverlay(), Kademlia(), and ~Kademlia().
|
protected |
Definition at line 80 of file Kademlia.h.
Referenced by handleBucketRefreshTimerExpired(), initializeOverlay(), and sendSiblingFindNodeCall().
|
private |
Definition at line 171 of file Kademlia.h.
Referenced by findNode(), handleBucketRefreshTimerExpired(), handleFailedNode(), handleNodeGracefulLeaveNotification(), handleTimerEvent(), initializeOverlay(), isSiblingFor(), Kademlia(), lookupFinished(), refillSiblingTable(), routingAdd(), routingDeinit(), routingInit(), routingTimeout(), setBucketUsage(), updateTooltip(), and ~Kademlia().
|
private |
Definition at line 166 of file Kademlia.h.
Referenced by finishOverlay(), handleBucketRefreshTimerExpired(), and initializeOverlay().