Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
QH::AbstractNodeInfo Class Reference

The AbstractNodeInfo class contains information about client or server connection and tcp socket of node. All node Info classes must be initialized in the AbstractNode::createNodeInfo methods. This implementation of nodeInf contains only trust of node and network socket. More...

#include <abstractnodeinfo.h>

Inheritance diagram for QH::AbstractNodeInfo:
Inheritance graph
Collaboration diagram for QH::AbstractNodeInfo:
Collaboration graph

Public Slots

virtual void removeSocket ()
 removeSocket This method use for remove socket. You can override this method for handle this event.
 

Signals

void sigConnected (QH::AbstractNodeInfo *thisNode)
 sigConnected This is wrapper signal for the QAbstractSocket::connetced signal.
 
void sigDisconnected (QH::AbstractNodeInfo *thisNode)
 sigDisconnected This is wrapper signal for the QAbstractSocket::disconnected signal.
 
void sigReadyRead (QH::AbstractNodeInfo *thisNode)
 sigReadyRead This is wrapper signal for the QAbstractSocket::readyRead signal.
 
void sigErrorOccurred (QH::AbstractNodeInfo *thisNode, QAbstractSocket::SocketError socketError, QString message)
 sigErrorOccurred This is wrapper signal for the QAbstractSocket::errorOccurred signal.
 
void sigConfirmed (QH::AbstractNodeInfo *thisNode)
 sigConfirmed This signal emitted when node is confirmnd. The confirm status sets in the confirmData method.
 
void statusChaned (QH::AbstractNodeInfo *thisNode, QH::NodeCoonectionStatus status)
 statusChaned This signal emitted when nodes status is changed.
 

Public Member Functions

 AbstractNodeInfo (QAbstractSocket *sct=nullptr, const HostAddress *address=nullptr)
 AbstractNodeInfo.
 
virtual ~AbstractNodeInfo ()
 ~AbstractNodeInfo
 
QAbstractSocket * sct () const
 sct This method return socket of connection.
 
virtual void ban ()
 ban This node, set trust value to 0.
 
virtual bool isBanned () const
 isBanned - check node which banned.
 
virtual void unBan ()
 unBan - Set trust value of node to TrustNode::Restore. See TrustNode enum for more information.
 
virtual int trust () const
 trust - Show current value of trust level node or client.
 
virtual void setTrust (int trust)
 setTrust This method set manually value of this node trust.
 
virtual bool isValid () const
 isValid - Check valid of node. This method check connect status of socket.
 
virtual bool isConnected () const
 isConnected - Check of node connect status.
 
virtual void reset ()
 reset This method reset all fields of the nodeInfo.
 
QHostInfo * info () const
 info - This method return Host domain information. For more information see the Qt Documentation about QHostInfo.
 
void setInfo (const QHostInfo &info)
 setInfo - Set new host info for this node.
 
HostAddress networkAddress () const
 networkAddress This method return network address of current node or client.
 
void setNetworkAddress (const HostAddress &networkAddress)
 setNetworkAddress This method update network address of the current node.
 
NodeCoonectionStatus status () const
 status This method return status of the node connection.
 
void setStatus (const NodeCoonectionStatus &status)
 setStatus This method Sets new value of status node.
 
void updateConfirmStatus ()
 updateConfirmStatus This method invoked after process a received package and update confirm status of the node.
 
bool isLocal () const
 isLocal return true if connection opened on this node.
 
void setIsLocal (bool isLocal)
 setIsLocal This method sets local status for this Node.
 
void setSct (QAbstractSocket *sct)
 setSct This method sets a new socket for this node or client.
 
const VersionDataversion () const
 version This method return version data structure;
 
void setVersion (const VersionData &newVersion)
 setVersion This method sets new version data structure.
 
bool fVersionReceived () const
 fVersionReceived This method return true if this node receive version information.
 
void setFVersionReceived (bool newFVersionReceived)
 setFVersionReceived This method change the fVersionReceived flag.
 
bool fVersionDelivered () const
 fVersionDelivered This method return true if this node delivere own version to the distanation node.
 
