Classified ads
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]

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< QPair
< QHostAddress, int > > 
getHotAddresses ()=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 void 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
 

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 Function Documentation

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, and MockUpNodeModel.

virtual void 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.

Implemented in NodeModel, and MockUpNodeModel.

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.

Implemented in NodeModel, and MockUpNodeModel.

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, and MockUpNodeModel.

virtual void MNodeModelProtocolInterface::closeOldestInactiveConnection ( )
pure virtual

Implemented in NodeModel, and MockUpNodeModel.

virtual QString MNodeModelProtocolInterface::getDnsName ( )
pure virtual

called from settings dialog and own node construction

Implemented in NodeModel, and MockUpNodeModel.

virtual QList<QPair<QHostAddress,int> > MNodeModelProtocolInterface::getHotAddresses ( )
pure virtual

Implemented in NodeModel, and MockUpNodeModel.

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

Implemented in NodeModel, and MockUpNodeModel.

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

Implemented in NodeModel, and MockUpNodeModel.

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

Implemented in NodeModel.

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

Implemented in NodeModel.

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

method for checking if a node is already connected

Implemented in NodeModel, and MockUpNodeModel.

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, and MockUpNodeModel.

virtual int MNodeModelProtocolInterface::listenPortOfThisNode ( )
pure virtual

TCP listen port number method

Implemented in NodeModel, and MockUpNodeModel.

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, and MockUpNodeModel.

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

Implemented in NodeModel, and MockUpNodeModel.

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

Implemented in NodeModel, and MockUpNodeModel.

virtual Hash& MNodeModelProtocolInterface::nodeFingerPrint ( )
pure virtual

returns fingerprint of this node

Implemented in NodeModel, and MockUpNodeModel.

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

Implemented in NodeModel, and MockUpNodeModel.

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

getter for ssl certificate of SSL sock

Implemented in NodeModel, and MockUpNodeModel.

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

called from settings dialog

Implemented in NodeModel, and MockUpNodeModel.

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

for setting of tcp listen port

Implemented in MockUpNodeModel, and NodeModel.

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

Implemented in NodeModel, and MockUpNodeModel.

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, and MockUpNodeModel.


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