21#include <easyssl/x509.h>
22#include <easyssl/rsassl.h>
24#include <QSslConfiguration>
25#include <QSslCertificate>
32#include <QtConcurrent>
42#include <qaglobalutils.h>
72 qRegisterMetaType<QSharedPointer<QH::AbstractTask>>();
74 qRegisterMetaType<QList<QSslError>>();
78 this, &AbstractNode::handleBeginWork);
87 for (
auto it: std::as_const(_receiveData)) {
95 delete _tasksheduller;
96 delete _apiVersionParser;
105 if (addres.isEmpty()) {
111 qCritical() <<
"Run fail " << this->errorString();
112 qCritical() <<
"Address:: " << adr.
toString();
124 return _apiVersionParser->selectParser(cmd, sender);
129 return _apiVersionParser->selectParser(type, sender);
133 return _apiVersionParser->selectParser(type, version);
139 _connectionsMutex.lock();
140 for (
const auto &i : std::as_const(_connections)) {
143 _connectionsMutex.unlock();
151 const auto deadline = QDeadlineTimer(
WAIT_TIME);
152 while (!deadline.hasExpired()) {
153 bool hasWork =
false;
154 _workersMutex.lock();
155 for (
const auto &worker : _workers) {
156 if (worker && !worker->isFinished()) {
161 _workersMutex.unlock();
167 QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
170 _workersMutex.lock();
171 for (
auto it: std::as_const(_workers)) {
172 if (!it->isFinished()) {
174 it->waitForFinished();
177 _workersMutex.unlock();
183 QMutexLocker locer(&_connectionsMutex);
185 if (!_connections.contains(
id)) {
195 QMutexLocker locer(&_connectionsMutex);
197 if (!_connections.contains(
id)) {
212 QMutexLocker locer(&_connectionsMutex);
214 if (!_connections.contains(target) || _connections[target]) {
218 _connections[target]->unBan();
224 QAbstractSocket *socket;
229 socket =
new SslSocket(
nullptr);
247 return _socketWorker->run(action);
256 if (action && (!peer || peer->status() < status)) {
257 auto &actionsList = _connectActions[status];
271 QHostInfo::lookupHost(domain, [
this, port, domain, action, status](QHostInfo info) {
273 if (info.error() != QHostInfo::NoError) {
275 qCritical() <<
"The domain name :" + domain +
276 " has error: " + info.errorString();
281 auto addresses = info.addresses();
283 if (addresses.size() > 1) {
284 qWarning() <<
"The domain name :" + domain +
285 " has more 1 ip addresses.";
327 std::bind(&AbstractNode::handleForceRemoveNode,
339QSslConfiguration AbstractNode::getSslConfig()
const {
343QSslConfiguration AbstractNode::selfSignedSslConfiguration(
const EasySSL::SslSrtData &sslData) {
344 QSslConfiguration res = QSslConfiguration::defaultConfiguration();
349 EasySSL::X509 generator(QSharedPointer<EasySSL::RSASSL>::create());
350 EasySSL::SelfSignedSertificate certificate = generator.create(sslData);
351 res.setPrivateKey(certificate.key);
352 res.setLocalCertificate(certificate.crt);
353 res.setPeerVerifyMode(QSslSocket::VerifyNone);
358bool AbstractNode::configureSslSocket(
AbstractNodeInfo *node,
bool fServer) {
363 auto socket =
dynamic_cast<SslSocket*
>(node->sct());
366 QuasarAppUtils::Params::log(
"Invalid ssl socket!! Connection not secure",
367 QuasarAppUtils::Error);
371 socket->setSslConfiguration(_ssl);
373 auto address = node->networkAddress();
374 connect(socket, &QSslSocket::encrypted,
this ,[
this,
address]() {
378 connect(socket, &SslSocket::sslErrorsOcurred,
379 this, &AbstractNode::handleSslErrorOcurredPrivate, Qt::DirectConnection);
384 socket->startServerEncryption();
386 socket->startClientEncryption();
391 return _socketWorker->run(action);
394const QList<QSslError> &AbstractNode::ignoreSslErrors()
const {
395 return _ignoreSslErrors;
398void AbstractNode::setIgnoreSslErrors(
const QList<QSslError> &newIgnoreSslErrors) {
399 _ignoreSslErrors = newIgnoreSslErrors;
402bool AbstractNode::useSelfSignedSslConfiguration(
const EasySSL::SslSrtData &crtData) {
408 _ssl = selfSignedSslConfiguration(crtData);
409 _mode = SslMode::InitSelfSigned;
411 if(!_ignoreSslErrors.contains(QSslError{QSslError::SelfSignedCertificate}))
412 _ignoreSslErrors.push_back(QSslError{QSslError::SelfSignedCertificate});
414 if(!_ignoreSslErrors.contains(QSslError{QSslError::SelfSignedCertificateInChain}))
415 _ignoreSslErrors.push_back(QSslError{QSslError::SelfSignedCertificateInChain});
417 return !_ssl.isNull();
420bool AbstractNode::useSystemSslConfiguration(QSslConfiguration config) {
426 _mode = SslMode::InitFromSystem;
428 return !_ssl.isNull();
431bool AbstractNode::disableSSL() {
445void AbstractNode::handleSslErrorOcurredPrivate(SslSocket * sslScocket,
const QList<QSslError> &errors) {
447 QList<QSslError> ignore;
448 for (
auto &error : errors) {
450 if (!_ignoreSslErrors.contains(QSslError{error.error()})) {
451 handleSslErrorOcurred(sslScocket, error);
457 if (ignore.isEmpty())
461 sslScocket->ignoreSslErrors(ignore);
466void AbstractNode::handleSslErrorOcurred(SslSocket *scket,
467 const QSslError &error) {
468 QuasarAppUtils::Params::log(scket->peerAddress().toString() +
" : " + error.errorString(),
469 QuasarAppUtils::Error);
471 QuasarAppUtils::Params::log(
"Error code: " + QString::number(error.error()),
472 QuasarAppUtils::Error);
478 return _closeConnectionAfterBadRequest;
482 _closeConnectionAfterBadRequest = newCloseConnectionAfterBadRequest;
486 return _sendBadRequestErrors;
490 _sendBadRequestErrors = val;
493const QSharedPointer<iParser> &
494AbstractNode::addApiParserImpl(
const QSharedPointer<iParser> &parserObject) {
511 cliAddress = *clientAddress;
513 cliAddress =
HostAddress{socket->peerAddress(), socket->peerPort()};
516 _connectionsMutex.lock();
518 if (_connections.contains(cliAddress)) {
519 auto info =_connections.value(cliAddress);
520 info->setSct(socket);
521 info->setIsLocal(clientAddress);
523 _connectionsMutex.unlock();
525 if (!info->isValid()) {
535 info->setIsLocal(clientAddress);
537 _connections[cliAddress] = info;
539 _connectionsMutex.unlock();
542 this, &AbstractNode::avelableBytes, Qt::DirectConnection);
546 this, &AbstractNode::handleNodeStatusChanged,
547 Qt::QueuedConnection);
550 handleNodeStatusChanged(info, info->status());
556 Qt::QueuedConnection);
559 QTimer::singleShot(
WAIT_TIME,
this, [
this, cliAddress]() {
560 checkConfirmendOfNode(
getInfoPtr(cliAddress));
568ParserResult AbstractNode::parsePackage(
const QSharedPointer<AbstractData> &pkg,
571 return _apiVersionParser->
parsePackage(pkg, pkgHeader, sender);
574QSharedPointer<AbstractData> AbstractNode::genPackage(
unsigned short cmd,
575 AbstractNodeInfo *sender)
const {
576 if (_apiVersionParser)
587 if (!target || !target->isValid()) {
589 qCritical() <<
"Destination server not valid!";
593 if (!target->waitForConnected()) {
594 qCritical() <<
"no connected to server! " + target->errorString();
598 return _dataSender->sendData(pkg.
toBytes(), target,
true);
612 qDebug() <<
"Response not sent because client == null";
621 bool convert =
false;
633 auto wrap = QSharedPointer<BigDataWraper>::create();
641 qCritical() <<
"Response not sent because dont create package from object";
646 qCritical() <<
"Response not sent!";
659 qCritical() <<
"Bad request detected, bud response command not sent!"
660 " because trust not changed";
664 " because trust defined";
708 return "Not running";
712 return QString(
"%0 / %1").arg(
connectionsCount()).arg(maxPendingConnections());
716 QList<HostAddress> list = {};
718 QMutexLocker locer(&_connectionsMutex);
720 for (
auto i = _connections.begin(); i != _connections.end(); ++i) {
721 if (i.value()->isBanned()) {
722 list.push_back(i.key());
732 QMutexLocker locer(&_connectionsMutex);
734 for (
auto i : _connections) {
735 if (i->isConnected()) {
745 QMutexLocker locer(&_connectionsMutex);
747 for (
auto i : _connections) {
762 if (!(info && info->
isValid())) {
771 QAbstractSocket* socket =
nullptr;
777 socket =
new SslSocket(
nullptr);
784 socket->setSocketDescriptor(handle);
787 qCritical() <<
"Income connection from banned address";
795 qCritical() <<
"Failed to register new socket";
805 _socketWorker->run(action);
814 auto objTrust = ptr->trust();
824 ptr->setTrust(objTrust + diff);
836 if (!_connections.contains(
id)) {
840 if (!_receiveData.contains(
id)) {
844 auto &pkg = _receiveData[id]->_pkg;
845 auto &hdrArray = _receiveData[id]->_hdrArray;
848 const int headerSize =
sizeof(Header);
850 auto socket = sender->
sct();
858 auto array = hdrArray;
859 while (socket->bytesAvailable() > 0) {
860 array += socket->readAll();
863 const int arraySize = array.size();
866 while (arraySize > workIndex) {
868 int offset = arraySize - workIndex;
870 if (pkg.hdr.isValid()) {
873 int dataLength = std::min(
static_cast<int>(pkg.hdr.size - pkg.data.size()),
874 arraySize - workIndex);
875 pkg.data.append(array.mid(workIndex, dataLength));
877 workIndex += dataLength;
880 }
else if (offset >= headerSize) {
887 array.data() + workIndex, headerSize);
889 if (!pkg.hdr.isValid())
892 int dataLength = std::min(
static_cast<int>(pkg.hdr.size),
893 arraySize - headerSize - workIndex);
895 pkg.data.append(array.mid(workIndex + headerSize, dataLength));
897 workIndex += headerSize + dataLength;
902 unsigned char dataLength =
static_cast<unsigned char>(arraySize - workIndex);
903 hdrArray += array.mid(workIndex, dataLength);
904 workIndex += dataLength;
908 newWork(pkg, sender,
id);
911 }
else if (
static_cast<unsigned int>(pkg.data.size()) >= pkg.hdr.size) {
912 qWarning() <<
"Invalid Package received." + pkg.toString();
921void AbstractNode::handleWorkerStoped() {
922 auto senderObject =
dynamic_cast<QFutureWatcher <bool>*
>(sender());
926 _workersMutex.lock();
927 _workers.remove(senderObject);
928 _workersMutex.unlock();
934void AbstractNode::handleForceRemoveNode(
HostAddress node) {
937 info->removeSocket();
941void AbstractNode::handleBeginWork(QSharedPointer<QH::AbstractTask> work) {
943 auto executeObject = [
this, work]() ->
bool {
947 return work->execute(
this);
950 QMutexLocker locer(&_threadPoolMutex);
953 auto worker =
new QFutureWatcher <bool>();
954 worker->setFuture(QtConcurrent::run(_threadPool, executeObject));
956 _workersMutex.lock();
957 _workers.insert(worker);
958 _workersMutex.unlock();
961 connect(worker, &QFutureWatcher<bool>::finished,
962 this, &AbstractNode::handleWorkerStoped);
966bool AbstractNode::listen(
const HostAddress &address) {
970QSharedPointer<AbstractData>
974 auto value = _apiVersionParser->searchPackage(pkg.
hdr.
command, sender);
976 qDebug() <<
"Package type not registered!"
977 " Please use the registerPackageType method before parsing."
978 " Example invoke registerPackageType<MyData>() into constructor of you client and server nodes.";
983 value->fromPakcage(pkg);
988 QMutexLocker locer(&_connectionsMutex);
990 return _connections.keys();
995 QList<HostAddress> result;
997 QMutexLocker locer(&_connectionsMutex);
998 for (
auto i : _connections) {
999 if (i->isConnected()) {
1000 result.push_back(i->networkAddress());
1011 qCritical() <<
"The remote host not found or dns server not responce.";
1017 qCritical() <<
"The remote node is banned or serve is overload.";
1022 qCritical() <<
"The unknown error ocurred.";
1034 if (!parser || parser->node() !=
this)
1037 return !addApiParserImpl(parser).isNull();
1043 return _tasksheduller->shedule(task);
1047 _tasksheduller->remove(taskId);
1051 return _tasksheduller->taskCount();
1060 auto executeObject = [pkg, sender, id,
this]() {
1068#ifdef HEART_PRINT_PACKAGES
1069 QuasarAppUtils::Params::log(QString(
"Package received! %0").arg(data->toString()), QuasarAppUtils::Info);
1074 auto message = QString(
"Package not parsed! %0 \nresult: %1. \n%2").
1098 qInfo() << _apiVersionParser->toString();
1104 _confirmNodeMutex.lock();
1105 sender->updateConfirmStatus();
1106 _confirmNodeMutex.unlock();
1113 QMutexLocker locer(&_threadPoolMutex);
1116 auto worker =
new QFutureWatcher <bool>();
1117 worker->setFuture(QtConcurrent::run(_threadPool, executeObject));
1119 _workersMutex.lock();
1120 _workers.insert(worker);
1121 _workersMutex.unlock();
1123 connect(worker, &QFutureWatcher<bool>::finished,
1124 this, &AbstractNode::handleWorkerStoped);
1133 return _connections;
1149 auto socket =
dynamic_cast<SslSocket*
>(node->
sct());
1152 QuasarAppUtils::Params::log(
"Failed to preparet to configure ssl socket.",
1153 QuasarAppUtils::Error);
1159 if (!socket->isEncrypted()) {
1160 if (!configureSslSocket(node, !node->
isLocal())) {
1161 QuasarAppUtils::Params::log(
"Failed to configure ssl socket.",
1162 QuasarAppUtils::Error);
1185 if (!_apiVersionParser->sendSupportedAPI(node)) {
1186 qCritical() <<
"Failed to sent version information to dist node";
1200 QAbstractSocket::SocketError errorCode,
1201 QString errorString) {
1204 QString message(
"Network error occured on the %0 node. Message: %1");
1221void AbstractNode::initThreadId()
const {
1225void AbstractNode::initThreadPool() {
1228 QMutexLocker lock(&_threadPoolMutex);
1229 _threadPool =
new QThreadPool();
1230 _threadPool->setObjectName(
"PackageWorker");
1231 _threadPool->setMaxThreadCount(QThread::idealThreadCount());
1235void AbstractNode::deinitThreadPool() {
1236 QMutexLocker lock(&_threadPoolMutex);
1244 _threadPool =
nullptr;
1248 static auto thread = QThread::currentThread();
QSharedPointer< PKG::AbstractData > searchPackage(unsigned short cmd, AbstractNodeInfo *sender) const
searchPackage This method search package recursive in all registered pararsers. Searching will be in ...
const QSharedPointer< QH::iParser > & addApiParser(const QSharedPointer< QH::iParser > &parserObject)
addApiParser This method add new Api parser for this node.
ParserResult parsePackage(const QSharedPointer< PKG::AbstractData > &pkg, const Header &pkgHeader, AbstractNodeInfo *sender) override
parsePackage This is main method of all childs classes of an AbstractNode class. This method work on ...
APIVersionParser(AbstractNode *node)
void sigNoLongerSupport(const QString &ApiKey, unsigned short version)
sigNoLongerSupport This signal will be emit when node receive incomplite versions.
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.
AbstractNodeInfo(QAbstractSocket *sct=nullptr, const HostAddress *address=nullptr)
AbstractNodeInfo.
NodeCoonectionStatus status() const
status This method return status of the node connection.
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 statusChaned(QH::AbstractNodeInfo *thisNode, QH::NodeCoonectionStatus status)
statusChaned This signal emitted when nodes status is changed.
virtual void removeSocket()
removeSocket This method use for remove socket. You can override this method for handle this event.
virtual bool isValid() const
isValid - Check valid of node. This method check connect status of socket.
QAbstractSocket * sct() const
sct This method return socket of connection.
virtual bool isBanned() const
isBanned - check node which banned.
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.
void sigPingReceived(const QSharedPointer< QH::PKG::Ping > &ping)
sigPingReceived This method emited
int sheduledTaskCount() const
sheduledTaskCount This method return count of sheduled tasks.
QSharedPointer< ApiType > addApiParserNative(Args &&... arg)
addApiParserNative This is template metod that add sipport of new apiparser ApiType
QHash< HostAddress, AbstractNodeInfo * > connections() const
connections - Return hash map of all connections of this node.
QSharedPointer< PKG::AbstractData > prepareData(const Package &pkg, AbstractNodeInfo *sender) const
prepareData This is private method for preparing package from the byteArray.
QList< HostAddress > connectionsList() const
connectionsList This method return list of all node connections
bool fSendBadRequestErrors() const
fSendBadRequestErrors This property enable or disable sending feedback to connected node when them se...
virtual void nodeErrorOccured(QH::AbstractNodeInfo *nodeInfo, QAbstractSocket::SocketError errorCode, QString errorString)
nodeErrorOccured This slot invoked when error ocured in the nodeInfo.
virtual void addNodeFailed(AddNodeError error)
addNodeFailed This method will be invoked when trying to add new node are failed. So override this me...
virtual void nodeAddedSucessful(AbstractNodeInfo *node)
nodeAddedSucessful This method will be invoked when new node added successful.
QSharedPointer< QH::iParser > selectParser(unsigned short cmd, AbstractNodeInfo *sender) const
selectParser This method select parser by command and sender.
bool removeNode(const HostAddress &nodeAdderess)
removeNode - Remove node and disconnected forom node (server).
virtual void stop()
stop - Stopped this node and close all network connections.
virtual bool changeTrust(const HostAddress &id, int diff)
changeTrust This method change trust of connected node.
virtual void nodeConnected(AbstractNodeInfo *node)
nodeConnected This method invocked when the node status changed to "connected" default implementatio ...
QList< HostAddress > banedList() const
banedList This method retrun list of banned clients of nodes.
virtual QString connectionState() const
connectionState This method return string value about the cocction state.
virtual bool sendPackage(const Package &pkg, QAbstractSocket *target) const
sendPackage This method prepare and send to target address a package.
bool sheduleTask(const QSharedPointer< AbstractTask > &task)
sheduleTask This method shedule execute task on this node.
virtual bool isBanned(const AbstractNodeInfo *socket) const
isBanned This method checks if the node is banned.
static QThread * mainThreadID()
mainThreadID This method return the pointer to main thread
virtual AbstractNodeInfo * createNodeInfo(QAbstractSocket *socket, const HostAddress *clientAddress=nullptr) const
createNodeInfo This method create a nodeInfo object. override this method for create your own nodeInf...
bool addApiParser(const QSharedPointer< iParser > &parser)
addApiParser This method add new Api parser for this node.
bool addNode(const HostAddress &address)
addNode - Connect to node (server) with address.
void removeTask(int taskId)
removeTask This method remove task from sheduler.
virtual void ban(const HostAddress &target)
ban - This method set for target connection a trust property to 0 and target connection will been abo...
HostAddress address() const
address - Thim method return own network address of current node (server).
virtual void badRequest(const HostAddress &address, const Header &req, const PKG::ErrorData &err, qint8 diff=REQUEST_ERROR)
badRequest This method is send data about error of request.
SslMode getMode() const
getMode - This method return SSL mode of corrent node (server).
void prepareForDelete() override
prepareForDelete This method must be prepare object for delete. Override this for working main functi...
AbstractNode(QObject *ptr=nullptr)
AbstractNode - Base constructor of node.
virtual WorkState getWorkState() const
getWorkState - This method collect general information about this server. For more information about ...
void incomingConnection(qintptr handle) override final
incomingConnection This is ovverided method of QTCPServer.
QList< HostAddress > activeConnectionsList() const
activeConnectionsList This method return list of actived nodes connections
virtual AbstractNodeInfo * getInfoPtr(const HostAddress &id)
getInfoPtr - This method return information class pointer about netwok connection....
virtual bool registerSocket(QAbstractSocket *socket, const HostAddress *address=nullptr)
registerSocket This method registration new socket object.
void sigNoLongerSupport(const QString &ApiKey, unsigned short version)
sigNoLongerSupport is some as a APIVersionParser::sigNoLongerSupport. This signal just retronslate th...
virtual void nodeConfirmend(AbstractNodeInfo *node)
nodeConfirmend This method invocked when the node status changed to "confirmend" default implementati...
virtual QString getWorkStateString() const
getWorkStateString This method generate string about work state of server.
void setSendBadRequestErrors(bool value)
setSendBadRequestErrors This method enable or disable the fSendBadRequestErrors property.
virtual bool run(const QString &addres, unsigned short port)
run This method implement deployment a network node (server) on selected address.
virtual void unBan(const HostAddress &target)
unBan - This method set for target connection a trust property to 100.
bool ping(const HostAddress &address)
ping This method send ping package to address for testing connection.
virtual void nodeDisconnected(AbstractNodeInfo *node)
nodeConnected This method invocked when the node status changed to "disconnected" default implementat...
void setCloseConnectionAfterBadRequest(bool value)
setSendBadRequestErrors This method enable or disable the fcloseConnectionAfterBadRequest property.
int confirmendCount() const
connectionsCount - Return count of nodes with status confirmend.
bool fCloseConnectionAfterBadRequest() const
fCloseConnectionAfterBadRequest This propery enable or disable droping connection after badRequests....
int connectionsCount() const
connectionsCount - Return count fo connections (connections with status connected)
virtual unsigned int sendData(const PKG::AbstractData *resp, const HostAddress &address, const Header *req=nullptr)
sendData This method send data object another to node
virtual void receivePing(const QSharedPointer< QH::PKG::Ping > &ping)
receivePing This method invoked when node receive new ping object.
AsyncLauncher(QThread *thread)
AsyncLauncher This is base constructor of the AsyncLauncher object.
std::function< bool()> Job
DataSender(QThread *thread)
The Host Address class this is wrapper of QHostAddress. Contains the NetworkAddress and network port.
unsigned short port() const
The port method return port of node.
QString toString() const
toString this method convert the Host Address value to string value.
The AbstractData class is provide base functions for transport data by network For create you own pac...
virtual bool toPackage(Package &package, const DistVersion &reqVersion, unsigned int triggerHash=0) const
toPackage This method convert this class object to the package. For more info see Package class.
virtual unsigned short cmd() const =0
cmd - This is command of this object, (for generate cmd use macross QH_PACKAGE)
BadRequest(unsigned char errocode=ErrorCodes::InvalidRequest, const QString &err="")
BadRequest.
The CloseConnection class - This commanad is request for close connection on parent node of connectio...
The Ping class - test class for translate data on network.
The Package struct. This is base structure for transporting data by network between QH nodes....
QByteArray data
data This is source data of package.
Header hdr
hdr This is header of package. For more information see the Header struct.
bool isValid() const override
isValid This method validation a current package. Default implementation is checked a header and comp...
QString toString() const
toString This method convert a package information to a string label.
static unsigned int maximumSize()
maximumSize This method return maximu size of pacakge. If pacakge large the maximum size then package...
QByteArray toBytes() const
toBytes This method convert a current object to bytes array.
void sigPushWork(QSharedPointer< QH::AbstractTask > work)
sigPushWork This signal emited when the task work neet to execute.
TcpSocket(QObject *parent)
The WorkState class is simple class with data of work state of node.
void setActiveConnections(const QList< HostAddress > &newActiveConnections)
setActiveConnections this method sets new list of active connections.
void setMaxConnectionCount(int value)
setMaxConnectionCount this method set a new value of limit of connections.
void setIsRun(bool value)
setIsRun This method set new value for run flag.
void setBanedList(const QList< HostAddress > &banedList)
setBanedList -this method set banned list for this object.
void setConnections(const QList< HostAddress > &connections)
setConnections This method sets connections list.
static QString pareseResultToString(const ParserResult &parseResult)
pareseResultToString This method convert ParserResult value to string.
#define WAIT_CONFIRM_TIME
The PKG namesapce - this namespace contains all default packages of the Heart library....
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
ParserResult
The ParserResult enum. Error - parser detect a errorob package. NotProcessed - the parser does not kn...
@ NotProcessed
the parser does not know what to do with the package or has not finished processing it.
@ Error
parser detect a errorob package.
@ Processed
the parser finished processing correctly.
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.
AddNodeError
The AddNodeError enum contains error code that can be occured after invoke the AbstractNode::addNode ...
@ RegisterSocketFailed
This error ocurred when you try add baned node or server is overrload.
@ HostNotFound
This error ocurred when DNS server not responce to node or node can't find the server ip address by h...
@ Baned
Node with this trust value is forbidden.
@ Undefined
Undefined node.
SslMode
The SslMode enum This enum contatins options for set ssl mode of node (server). For more information ...
@ NoSSL
This is not secure connection without ssl encription. It is default value of new any node see Abstrac...
The ErrorData struct is simple structure for contains data of the error.