21#include <easyssl/x509.h>
22#include <easyssl/rsassl.h>
24#include <QSslConfiguration>
25#include <QSslCertificate>
32#include <QtConcurrent>
42#include <qaglobalutils.h>
57 _senderThread =
new QThread();
58 _senderThread->setObjectName(
"Sender");
60 _senderThread->start();
68 addApiParser<BigDataParser>();
70 auto abstractNodeParser = addApiParserNative<AbstractNodeParser>();
77 qRegisterMetaType<QSharedPointer<QH::AbstractTask>>();
79 qRegisterMetaType<QList<QSslError>>();
83 this, &AbstractNode::handleBeginWork);
92 _senderThread->quit();
93 _senderThread->wait();
95 for (
auto it: std::as_const(_receiveData)) {
102 delete _senderThread;
103 delete _socketWorker;
104 delete _tasksheduller;
105 delete _apiVersionParser;
114 if (addres.isEmpty()) {
120 qCritical() <<
"Run fail " << this->errorString();
121 qCritical() <<
"Address:: " << adr.
toString();
148 _connectionsMutex.lock();
149 for (
const auto &i : std::as_const(_connections)) {
152 _connectionsMutex.unlock();
154 _workersMutex.lock();
155 for (
auto it: std::as_const(_workers)) {
156 if (!it->isFinished()) {
158 it->waitForFinished();
161 _workersMutex.unlock();
167 QMutexLocker locer(&_connectionsMutex);
169 if (!_connections.contains(
id)) {
179 QMutexLocker locer(&_connectionsMutex);
181 if (!_connections.contains(
id)) {
196 QMutexLocker locer(&_connectionsMutex);
198 if (!_connections.contains(target) || _connections[target]) {
202 _connections[target]->unBan();
208 QAbstractSocket *socket;
213 socket =
new SslSocket(
nullptr);
231 return _socketWorker->
run(action);
240 if (action && (!peer || peer->status() < status)) {
241 auto &actionsList = _connectActions[status];
255 QHostInfo::lookupHost(domain, [
this, port, domain, action, status](QHostInfo info) {
257 if (info.error() != QHostInfo::NoError) {
259 qCritical() <<
"The domain name :" + domain +
260 " has error: " + info.errorString();
261 addNodeFailed(AddNodeError::HostNotFound);
265 auto addresses = info.addresses();
267 if (addresses.size() > 1) {
268 qWarning() <<
"The domain name :" + domain +
269 " has more 1 ip addresses.";
311 std::bind(&AbstractNode::handleForceRemoveNode,
323QSslConfiguration AbstractNode::getSslConfig()
const {
327QSslConfiguration AbstractNode::selfSignedSslConfiguration(
const EasySSL::SslSrtData &sslData) {
328 QSslConfiguration res = QSslConfiguration::defaultConfiguration();
333 EasySSL::X509 generator(QSharedPointer<EasySSL::RSASSL>::create());
334 EasySSL::SelfSignedSertificate certificate = generator.create(sslData);
335 res.setPrivateKey(certificate.key);
336 res.setLocalCertificate(certificate.crt);
337 res.setPeerVerifyMode(QSslSocket::VerifyNone);
342bool AbstractNode::configureSslSocket(AbstractNodeInfo *node,
bool fServer) {
347 auto socket =
dynamic_cast<SslSocket*
>(node->sct());
350 QuasarAppUtils::Params::log(
"Invalid ssl socket!! Connection not secure",
351 QuasarAppUtils::Error);
355 socket->setSslConfiguration(_ssl);
357 auto address = node->networkAddress();
358 connect(socket, &QSslSocket::encrypted,
this ,[
this,
address]() {
362 connect(socket, &SslSocket::sslErrorsOcurred,
363 this, &AbstractNode::handleSslErrorOcurredPrivate, Qt::DirectConnection);
368 socket->startServerEncryption();
370 socket->startClientEncryption();
375 return _socketWorker->
run(action);
378const QList<QSslError> &AbstractNode::ignoreSslErrors()
const {
379 return _ignoreSslErrors;
382void AbstractNode::setIgnoreSslErrors(
const QList<QSslError> &newIgnoreSslErrors) {
383 _ignoreSslErrors = newIgnoreSslErrors;
386bool AbstractNode::useSelfSignedSslConfiguration(
const EasySSL::SslSrtData &crtData) {
392 _ssl = selfSignedSslConfiguration(crtData);
393 _mode = SslMode::InitSelfSigned;
395 if(!_ignoreSslErrors.contains(QSslError{QSslError::SelfSignedCertificate}))
396 _ignoreSslErrors.push_back(QSslError{QSslError::SelfSignedCertificate});
398 if(!_ignoreSslErrors.contains(QSslError{QSslError::SelfSignedCertificateInChain}))
399 _ignoreSslErrors.push_back(QSslError{QSslError::SelfSignedCertificateInChain});
401 return !_ssl.isNull();
404bool AbstractNode::useSystemSslConfiguration(QSslConfiguration config) {
410 _mode = SslMode::InitFromSystem;
412 return !_ssl.isNull();
415bool AbstractNode::disableSSL() {
425void AbstractNode::handleEncrypted(AbstractNodeInfo *node) {
429void AbstractNode::handleSslErrorOcurredPrivate(SslSocket * sslScocket,
const QList<QSslError> &errors) {
431 QList<QSslError> ignore;
432 for (
auto &error : errors) {
434 if (!_ignoreSslErrors.contains(QSslError{error.error()})) {
435 handleSslErrorOcurred(sslScocket, error);
441 if (ignore.isEmpty())
445 sslScocket->ignoreSslErrors(ignore);
450void AbstractNode::handleSslErrorOcurred(SslSocket *scket,
451 const QSslError &error) {
452 QuasarAppUtils::Params::log(scket->peerAddress().toString() +
" : " + error.errorString(),
453 QuasarAppUtils::Error);
455 QuasarAppUtils::Params::log(
"Error code: " + QString::number(error.error()),
456 QuasarAppUtils::Error);
462 return _closeConnectionAfterBadRequest;
466 _closeConnectionAfterBadRequest = newCloseConnectionAfterBadRequest;
470 return _sendBadRequestErrors;
474 _sendBadRequestErrors = val;
477const QSharedPointer<iParser> &
478AbstractNode::addApiParserImpl(
const QSharedPointer<iParser> &parserObject) {
495 cliAddress = *clientAddress;
497 cliAddress =
HostAddress{socket->peerAddress(), socket->peerPort()};
500 _connectionsMutex.lock();
502 if (_connections.contains(cliAddress)) {
503 auto info =_connections.value(cliAddress);
504 info->setSct(socket);
505 info->setIsLocal(clientAddress);
507 _connectionsMutex.unlock();
509 if (!info->isValid()) {
519 info->setIsLocal(clientAddress);
521 _connections[cliAddress] = info;
523 _connectionsMutex.unlock();
526 this, &AbstractNode::avelableBytes, Qt::DirectConnection);
530 this, &AbstractNode::handleNodeStatusChanged,
531 Qt::QueuedConnection);
534 handleNodeStatusChanged(info, info->status());
540 Qt::QueuedConnection);
543 QTimer::singleShot(
WAIT_TIME,
this, [
this, cliAddress]() {
544 checkConfirmendOfNode(
getInfoPtr(cliAddress));
552ParserResult AbstractNode::parsePackage(
const QSharedPointer<AbstractData> &pkg,
555 return _apiVersionParser->
parsePackage(pkg, pkgHeader, sender);
558QSharedPointer<AbstractData> AbstractNode::genPackage(
unsigned short cmd,
559 AbstractNodeInfo *sender)
const {
560 if (_apiVersionParser)
571 if (!target || !target->isValid()) {
573 qCritical() <<
"Destination server not valid!";
577 if (!target->waitForConnected()) {
578 qCritical() <<
"no connected to server! " + target->errorString();
596 qDebug() <<
"Response not sent because client == null";
605 bool convert =
false;
617 auto wrap = QSharedPointer<BigDataWraper>::create();
625 qCritical() <<
"Response not sent because dont create package from object";
630 qCritical() <<
"Response not sent!";
643 qCritical() <<
"Bad request detected, bud response command not sent!"
644 " because trust not changed";
648 " because trust defined";
692 return "Not running";
696 return QString(
"%0 / %1").arg(
connectionsCount()).arg(maxPendingConnections());
700 QList<HostAddress> list = {};
702 QMutexLocker locer(&_connectionsMutex);
704 for (
auto i = _connections.begin(); i != _connections.end(); ++i) {
705 if (i.value()->isBanned()) {
706 list.push_back(i.key());
716 QMutexLocker locer(&_connectionsMutex);
718 for (
auto i : _connections) {
719 if (i->isConnected()) {
729 QMutexLocker locer(&_connectionsMutex);
731 for (
auto i : _connections) {
746 if (!(info && info->
isValid())) {
755 QAbstractSocket* socket =
nullptr;
761 socket =
new SslSocket(
nullptr);
768 socket->setSocketDescriptor(handle);
771 qCritical() <<
"Income connection from banned address";
779 qCritical() <<
"Failed to register new socket";
789 _socketWorker->
run(action);
798 auto objTrust = ptr->trust();
808 ptr->setTrust(objTrust + diff);
820 if (!_connections.contains(
id)) {
824 if (!_receiveData.contains(
id)) {
825 _receiveData.insert(
id,
new ReceiveData());
828 auto &pkg = _receiveData[id]->_pkg;
829 auto &hdrArray = _receiveData[id]->_hdrArray;
832 const int headerSize =
sizeof(Header);
834 auto socket = sender->
sct();
842 auto array = hdrArray;
843 while (socket->bytesAvailable() > 0) {
844 array += socket->readAll();
847 const int arraySize = array.size();
850 while (arraySize > workIndex) {
852 int offset = arraySize - workIndex;
854 if (pkg.hdr.isValid()) {
857 int dataLength = std::min(
static_cast<int>(pkg.hdr.size - pkg.data.size()),
858 arraySize - workIndex);
859 pkg.data.append(array.mid(workIndex, dataLength));
861 workIndex += dataLength;
864 }
else if (offset >= headerSize) {
871 array.data() + workIndex, headerSize);
873 if (!pkg.hdr.isValid())
876 int dataLength = std::min(
static_cast<int>(pkg.hdr.size),
877 arraySize - headerSize - workIndex);
879 pkg.data.append(array.mid(workIndex + headerSize, dataLength));
881 workIndex += headerSize + dataLength;
886 unsigned char dataLength =
static_cast<unsigned char>(arraySize - workIndex);
887 hdrArray += array.mid(workIndex, dataLength);
888 workIndex += dataLength;
892 newWork(pkg, sender,
id);
895 }
else if (
static_cast<unsigned int>(pkg.data.size()) >= pkg.hdr.size) {
896 qWarning() <<
"Invalid Package received." + pkg.toString();
905void AbstractNode::handleWorkerStoped() {
906 auto senderObject =
dynamic_cast<QFutureWatcher <bool>*
>(sender());
910 _workersMutex.lock();
911 _workers.remove(senderObject);
912 _workersMutex.unlock();
918void AbstractNode::handleForceRemoveNode(HostAddress node) {
921 info->removeSocket();
925void AbstractNode::handleBeginWork(QSharedPointer<QH::AbstractTask> work) {
927 auto executeObject = [
this, work]() ->
bool {
931 return work->execute(
this);
934 QMutexLocker locer(&_threadPoolMutex);
937 auto worker =
new QFutureWatcher <bool>();
938 worker->setFuture(QtConcurrent::run(_threadPool, executeObject));
940 _workersMutex.lock();
941 _workers.insert(worker);
942 _workersMutex.unlock();
945 connect(worker, &QFutureWatcher<bool>::finished,
946 this, &AbstractNode::handleWorkerStoped);
950bool AbstractNode::listen(
const HostAddress &address) {
954QSharedPointer<AbstractData>
960 qDebug() <<
"Package type not registered!"
961 " Please use the registerPackageType method before parsing."
962 " Example invoke registerPackageType<MyData>() into constructor of you client and server nodes.";
967 value->fromPakcage(pkg);
972 QMutexLocker locer(&_connectionsMutex);
974 return _connections.keys();
979 QList<HostAddress> result;
981 QMutexLocker locer(&_connectionsMutex);
982 for (
auto i : _connections) {
983 if (i->isConnected()) {
984 result.push_back(i->networkAddress());
995 qCritical() <<
"The remote host not found or dns server not responce.";
1001 qCritical() <<
"The remote node is banned or serve is overload.";
1006 qCritical() <<
"The unknown error ocurred.";
1018 if (!parser || parser->node() !=
this)
1021 return !addApiParserImpl(parser).isNull();
1027 return _tasksheduller->
shedule(task);
1031 _tasksheduller->
remove(taskId);
1044 auto executeObject = [pkg, sender, id,
this]() {
1052#ifdef HEART_PRINT_PACKAGES
1053 QuasarAppUtils::Params::log(QString(
"Package received! %0").arg(data->toString()), QuasarAppUtils::Info);
1058 auto message = QString(
"Package not parsed! %0 \nresult: %1. \n%2").
1082 qInfo() << _apiVersionParser->
toString();
1088 _confirmNodeMutex.lock();
1089 sender->updateConfirmStatus();
1090 _confirmNodeMutex.unlock();
1097 QMutexLocker locer(&_threadPoolMutex);
1100 auto worker =
new QFutureWatcher <bool>();
1101 worker->setFuture(QtConcurrent::run(_threadPool, executeObject));
1103 _workersMutex.lock();
1104 _workers.insert(worker);
1105 _workersMutex.unlock();
1107 connect(worker, &QFutureWatcher<bool>::finished,
1108 this, &AbstractNode::handleWorkerStoped);
1117 return _connections;
1133 auto socket =
dynamic_cast<SslSocket*
>(node->
sct());
1136 QuasarAppUtils::Params::log(
"Failed to preparet to configure ssl socket.",
1137 QuasarAppUtils::Error);
1143 if (!socket->isEncrypted()) {
1144 if (!configureSslSocket(node, !node->
isLocal())) {
1145 QuasarAppUtils::Params::log(
"Failed to configure ssl socket.",
1146 QuasarAppUtils::Error);
1170 qCritical() <<
"Failed to sent version information to dist node";
1184 QAbstractSocket::SocketError errorCode,
1185 QString errorString) {
1188 QString message(
"Network error occured on the %0 node. Message: %1");
1205void AbstractNode::initThreadId()
const {
1209void AbstractNode::initThreadPool() {
1212 QMutexLocker lock(&_threadPoolMutex);
1213 _threadPool =
new QThreadPool();
1214 _threadPool->setObjectName(
"PackageWorker");
1215 _threadPool->setMaxThreadCount(QThread::idealThreadCount());
1219void AbstractNode::deinitThreadPool() {
1220 QMutexLocker lock(&_threadPoolMutex);
1228 _threadPool =
nullptr;
1232 static auto thread = QThread::currentThread();
The APIVersionParser class This is main parser forthe main command. This parsers work only with the A...
QSharedPointer< PKG::AbstractData > searchPackage(unsigned short cmd, AbstractNodeInfo *sender) const
searchPackage This method search package recursive in all registered pararsers. Searching will be in ...
QHash< QString, QSharedPointer< QH::iParser > > selectParser(const VersionData &distVersion) const
selectParser This method select api parser betwin nodes.
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 ...
void sigNoLongerSupport(const QString &ApiKey, unsigned short version)
sigNoLongerSupport This signal will be emit when node receive incomplite versions.
QString toString() const override
toString This method show all supported commands and them names.
bool sendSupportedAPI(AbstractNodeInfo *dist) const
sendSupportedAPI This method sents all ainformation about suppported api.
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.
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.
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.
The AsyncLauncher class is wraper of the Async class for support moving invokes to thread of the curr...
bool run(const Job &action, bool wait=false)
run This method run the action function in the work thread of this object.
std::function< bool()> Job
The DataSender class this class create a queue for sendet data to network.
bool sendData(const QByteArray &array, void *target, bool await=false) const
sendPackagePrivate This slot move send package to a main 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)
The BadRequest class send response about error to client.
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.
virtual bool isValid() const
isValid This method validation a current package. Default implementation is checked a header and comp...
Header hdr
hdr This is header of package. For more information see the Header struct.
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.
The TaskScheduler class This class contains queue of all shedule tasks.
void sigPushWork(QSharedPointer< QH::AbstractTask > work)
sigPushWork This signal emited when the task work neet to execute.
bool shedule(const QSharedPointer< AbstractTask > &task)
shedule This method shedule new task in this node.
int taskCount() const
taskCount This method return tasks count.
bool remove(const QSharedPointer< AbstractTask > &task)
remove This method remove the task from a tasks queue.
The AbstractSocket class This class is wraper of the QAbstract socket with slot implementation of the...
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 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.