8#ifndef ABSTRACTNODEINFO_H
9#define ABSTRACTNODEINFO_H
13#include "heart_global.h"
88 QAbstractSocket *
sct()
const;
105 virtual void unBan();
111 virtual int trust()
const;
135 virtual void reset();
142 QHostInfo *
info()
const;
238 QSharedPointer<QH::iParser>
getParser(
unsigned short cmd);
245 QSharedPointer<QH::iParser>
getParser(
const QString& type);
253 void addParser(
unsigned short cmd, QSharedPointer<QH::iParser> parser);
310 QAbstractSocket::SocketError socketError,
338 QHostInfo *_info =
nullptr;
341 QAbstractSocket *_sct =
nullptr;
344 bool _isLocal =
false;
346 QHash<unsigned short, QSharedPointer<iParser>> _parsersMap;
347 QHash<QString, QSharedPointer<iParser>> _parsersKeysMap;
348 QMutex _parsersListMutex;
355 bool _fVersionReceived =
false;
356 bool _fVersionDelivered =
false;
The AbstractNodeInfo class contains information about client or server connection and tcp socket of n...
const PackagesVersionData & multiVersionPackages() const
multiVersionPackages This is list of packages of one api package tah support multiple versions.
bool isLocal() const
isLocal return true if connection opened on this node.
virtual void reset()
reset This method reset all fields of the nodeInfo.
void setStatus(const NodeCoonectionStatus &status)
setStatus This method Sets new value of status node.
void setVersion(const VersionData &newVersion)
setVersion This method sets new version data structure.
AbstractNodeInfo(QAbstractSocket *sct=nullptr, const HostAddress *address=nullptr)
AbstractNodeInfo.
NodeCoonectionStatus status() const
status This method return status of the node connection.
void setFVersionReceived(bool newFVersionReceived)
setFVersionReceived This method change the fVersionReceived flag.
void setMultiVersionPackages(const PackagesVersionData &newMultiVersionPackages)
setMultiVersionPackages This method sets new list of multi-version packages.
virtual int trust() const
trust - Show current value of trust level node or client.
void setInfo(const QHostInfo &info)
setInfo - Set new host info for this node.
void setSct(QAbstractSocket *sct)
setSct This method sets a new socket for this node or client.
bool fVersionDelivered() const
fVersionDelivered This method return true if this node delivere own version to the distanation node.
void sigReadyRead(QH::AbstractNodeInfo *thisNode)
sigReadyRead This is wrapper signal for the QAbstractSocket::readyRead signal.
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.
void addParser(unsigned short cmd, QSharedPointer< QH::iParser > parser)
addParser This method add to cache new parser for command .
virtual void setTrust(int trust)
setTrust This method set manually value of this node trust.
void addParser(QSharedPointer< QH::iParser > parser)
addParser This method add to cache new parser for command .
void statusChaned(QH::AbstractNodeInfo *thisNode, QH::NodeCoonectionStatus status)
statusChaned This signal emitted when nodes status is changed.
virtual bool confirmData() const
confirmData This method check all data of node and return true. If node is confirmed.
virtual void removeSocket()
removeSocket This method use for remove socket. You can override this method for handle this event.
void setFVersionDelivered(bool newFVersionDelivered)
setFVersionDelivered This method change the fVersionDelivered flag.
QHostInfo * info() const
info - This method return Host domain information. For more information see the Qt Documentation abou...
const VersionData & version() const
version This method return version data structure;
virtual void unBan()
unBan - Set trust value of node to TrustNode::Restore. See TrustNode enum for more information.
virtual void ban()
ban This node, set trust value to 0.
void updateConfirmStatus()
updateConfirmStatus This method invoked after process a received package and update confirm status of...
QSharedPointer< QH::iParser > getParser(unsigned short cmd)
getParser This method return parser of choosed command.
virtual bool isValid() const
isValid - Check valid of node. This method check connect status of socket.
void sigConfirmed(QH::AbstractNodeInfo *thisNode)
sigConfirmed This signal emitted when node is confirmnd. The confirm status sets in the confirmData m...
QAbstractSocket * sct() const
sct This method return socket of connection.
virtual bool isBanned() const
isBanned - check node which banned.
void setIsLocal(bool isLocal)
setIsLocal This method sets local status for this Node.
void sigConnected(QH::AbstractNodeInfo *thisNode)
sigConnected This is wrapper signal for the QAbstractSocket::connetced signal.
void sigErrorOccurred(QH::AbstractNodeInfo *thisNode, QAbstractSocket::SocketError socketError, QString message)
sigErrorOccurred This is wrapper signal for the QAbstractSocket::errorOccurred signal.
virtual bool isConnected() const
isConnected - Check of node connect status.
bool fVersionReceived() const
fVersionReceived This method return true if this node receive version information.
void sigDisconnected(QH::AbstractNodeInfo *thisNode)
sigDisconnected This is wrapper signal for the QAbstractSocket::disconnected signal.
The Host Address class this is wrapper of QHostAddress. Contains the NetworkAddress and network port.
Q_DECLARE_METATYPE(QH::HostAddress)
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
uint qHash(NodeCoonectionStatus status)
qHash - Simple hash function of NodeCoonectionStatus
NodeCoonectionStatus
The AbstractNodeState enum - This is status of the known nodes or clients.
@ Connected
The node with this status has socket status is connected.
@ NotConnected
This node not sent data about its envirement and status of node socket is disconnected.
QHash< QString, DistVersion > VersionData
VersionData This is array of all available apis and supported its versions.
TrustNode
The TrustNode enum contains cases for trust of the client or nodes.
@ Default
General trust of the node or client.
@ Baned
Node with this trust value is forbidden.
@ Undefined
Undefined node.
QHash< unsigned short, DistVersion > PackagesVersionData
PackagesVersionData This is some as VersionData but for int commands.