Classified ads
Classes | Public Types | Public Member Functions | List of all members
MNodeModelProtocolInterface Class Referenceabstract

Pure-virtual interface of nodemodel. More...

#include <mnodemodelprotocolinterface.h>

Inheritance diagram for MNodeModelProtocolInterface:
Inheritance graph
[legend]

Classes

struct  HostConnectQueueItemStructure
 

Public Types

typedef struct MNodeModelProtocolInterface::HostConnectQueueItemStructure HostConnectQueueItem
 

Public Member Functions

virtual bool nodeGreetingReceived (Node &aNode, bool aWasInitialGreeting=false)=0
 
virtual HashnodeFingerPrint ()=0
 
virtual int listenPortOfThisNode ()=0
 
virtual void setListenPortOfThisNode (int port)=0
 
virtual const QSslCertificate & nodeCert () const =0
 
virtual const QSslKey & nodeKey () const =0
 
virtual QByteArray * getNextItemToSend (Connection &aConnection)=0
 
virtual NodenodeByHash (const Hash &aHash)=0
 
virtual QList< Node * > * getNodesBeforeHash (const Hash &aHash, unsigned aMaxNodes)=0
 
virtual void closeOldestInactiveConnection ()=0
 
virtual QList< Node * > * getNodesAfterHash (const Hash &aHash, unsigned aMaxNodes, int aMaxInactivityMinutes=-1)=0
 
virtual QList< HostConnectQueueItemgetHotAddresses ()=0
 
virtual bool updateNodeLastConnectTimeInDb (Node &aNode)=0
 
virtual QList< Node * > * getHotNodes (int aMaxNodes)=0
 
virtual void addNodeFromBroadcast (const Hash &aNodeFingerPrint, const QHostAddress &aAddr, int aPort)=0
 
virtual bool addNodeToConnectionWishList (Node *aNode)=0
 
virtual bool addNodeToConnectionWishList (const Hash &aNode)=0
 
virtual NodenextConnectionWishListItem ()=0
 
virtual bool isNodeAlreadyConnected (const Node &aNode) const =0
 
virtual bool isNodeAlreadyConnected (const Hash &aHash) const =0
 
virtual Hash bucketEndHash (const Hash &aFingerPrintOfNodeAsking)=0
 
virtual bool updateNodeLastMutualConnectTimeInDb (const Hash &aNodeFp, quint32 aTime)=0
 
virtual void setDnsName (QString aName)=0
 
virtual QString getDnsName ()=0
 
virtual void offerNodeToRecentlyFailedList (const Hash &aFailedNodeHash)=0
 

Detailed Description

Pure-virtual interface of nodemodel.

Interface for node-specific part of datamodel. Exists Mainly for testing purposes. Contains all methods of node-model that are of interest to parties outside datamodel. See NodeModel.

Member Typedef Documentation

◆ HostConnectQueueItem

structure used for communicating lists of nodes to connect between datamodel and networking parts. Basically these are nodes but reduced to plain addr/hash.

Member Function Documentation

◆ addNodeFromBroadcast()

virtual void MNodeModelProtocolInterface::addNodeFromBroadcast ( const Hash aNodeFingerPrint,
const QHostAddress &  aAddr,
int  aPort 
)
pure virtual

method for adding node reference from broadcast. this needs difference in handling because in IPv4 network this typically contains private addr space addresses that we don't want to permanently store nor give to others as node-references.

For making connections inside LANs of organisations having NATs and firewalls and whatnot this might still be a handy feature.

Implemented in NodeModel.

◆ addNodeToConnectionWishList() [1/2]

virtual bool MNodeModelProtocolInterface::addNodeToConnectionWishList ( Node aNode)
pure virtual

method for adding a node to connection-wishlist. network connector engine will then later pick them up. nodemodel will take ownership of the node and delete the object later.

Returns
true if connection was queued

Implemented in NodeModel.

◆ addNodeToConnectionWishList() [2/2]

virtual bool MNodeModelProtocolInterface::addNodeToConnectionWishList ( const Hash aNode)
pure virtual

method for adding a node to connection-wishlist. network connector engine will then later pick them up.

Returns
true if connection was queued

Implemented in NodeModel.

◆ bucketEndHash()

virtual Hash MNodeModelProtocolInterface::bucketEndHash ( const Hash aFingerPrintOfNodeAsking)
pure virtual

Important method regarding churn here. This is called from Connection class and this method is used to determine what content belongs to same bucket with the node that is being served by that Connection. Content in the same bucket with the node is then sent over to node ; to keep the content alive in the network.

Intent here is find bucket size where we have approximately 20 live nodes in a bucket.

This is done so that we order the recently-seen nodes by hash value of the node, then start from the fingerprint of the node that is asking, and from that point we count to 20. The fingerprint of the node at position 20 is the end of the bucket. The fingerprint of the node that asks is the start.