void setFVersionDelivered (bool newFVersionDelivered)
 setFVersionDelivered This method change the fVersionDelivered flag.
 
QSharedPointer< QH::iParsergetParser (unsigned short cmd)
 getParser This method return parser of choosed command.
 
QSharedPointer< QH::iParsergetParser (const QString &type)
 getParser This method return parser of choosed command.
 
void addParser (unsigned short cmd, QSharedPointer< QH::iParser > parser)
 addParser This method add to cache new parser for command .
 
void addParser (QSharedPointer< QH::iParser > parser)
 addParser This method add to cache new parser for command .
 
const PackagesVersionDatamultiVersionPackages () const
 multiVersionPackages This is list of packages of one api package tah support multiple versions.
 
void setMultiVersionPackages (const PackagesVersionData &newMultiVersionPackages)
 setMultiVersionPackages This method sets new list of multi-version packages.
 

Protected Member Functions

virtual bool confirmData () const
 confirmData This method check all data of node and return true. If node is confirmed.
 

Detailed Description

The AbstractNodeInfo class contains information about client or server connection and tcp socket of node. All node Info classes must be initialized in the AbstractNode::createNodeInfo methods. This implementation of nodeInf contains only trust of node and network socket.

Definition at line 67 of file abstractnodeinfo.h.

Constructor & Destructor Documentation

◆ AbstractNodeInfo()

QH::AbstractNodeInfo::AbstractNodeInfo ( QAbstractSocket *  sct = nullptr,
const HostAddress address = nullptr 
)

AbstractNodeInfo.

Parameters
sctSocket of connection
address- Address of socket

Definition at line 19 of file abstractnodeinfo.cpp.

Here is the call graph for this function:

◆ ~AbstractNodeInfo()

QH::AbstractNodeInfo::~AbstractNodeInfo ( )
virtual

~AbstractNodeInfo

Definition at line 27 of file abstractnodeinfo.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addParser() [1/2]

void QH::AbstractNodeInfo::addParser ( QSharedPointer< QH::iParser parser)

addParser This method add to cache new parser for command .

Parameters
parserThis is added parser.
Note
All parsers will be removed after reconnect of this node.

◆ addParser() [2/2]

void QH::AbstractNodeInfo::addParser ( unsigned short  cmd,
QSharedPointer< QH::iParser parser 
)

addParser This method add to cache new parser for command .

Parameters
cmdThis is any command that support this parser.
parserThis is added parser.
Note
All parsers will be removed after reconnect of this node.

Definition at line 250 of file abstractnodeinfo.cpp.

◆ ban()

void QH::AbstractNodeInfo::ban ( )
virtual

ban This node, set trust value to 0.

Definition at line 59 of file abstractnodeinfo.cpp.

Here is the call graph for this function:

◆ confirmData()

bool QH::AbstractNodeInfo::confirmData ( ) const
protectedvirtual

confirmData This method check all data of node and return true. If node is confirmed.

Returns
true if node is confirmed.

Definition at line 130 of file abstractnodeinfo.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fVersionDelivered()

bool QH::AbstractNodeInfo::fVersionDelivered ( ) const

fVersionDelivered This method return true if this node delivere own version to the distanation node.

Returns
true if this node delivere own version to the distanation node.

Definition at line 142 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ fVersionReceived()

bool QH::AbstractNodeInfo::fVersionReceived ( ) const

fVersionReceived This method return true if this node receive version information.

Returns
true if this node receive version information.

Definition at line 150 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ getParser() [1/2]

QSharedPointer< iParser > QH::AbstractNodeInfo::getParser ( const QString &  type)

getParser This method return parser of choosed command.

Parameters
typeThis is type of api parser.
Returns
parser by type.

Definition at line 244 of file abstractnodeinfo.cpp.

◆ getParser() [2/2]

QSharedPointer< QH::iParser > QH::AbstractNodeInfo::getParser ( unsigned short  cmd)

getParser This method return parser of choosed command.

Parameters
cmdThis is command that need to parse.
Returns
parser of the cmd comand.

Definition at line 238 of file abstractnodeinfo.cpp.

◆ info()

QHostInfo * QH::AbstractNodeInfo::info ( ) const

info - This method return Host domain information. For more information see the Qt Documentation about QHostInfo.

Returns
Host info of this node.

Definition at line 199 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ isBanned()

bool QH::AbstractNodeInfo::isBanned ( ) const
virtual

isBanned - check node which banned.

Returns
true if the node is banned.

Definition at line 64 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ isConnected()

bool QH::AbstractNodeInfo::isConnected ( ) const
virtual

isConnected - Check of node connect status.

Returns
true if the socket connected.

Definition at line 222 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ isLocal()

bool QH::AbstractNodeInfo::isLocal ( ) const

isLocal return true if connection opened on this node.

Returns
True if connection is opened on this host.

Definition at line 171 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ isValid()

bool QH::AbstractNodeInfo::isValid ( ) const
virtual

isValid - Check valid of node. This method check connect status of socket.

Returns
true if node or client is valid.

Definition at line 218 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ multiVersionPackages()

const PackagesVersionData & QH::AbstractNodeInfo::multiVersionPackages ( ) const

multiVersionPackages This is list of packages of one api package tah support multiple versions.

Returns
list of packages of one api package tah support multiple versions.

Definition at line 134 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ networkAddress()

HostAddress QH::AbstractNodeInfo::networkAddress ( ) const

networkAddress This method return network address of current node or client.

Returns
network address of node.

Definition at line 175 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ removeSocket

void QH::AbstractNodeInfo::removeSocket ( )
virtualslot

removeSocket This method use for remove socket. You can override this method for handle this event.

Note
This method woll be ignored when object distroed

Definition at line 35 of file abstractnodeinfo.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void QH::AbstractNodeInfo::reset ( )
virtual

reset This method reset all fields of the nodeInfo.

Note
override this method if your node info has new fields.

Definition at line 226 of file abstractnodeinfo.cpp.

◆ sct()

QAbstractSocket * QH::AbstractNodeInfo::sct ( ) const

sct This method return socket of connection.

Returns
return socket of connection.

Definition at line 31 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ setFVersionDelivered()

void QH::AbstractNodeInfo::setFVersionDelivered ( bool  newFVersionDelivered)

setFVersionDelivered This method change the fVersionDelivered flag.

Parameters
newFVersionDeliveredthis is new value of the fVersionDelivered flag.

Definition at line 146 of file abstractnodeinfo.cpp.

◆ setFVersionReceived()

void QH::AbstractNodeInfo::setFVersionReceived ( bool  newFVersionReceived)

setFVersionReceived This method change the fVersionReceived flag.

Parameters
newFVersionReceivedthis is new value of the fVersionReceived flag.

Definition at line 154 of file abstractnodeinfo.cpp.

◆ setInfo()

void QH::AbstractNodeInfo::setInfo ( const QHostInfo &  info)

setInfo - Set new host info for this node.

Parameters
info- host info.

Definition at line 192 of file abstractnodeinfo.cpp.

◆ setIsLocal()

void QH::AbstractNodeInfo::setIsLocal ( bool  isLocal)

setIsLocal This method sets local status for this Node.

Parameters
isLocalThis is a new value.

Definition at line 112 of file abstractnodeinfo.cpp.

Here is the call graph for this function:

◆ setMultiVersionPackages()

void QH::AbstractNodeInfo::setMultiVersionPackages ( const PackagesVersionData newMultiVersionPackages)

setMultiVersionPackages This method sets new list of multi-version packages.

Parameters
newMultiVersionPackagesThis is new value of multi-version packages.

Definition at line 138 of file abstractnodeinfo.cpp.

◆ setNetworkAddress()

void QH::AbstractNodeInfo::setNetworkAddress ( const HostAddress networkAddress)

setNetworkAddress This method update network address of the current node.

Parameters
networkAddressnew address.

Definition at line 179 of file abstractnodeinfo.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSct()

void QH::AbstractNodeInfo::setSct ( QAbstractSocket *  sct)

setSct This method sets a new socket for this node or client.

Parameters
sctThis is a new valuse of the socket.

Definition at line 72 of file abstractnodeinfo.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStatus()

void QH::AbstractNodeInfo::setStatus ( const NodeCoonectionStatus status)

setStatus This method Sets new value of status node.

Parameters
statusThis is a new status of the node.

Definition at line 120 of file abstractnodeinfo.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTrust()

void QH::AbstractNodeInfo::setTrust ( int  trust)
virtual

setTrust This method set manually value of this node trust.

Parameters
trust- new value.

Definition at line 207 of file abstractnodeinfo.cpp.

◆ setVersion()

void QH::AbstractNodeInfo::setVersion ( const VersionData newVersion)

setVersion This method sets new version data structure.

Parameters
newVersionThis is new values of the version.

Definition at line 162 of file abstractnodeinfo.cpp.

◆ sigConfirmed

void QH::AbstractNodeInfo::sigConfirmed ( QH::AbstractNodeInfo thisNode)
signal

sigConfirmed This signal emitted when node is confirmnd. The confirm status sets in the confirmData method.

Parameters
thisNodeThis is pointer to current object.

◆ sigConnected

void QH::AbstractNodeInfo::sigConnected ( QH::AbstractNodeInfo thisNode)
signal

sigConnected This is wrapper signal for the QAbstractSocket::connetced signal.

Parameters
thisNodeThis is pointer to current object.
Here is the caller graph for this function:

◆ sigDisconnected

void QH::AbstractNodeInfo::sigDisconnected ( QH::AbstractNodeInfo thisNode)
signal

sigDisconnected This is wrapper signal for the QAbstractSocket::disconnected signal.

Parameters
thisNodeThis is pointer to current object.
Here is the caller graph for this function:

◆ sigErrorOccurred

void QH::AbstractNodeInfo::sigErrorOccurred ( QH::AbstractNodeInfo thisNode,
QAbstractSocket::SocketError  socketError,
QString  message 
)
signal

sigErrorOccurred This is wrapper signal for the QAbstractSocket::errorOccurred signal.

Parameters
thisNodeThis is pointer to current object.
socketErrorThis is socket error code.
messageThis is a error string message. For more information see the QAbstractSocket::SocketError enum class.
Here is the caller graph for this function:

◆ sigReadyRead

void QH::AbstractNodeInfo::sigReadyRead ( QH::AbstractNodeInfo thisNode)
signal

sigReadyRead This is wrapper signal for the QAbstractSocket::readyRead signal.

Parameters
thisNodeThis is pointer to current object.
Here is the caller graph for this function:

◆ status()

NodeCoonectionStatus QH::AbstractNodeInfo::status ( ) const

status This method return status of the node connection.

Returns
connection status for more info see NodeCoonectionStatus.

Definition at line 116 of file abstractnodeinfo.cpp.

Here is the caller graph for this function:

◆ statusChaned

void QH::AbstractNodeInfo::statusChaned ( QH::AbstractNodeInfo thisNode,
QH::NodeCoonectionStatus  status 
)
signal

statusChaned This signal emitted when nodes status is changed.

Parameters
thisNodeThis is pointer to current object.
statusThis is status of node. For more information see the NodeCoonectionStatus enum.
Here is the caller graph for this function:

◆ trust()

int QH::AbstractNodeInfo::trust ( ) const
virtual

trust - Show current value of trust level node or client.

Returns
current trust value.

Definition at line 203 of file abstractnodeinfo.cpp.

◆ unBan()

void QH::AbstractNodeInfo::unBan ( )
virtual

unBan - Set trust value of node to TrustNode::Restore. See TrustNode enum for more information.

Definition at line 68 of file abstractnodeinfo.cpp.

◆ updateConfirmStatus()

void QH::AbstractNodeInfo::updateConfirmStatus ( )

updateConfirmStatus This method invoked after process a received package and update confirm status of the node.

Definition at line 166 of file abstractnodeinfo.cpp.

Here is the call graph for this function:

◆ version()

const VersionData & QH::AbstractNodeInfo::version ( ) const

version This method return version data structure;

Returns
version data structure;

Definition at line 158 of file abstractnodeinfo.cpp.


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