Classified ads
Public Member Functions | Public Attributes | Private Attributes | List of all members
MockUpNodeModel Class Reference

not a real part datamodel. debugging aid. More...

#include <mockup_nodemodel.h>

Inheritance diagram for MockUpNodeModel:
Inheritance graph
[legend]
Collaboration diagram for MockUpNodeModel:
Collaboration graph
[legend]

Public Member Functions

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

Public Attributes

NodeiLastNodeReceived
 

Private Attributes

MControlleriController
 
HashiFingerPrintOfThisNode
 
QString iDnsName
 

Additional Inherited Members

- Public Types inherited from MNodeModelProtocolInterface
typedef struct MNodeModelProtocolInterface::HostConnectQueueItemStructure HostConnectQueueItem
 

Detailed Description

not a real part datamodel. debugging aid.

Constructor & Destructor Documentation

MockUpNodeModel::MockUpNodeModel ( MController aMController)

constructor

MockUpNodeModel::~MockUpNodeModel ( )

Destructor

Member Function Documentation

virtual void MockUpNodeModel::addNodeFromBroadcast ( const Hash aNodeFingerPrint,
const QHostAddress &  aAddr,
int  aPort 
)
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.

Implements MNodeModelProtocolInterface.

virtual bool MockUpNodeModel::addNodeToConnectionWishList ( Node aNode)
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.

Implements MNodeModelProtocolInterface.

virtual bool MockUpNodeModel::addNodeToConnectionWishList ( const Hash aNode)
virtual

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

Implements MNodeModelProtocolInterface.

virtual Hash MockUpNodeModel::bucketEndHash ( const Hash aFingerPrintOfNodeAsking)
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.

Implements MNodeModelProtocolInterface.

virtual void MockUpNodeModel::closeOldestInactiveConnection ( )
virtual
virtual QString MockUpNodeModel::getDnsName ( )
virtual

called from settings dialog and own node construction

Implements MNodeModelProtocolInterface.

virtual QList<HostConnectQueueItem> MockUpNodeModel::getHotAddresses ( )
virtual
virtual QList<Node *>* MockUpNodeModel::getHotNodes ( int  aMaxNodes)
virtual
virtual QByteArray* MockUpNodeModel::getNextItemToSend ( Connection aConnection)
virtual
virtual QList<Node *>* MockUpNodeModel::getNodesAfterHash ( const Hash aHash,
int  aMaxNodes,
int  aMaxInactivityMinutes = -1 
)
virtual
virtual QList<Node*>* MockUpNodeModel::getNodesAfterHash ( const Hash h,
unsigned int  u,
int  i 
)
virtual
virtual QList<Node *>* MockUpNodeModel::getNodesBeforeHash ( const Hash aHash,
int  aMaxNodes 
)
virtual
virtual QList<Node*>* MockUpNodeModel::getNodesBeforeHash ( const Hash h,
unsigned int  i 
)
virtual
virtual bool MockUpNodeModel::isNodeAlreadyConnected ( const Node aNode) const
virtual

method for checking if a node is already connected

Implements MNodeModelProtocolInterface.

virtual bool MockUpNodeModel::isNodeAlreadyConnected ( const Hash aHash) const
virtual

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

Implements MNodeModelProtocolInterface.

virtual int MockUpNodeModel::listenPortOfThisNode ( )
virtual

TCP listen port number method

Implements MNodeModelProtocolInterface.

virtual Node* MockUpNodeModel::nextConnectionWishListItem ( )
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

Implements MNodeModelProtocolInterface.

virtual Node* MockUpNodeModel::nodeByHash ( const Hash aHash)
virtual
virtual const QSslCertificate& MockUpNodeModel::nodeCert ( ) const
virtual
virtual Hash& MockUpNodeModel::nodeFingerPrint ( )
virtual

returns fingerprint of this node

Implements MNodeModelProtocolInterface.

virtual bool MockUpNodeModel::nodeGreetingReceived ( Node aNode,
bool  aWasInitialGreeting = false 
)
virtual
virtual const QSslKey& MockUpNodeModel::nodeKey ( ) const
virtual

getter for ssl certificate of SSL sock

Implements MNodeModelProtocolInterface.

virtual void MockUpNodeModel::offerNodeToRecentlyFailedList ( const Hash aFailedNodeHash)
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

Implements MNodeModelProtocolInterface.

virtual void MockUpNodeModel::setDnsName ( QString  aName)
virtual

called from settings dialog

Implements MNodeModelProtocolInterface.

virtual void MockUpNodeModel::setListenPortOfThisNode ( int  port)
virtual

for setting of tcp listen port

Implements MNodeModelProtocolInterface.

virtual bool MockUpNodeModel::updateNodeLastConnectTimeInDb ( Node aNode)
virtual
virtual bool MockUpNodeModel::updateNodeLastMutualConnectTimeInDb ( const Hash aNodeFp,
quint32  aTime 
)
virtual

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

Implements MNodeModelProtocolInterface.

Member Data Documentation

MController* MockUpNodeModel::iController
private
QString MockUpNodeModel::iDnsName
private
Hash* MockUpNodeModel::iFingerPrintOfThisNode
private

set by method openOrCreateSSLCertificate

Node* MockUpNodeModel::iLastNodeReceived

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