Parameters
aFingerPrintOfNodeAskingfingerprint of node that wants to have its bucket filled
Returns
Ending-address of the nodes bucket.

Implemented in NodeModel.

◆ closeOldestInactiveConnection()

virtual void MNodeModelProtocolInterface::closeOldestInactiveConnection ( )
pure virtual

Implemented in NodeModel.

◆ getDnsName()

virtual QString MNodeModelProtocolInterface::getDnsName ( )
pure virtual

called from settings dialog and own node construction

Implemented in NodeModel.

◆ getHotAddresses()

virtual QList<HostConnectQueueItem> MNodeModelProtocolInterface::getHotAddresses ( )
pure virtual

Implemented in NodeModel.

◆ getHotNodes()

virtual QList<Node *>* MNodeModelProtocolInterface::getHotNodes ( int  aMaxNodes)
pure virtual

Implemented in NodeModel.

◆ getNextItemToSend()

virtual QByteArray* MNodeModelProtocolInterface::getNextItemToSend ( Connection aConnection)
pure virtual

Implemented in NodeModel.

◆ getNodesAfterHash()

virtual QList<Node *>* MNodeModelProtocolInterface::getNodesAfterHash ( const Hash aHash,
unsigned  aMaxNodes,
int  aMaxInactivityMinutes = -1 
)
pure virtual

Implemented in NodeModel.

◆ getNodesBeforeHash()

virtual QList<Node *>* MNodeModelProtocolInterface::getNodesBeforeHash ( const Hash aHash,
unsigned  aMaxNodes 
)
pure virtual

Implemented in NodeModel.

◆ isNodeAlreadyConnected() [1/2]

virtual bool MNodeModelProtocolInterface::isNodeAlreadyConnected ( const Node aNode) const
pure virtual

method for checking if a node is already connected

Implemented in NodeModel.

◆ isNodeAlreadyConnected() [2/2]

virtual bool MNodeModelProtocolInterface::isNodeAlreadyConnected ( const Hash aHash) const
pure virtual

Method for checking if a node is already connected. This version checks only hash, not addresses.

Implemented in NodeModel.

◆ listenPortOfThisNode()

virtual int MNodeModelProtocolInterface::listenPortOfThisNode ( )
pure virtual

TCP listen port number method

Implemented in NodeModel.

◆ nextConnectionWishListItem()

virtual Node* MNodeModelProtocolInterface::nextConnectionWishListItem ( )
pure virtual

method for getting one node from wishlist. caller is obliged to delete the node returned.

Returns
node or null if there is nothing in wishlist

Implemented in NodeModel.

◆ nodeByHash()

virtual Node* MNodeModelProtocolInterface::nodeByHash ( const Hash aHash)
pure virtual

Implemented in NodeModel.

◆ nodeCert()

virtual const QSslCertificate& MNodeModelProtocolInterface::nodeCert ( ) const
pure virtual

Implemented in NodeModel.

◆ nodeFingerPrint()

virtual Hash& MNodeModelProtocolInterface::nodeFingerPrint ( )
pure virtual

returns fingerprint of this node

Implemented in NodeModel.

◆ nodeGreetingReceived()

virtual bool MNodeModelProtocolInterface::nodeGreetingReceived ( Node aNode,
bool  aWasInitialGreeting = false 
)
pure virtual

Implemented in NodeModel.

◆ nodeKey()

virtual const QSslKey& MNodeModelProtocolInterface::nodeKey ( ) const
pure virtual

getter for ssl certificate of SSL sock

Implemented in NodeModel.

◆ offerNodeToRecentlyFailedList()

virtual void MNodeModelProtocolInterface::offerNodeToRecentlyFailedList ( const Hash aFailedNodeHash)
pure virtual

used to offer node to list of recently failed connections. this model maintains a list of such nodes and tries to not immediately re-connect a recently failed node

Implemented in NodeModel.

◆ setDnsName()

virtual void MNodeModelProtocolInterface::setDnsName ( QString  aName)
pure virtual

called from settings dialog

Implemented in NodeModel.

◆ setListenPortOfThisNode()

virtual void MNodeModelProtocolInterface::setListenPortOfThisNode ( int  port)
pure virtual

for setting of tcp listen port

Implemented in NodeModel.

◆ updateNodeLastConnectTimeInDb()

virtual bool MNodeModelProtocolInterface::updateNodeLastConnectTimeInDb ( Node aNode)
pure virtual

Implemented in NodeModel.

◆ updateNodeLastMutualConnectTimeInDb()

virtual bool MNodeModelProtocolInterface::updateNodeLastMutualConnectTimeInDb ( const Hash aNodeFp,
quint32  aTime 
)
pure virtual

updates last mutual connect time, used for deciding what content to send automatically upon node connect

Implemented in NodeModel.


The documentation for this class was generated from the following file: