diff --git a/ActivityDrawerTh_HorNet.cpp b/ActivityDrawerTh_HorNet.cpp index 36dd7d9..b30d1be 100644 --- a/ActivityDrawerTh_HorNet.cpp +++ b/ActivityDrawerTh_HorNet.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #include "ActivityDrawerTh_HorNet.h" #include "STh.h" @@ -34,4 +35,42 @@ void ActivityDrawerTh_HorNet::run() Activity = 0; msleep(130); }; +======= +#include "ActivityDrawerTh_HorNet.h" +#include "STh.h" + +void ActivityDrawerTh_HorNet::doEmitDrawActivityLine(QString data) +{ + emit adtHN->sDrawActivityLine(data); +}; +void ActivityDrawerTh_HorNet::doEmitDrawGrid() +{ + emit adtHN->sDrawGrid(); +}; + +void makeActLine(int val) +{ + if(actLst.size() < 50) actLst.push_back(val); + else + { + actLst.pop_front(); + actLst.push_back(val); + }; +}; +void ActivityDrawerTh_HorNet::run() +{ + adtHN->doEmitDrawGrid(); + int maxAct = Activity + 1; + int nm = 0; + while(true) + { + if(maxAct < Activity) maxAct = Activity; + if(maxAct > 1000) nm = maxAct-=1000; + else if(maxAct > 10) nm = maxAct-=10; + makeActLine(((float)Activity/(nm != 0 ? nm : 1)) * 10); + adtHN->doEmitDrawActivityLine(QString::number(Activity) + "b"); + Activity = 0; + msleep(130); + }; +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d }; \ No newline at end of file diff --git a/ActivityDrawerTh_HorNet.h b/ActivityDrawerTh_HorNet.h index 53ccc43..8fc30ef 100644 --- a/ActivityDrawerTh_HorNet.h +++ b/ActivityDrawerTh_HorNet.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #ifndef ACTIVITYDRAWERTH_HORNET_H #define ACTIVITYDRAWERTH_HORNET_H @@ -19,3 +20,26 @@ protected: }; extern ActivityDrawerTh_HorNet *adtHN; #endif // ACTIVITYDRAWERTH_HORNET_H +======= +#ifndef ACTIVITYDRAWERTH_HORNET_H +#define ACTIVITYDRAWERTH_HORNET_H + +#pragma once +#include "nesca_3.h" + +class ActivityDrawerTh_HorNet : public QThread +{ + Q_OBJECT + +public: signals: void sDrawActivityLine(QString); +public: signals: void sDrawGrid(); + +public: + static void doEmitDrawActivityLine(QString data); + static void doEmitDrawGrid(); +protected: + void run(); +}; +extern ActivityDrawerTh_HorNet *adtHN; +#endif // ACTIVITYDRAWERTH_HORNET_H +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/CheckKey_Th.cpp b/CheckKey_Th.cpp index 317bfda..419eebb 100644 --- a/CheckKey_Th.cpp +++ b/CheckKey_Th.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #pragma once #include "CheckKey_Th.h" #include "CheckProxy_Th.h" @@ -239,3 +240,246 @@ void CheckKey_Th::run() { KeyCheckerMain(); }; +======= +#pragma once +#include "CheckKey_Th.h" +#include "CheckProxy_Th.h" +#include "STh.h" +int emitIfOK = -1; +int KeyCheckerMain() +{ + int kLen = strlen(trcPersKey); + if(kLen == 0) + { + stt->doEmitionRedFoundData("[Key check] Key field is empty."); + return -1; + } + else if(kLen < 32) + { + stt->doEmitionRedFoundData("[Key check] Key length is not valid."); + return -1; + }; + char msg[1024] = {0}; + char ndbServer[64] = {0}; + char ndbScript[64] = {0}; + + sockaddr_in sockAddr; + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(atoi(trcSrvPortLine)); + + strcpy(msg, "GET "); + strcat(msg, "/"); + strcat(msg, trcScr); + strcat(msg, " HTTP/1.0\r\nHost: "); + strcat(msg, trcSrv); + strcat(msg, "\r\nX-Nescav3: True"); + strcat(msg, "\r\nConnection: close"); + strcat(msg, "\r\n\r\n"); + + HOSTENT *host; + +#if defined(WIN32) + if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(trcSrv); + else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(trcSrv); + else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + + stt->doEmitionYellowFoundData("[Key check] Requesting server ip..."); + int test = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + if(test == -1) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -connect() returned. Cannot connect to balancer! " + QString::number(WSAGetLastError()) + "."); + closesocket(sock); + return -1; +#pragma endregion + }; + + test = send(sock, msg, strlen(msg), 0); + + if(test == -1) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -send() returned. Cannot send to balancer! " + QString::number(WSAGetLastError()) + "."); + closesocket(sock); + return -1; +#pragma endregion + }; + + ZeroMemory(msg, sizeof(msg)); + int ror = sizeof(msg); + + test = recv(sock, msg, sizeof(msg), 0); + char buff[512] = {0}; + while((test = recv(sock, msg, sizeof(msg), 0)) != 0) + { + strcat(msg, buff); + }; + + if(test == -1) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -recv() returned. Cannot recv from balancer! " + QString::number(WSAGetLastError()) + "."); + closesocket(sock); + return -1; +#pragma endregion + }; + + char *t1; + char *t2; + if(strstr(msg, "http://") != NULL) + { + t1 = strstr(msg, "http://"); + if(strstr((char*)(t1 + strlen("http://")), "/") != NULL) + { + t2 = strstr((char*)(t1 + strlen("http://")), "/"); + int ln = t2 - t1 - strlen("http://"); + if(ln > 64) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!"); + closesocket(sock); + return -1; +#pragma endregion + } + else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln); + + + if(strlen(t2) > 64) + { + #pragma region QTGUI_Area + stt->doEmitionYellowFoundData("[Key check] -Fragmentation detected!"); + #pragma endregion + if(strstr(t2, "\r\n") != NULL) + { + char *t3 = strstr(t2, "\r\n"); + int y = (int)(t3 - t2); + + if(y > 64) + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!"); + closesocket(sock); + return -1; + #pragma endregion + } + else + { + strncpy(ndbScript, t2, y); + }; + } + else + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!"); + closesocket(sock); + return -1; + #pragma endregion + }; + } else strcpy(ndbScript, t2); + } + else + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Cannot receive script value!"); + closesocket(sock); + return -1; +#pragma endregion + }; + + ZeroMemory(msg, sizeof(msg)); + +#pragma region QTGUI_Area + stt->doEmitionGreenFoundData("[Key check] -OK. -Server string aquired! Checking key..."); + closesocket(sock); +#pragma endregion + + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(atoi(trcSrvPortLine)); + strcpy(msg, "GET "); + strcat(msg, "/api/checkaccount?key="); + strncat(msg, trcPersKey, 32); + strcat(msg, " HTTP/1.0\r\nHost: "); + strcat(msg, ndbServer); + strcat(msg, "\r\nConnection: close"); + strcat(msg, "\r\n\r\n"); + +#if defined(WIN32) + if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ndbServer); + else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ndbServer); + else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + + int c = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + if(c == SOCKET_ERROR) + { + stt->doEmitionRedFoundData("[Key check] -Connection timeout."); + closesocket(sock); + return -1; + }; + c = send(sock, msg, strlen(msg), 0); + if(c == SOCKET_ERROR) + { + stt->doEmitionRedFoundData("[Key check] -Send error."); + closesocket(sock); + return -1; + }; + ZeroMemory(msg, sizeof(msg)); + test = recv(sock, msg, 512, 0); + + if(strstr(msg, "202 Accepted") != NULL) + { +#pragma region QTGUI_Area + stt->doEmitionGreenFoundData("[Key check] -OK. Key is valid!"); +#pragma endregion + closesocket(sock); + if(emitIfOK == 0) stt->doEmitionStartScanIP(); + else if(emitIfOK == 1) stt->doEmitionStartScanDNS(); + else if(emitIfOK == 2) stt->doEmitionStartScanImport(); + return 1; + } + else if(strstr(msg, "400 Bad Request") != NULL) + { +#pragma region QTGUI_Area + QString errorDef = GetNSErrorDefinition(msg, "notify"); + if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required."); + else stt->doEmitionYellowFoundData("[NS-Track] -FAIL! [400 Bad Request : " + GetNSErrorDefinition(msg, "notify") + "]"); +#pragma endregion + closesocket(sock); + return -1; + } + else + { +#pragma region QTGUI_Area + stt->doEmitionYellowFoundData("[Key check] -FAIL! An error occured. (" + QString::number(WSAGetLastError()) + ")"); + if(gDebugMode) stt->doEmitionDebugFoundData(QString(msg)); +#pragma endregion + closesocket(sock); + return -1; + }; + + ZeroMemory(msg, sizeof(msg)); + closesocket(sock); + } + else + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Balancer replied with invalid string."); + if(gDebugMode) stt->doEmitionDebugFoundData(QString(msg)); + closesocket(sock); + return -1; +#pragma endregion + }; +}; + +void CheckKey_Th::run() +{ + KeyCheckerMain(); +}; +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/CheckKey_Th.h b/CheckKey_Th.h index 7c31e8f..ff41f6c 100644 --- a/CheckKey_Th.h +++ b/CheckKey_Th.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #ifndef CHECKKEY_TH_H #define CHECKKEY_TH_H @@ -15,3 +16,22 @@ protected: extern CheckKey_Th *chKTh; #endif // CHECKKEY_TH_H +======= +#ifndef CHECKKEY_TH_H +#define CHECKKEY_TH_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" +extern int emitIfOK; +class CheckKey_Th : public QThread +{ + Q_OBJECT + +protected: + void run(); +}; + +extern CheckKey_Th *chKTh; +#endif // CHECKKEY_TH_H +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/CheckProxy_Th.cpp b/CheckProxy_Th.cpp index 4b86a08..f43597c 100644 --- a/CheckProxy_Th.cpp +++ b/CheckProxy_Th.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #include "CheckProxy_Th.h" void CheckProxy_Th::doEmitChangeRedIRCData(QString str) @@ -153,3 +154,160 @@ void CheckProxy_Th::run() { CheckProxyLogic(); }; +======= +#include "CheckProxy_Th.h" + +void CheckProxy_Th::doEmitChangeRedIRCData(QString str) +{ + emit chPTh->changeRedIRCData(str); +}; +void CheckProxy_Th::doEmitChangeGreenIRCData(QString str) +{ + emit chPTh->changeGreenIRCData(str); +}; +void CheckProxy_Th::doEmitChangeYellowIRCData(QString str) +{ + emit chPTh->changeYellowIRCData(str); +}; +void CheckProxy_Th::doEmitChangeRawIRCDataInc(QString str) +{ + emit chPTh->changeRawIRCDataInc(str); +}; +void CheckProxy_Th::doEmitChangeRawIRCDataOut(QString str) +{ + emit chPTh->changeRawIRCDataOut(str); +}; + +void CheckProxyLogic() +{ + destroychPThFlag = false; + QString str1 = ui->ircProxyPort->text(); + QString str2 = ui->ircProxy->text(); + strcpy(ircProxy, str2.toUtf8().data()); + strcpy(ircProxyPort, str1.toUtf8().data()); + + int err, yes = 1; + SOCKET pSock; + char precvBuff[2048] = {0}; + sockaddr_in addr; + addr.sin_family = AF_INET; + addr.sin_port = htons(atoi(ircProxyPort)); + + HOSTENT *host; + +#if defined(WIN32) + if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircProxy); + else if(host = gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.s_addr = inet_addr(ircProxy); + else if(host=gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + pSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + setsockopt(pSock, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(int)); + + if(pSock == INVALID_SOCKET) + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRedIRCData("CheckProxy: -INVALID SOCKET."); +#pragma endregion + } + else + { + if(connect(pSock, (sockaddr*)&addr, sizeof(addr)) != SOCKET_ERROR) + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRawIRCDataOut(QString::fromLocal8Bit("CONNECT 2ip.ru HTTP/1.1\r\n\r\n")); +#pragma endregion + send(pSock, "CONNECT 2ip.ru HTTP/1.1\r\n\r\n", strlen("CONNECT 2ip.ru HTTP/1.1\r\n\r\n"), 0); + + while(recv(pSock, precvBuff, sizeof(precvBuff), 0) > 0) + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRawIRCDataInc(QString::fromLocal8Bit(precvBuff)); +#pragma endregion + if( (strstr(precvBuff, "HTTP/1.1 200 OK") || strstr(precvBuff, "200 OK") + || strstr(precvBuff, "OK 200") || strstr(precvBuff, "200 Connection") + ) + && (strlen(precvBuff) < 150) + && strstr(precvBuff, "404 File Not Found") == NULL + && + ( + strstr(precvBuff, "Invalid Request") == NULL + || strstr(precvBuff, "Invalid request") == NULL || strstr(precvBuff, "invalid request") == NULL + || strstr(precvBuff, "400 Bad Request") == NULL || strstr(precvBuff, " 400 bad request") == NULL + ) + ) + { + +#pragma region QTGUI_Area + chPTh->doEmitChangeRawIRCDataOut(QString::fromLocal8Bit("GET / HTTP/1.1\r\nHost: 2ip.ru\r\n\r\n")); +#pragma endregion + send(pSock, "GET / HTTP/1.1\r\nHost: 2ip.ru\r\n\r\n", strlen("GET / HTTP/1.1\r\nHost: 2ip.ru\r\n\r\n"), 0); + ZeroMemory(precvBuff, sizeof(precvBuff)); + while(recv(pSock, precvBuff, sizeof(precvBuff), 0) > 0) + { + +#pragma region QTGUI_Area + chPTh->doEmitChangeRawIRCDataInc(QString::fromLocal8Bit(precvBuff)); +#pragma endregion + if(strstr(precvBuff, "404 File Not Found") == NULL && strstr(precvBuff, "Invalid Request") == NULL + && strstr(precvBuff, "Invalid request") == NULL && strstr(precvBuff, "invalid request") == NULL + && strstr(precvBuff, "400 Bad Request") == NULL && strstr(precvBuff, "400 bad request") == NULL + && strstr(precvBuff, "404 Not") == NULL && strstr(precvBuff, "404 not") == NULL + && strstr(precvBuff, "500 Internal") == NULL && strstr(precvBuff, "500 internal") == NULL + && strstr(precvBuff, "401 Unauthorized") == NULL && strstr(precvBuff, "401 unauthorized") == NULL + && strstr(precvBuff, "InvalidUrl") == NULL && strstr(precvBuff, "invalidurl") == NULL + && strstr(precvBuff, "Invalid Url") == NULL && strstr(precvBuff, "invalid url") == NULL + && strstr(precvBuff, "Gateway Timeout") == NULL && strstr(precvBuff, "Gateway timeout") == NULL + && strstr(precvBuff, "gateway timeout") == NULL + ) + { + +#pragma region QTGUI_Area + chPTh->doEmitChangeGreenIRCData("[OK] Success! Now using " + QString(ircProxy) + ":" + QString(ircProxyPort) + "."); +#pragma endregion + proxyEnabledFlag = 1; + + closesocket(pSock); + break; + } + else + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRedIRCData("[Fail] " + QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one."); +#pragma endregion + proxyEnabledFlag = 0; + + closesocket(pSock); + break; + }; + }; + break; + } + else + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRedIRCData("[Fail] " + QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one."); +#pragma endregion + proxyEnabledFlag = 0; + + closesocket(pSock); + break; + }; + }; + } + else + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRedIRCData("[Fail] Cannot connect to " + QString(ircProxy) + ":" + QString(ircProxyPort) + "."); +#pragma endregion + proxyEnabledFlag = 0; + }; + }; +}; + +void CheckProxy_Th::run() +{ + CheckProxyLogic(); +}; +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/CheckProxy_Th.h b/CheckProxy_Th.h index d7dabd0..ed5b973 100644 --- a/CheckProxy_Th.h +++ b/CheckProxy_Th.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #ifndef CHECKPROXY_TH_H #define CHECKPROXY_TH_H @@ -26,3 +27,33 @@ protected: }; extern CheckProxy_Th *chPTh; #endif // CHECKPROXY_TH_H +======= +#ifndef CHECKPROXY_TH_H +#define CHECKPROXY_TH_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" + +class CheckProxy_Th : public QThread +{ + Q_OBJECT + +public: signals: void changeRedIRCData(QString); +public: signals: void changeGreenIRCData(QString); +public: signals: void changeYellowIRCData(QString); +public: signals: void changeRawIRCDataInc(QString); +public: signals: void changeRawIRCDataOut(QString); + +public: + void doEmitChangeRedIRCData(QString str); + void doEmitChangeGreenIRCData(QString str); + void doEmitChangeYellowIRCData(QString str); + void doEmitChangeRawIRCDataOut(QString str); + void doEmitChangeRawIRCDataInc(QString str); +protected: + void run(); +}; +extern CheckProxy_Th *chPTh; +#endif // CHECKPROXY_TH_H +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/DrawerTh_GridQoSScanner.cpp b/DrawerTh_GridQoSScanner.cpp index 1b813fa..3913d95 100644 --- a/DrawerTh_GridQoSScanner.cpp +++ b/DrawerTh_GridQoSScanner.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #include "DrawerTh_GridQoSScanner.h" #include "STh.h" @@ -20,4 +21,28 @@ void DrawerTh_GridQoSScanner::run() }; msleep(2000); }; +======= +#include "DrawerTh_GridQoSScanner.h" +#include "STh.h" + +void DrawerTh_GridQoSScanner::doEmitAddLine() +{ + emit dtGridQoS->sAddLine(); +}; + +void DrawerTh_GridQoSScanner::run() +{ + while(QoSScanFlag) + { + if(stt->isRunning() == true) + { + if(widgetIsHidden == false && tray->isVisible() == false) + { + ++QoSStep; + emit dtGridQoS->doEmitAddLine(); + }; + }; + msleep(2000); + }; +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d }; \ No newline at end of file diff --git a/DrawerTh_GridQoSScanner.h b/DrawerTh_GridQoSScanner.h index e544a0a..7f3e4ff 100644 --- a/DrawerTh_GridQoSScanner.h +++ b/DrawerTh_GridQoSScanner.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #ifndef DRAWERTH_GRIDQOSSCANNER_H #define DRAWERTH_GRIDQOSSCANNER_H @@ -21,3 +22,28 @@ protected: extern DrawerTh_GridQoSScanner *dtGridQoS; #endif // DRAWERTH_GRIDQOSSCANNER_H +======= +#ifndef DRAWERTH_GRIDQOSSCANNER_H +#define DRAWERTH_GRIDQOSSCANNER_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" + +class DrawerTh_GridQoSScanner : public QThread +{ + Q_OBJECT + +public: +public: signals: void sAddLine(); + +public: + void doEmitAddLine(); + +protected: + void run(); +}; + +extern DrawerTh_GridQoSScanner *dtGridQoS; +#endif // DRAWERTH_GRIDQOSSCANNER_H +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/DrawerTh_HorNet.cpp b/DrawerTh_HorNet.cpp index 1e92a28..e05208b 100644 --- a/DrawerTh_HorNet.cpp +++ b/DrawerTh_HorNet.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #include "DrawerTh_HorNet.h" void DrawerTh_HorNet::run() @@ -39,4 +40,47 @@ void DrawerTh_HorNet::doEmitionAddLine(int x1, int y1, int x2, int y2) void DrawerTh_HorNet::doEmitionAddDelimLines() { emit dtHN->sAddDelimLines(); +======= +#include "DrawerTh_HorNet.h" + +void DrawerTh_HorNet::run() +{ + qsrand (QDateTime::currentMSecsSinceEpoch()); + int factor = 0; + + int gWidth = ui->graphicLog->width(); + int gHeight = ui->graphicLog->height(); + + dtHN->doEmitionAddDelimLines(); + + while(ME2ScanFlag) + { + if(widgetIsHidden == false && tray->isVisible() == false) + { + ++factor > 9 ? factor = 0 : NULL; + dtHN->doEmitionDrawGrid(); + + for(int i = 0; i < gHeight; i += 10) + { + QApplication::processEvents(); + dtHN->doEmitionAddLine(0, i + factor, gWidth, i + factor); + QApplication::processEvents(); + }; + }; + msleep(200); + }; +}; + +void DrawerTh_HorNet::doEmitionDrawGrid() +{ + emit dtHN->sDrawGrid(); +}; +void DrawerTh_HorNet::doEmitionAddLine(int x1, int y1, int x2, int y2) +{ + emit dtHN->sAddLine(x1, y1, x2, y2); +}; +void DrawerTh_HorNet::doEmitionAddDelimLines() +{ + emit dtHN->sAddDelimLines(); +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d }; \ No newline at end of file diff --git a/DrawerTh_HorNet.h b/DrawerTh_HorNet.h index e47d4bd..9ee4df7 100644 --- a/DrawerTh_HorNet.h +++ b/DrawerTh_HorNet.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #ifndef DRAWERTH_HORNET_H #define DRAWERTH_HORNET_H @@ -24,3 +25,31 @@ protected: extern DrawerTh_HorNet *dtHN; #endif // DRAWERTH_HORNET_H +======= +#ifndef DRAWERTH_HORNET_H +#define DRAWERTH_HORNET_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" + +class DrawerTh_HorNet : public QThread +{ + Q_OBJECT + +public: + static void doEmitionDrawGrid(); + static void doEmitionAddLine(int x1, int y1, int x2, int y2); + static void doEmitionAddDelimLines(); + +public: signals: void sAddDelimLines(); +public: signals: void sAddLine(int, int, int, int); +public: signals: void sDrawGrid(); + +protected: + void run(); +}; + +extern DrawerTh_HorNet *dtHN; +#endif // DRAWERTH_HORNET_H +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/DrawerTh_ME2Scanner.cpp b/DrawerTh_ME2Scanner.cpp index 34accd3..67fd510 100644 --- a/DrawerTh_ME2Scanner.cpp +++ b/DrawerTh_ME2Scanner.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #include "DrawerTh_ME2Scanner.h" #include "STh.h" @@ -145,4 +146,153 @@ void DrawerTh_ME2Scanner::run() }; msleep(150); }; +======= +#include "DrawerTh_ME2Scanner.h" +#include "STh.h" + +void DrawerTh_ME2Scanner::doEmitDrawTextPlacers() +{ + emit dtME2->sDrawTextPlacers(); +}; + +void DrawerTh_ME2Scanner::doEmitionAddPolyLine() +{ + emit dtME2->sAddPolyLine(); +}; +void MakePolygonLine(int gWidth) +{ + vect.clear(); + int x = 0; + int tx = 0; + int xtx = 0; + QPointF qp(0, 20); + vect.append(qp); + int fact1 = 0, + fact2 = 0, + fact3 = 0, + fact4 = 0, + fact5 = 0, + fact6 = 0, + fact7 = 0; + + bool state = stt->isRunning(); + for(int i = 1; i < 130; ++i) + { + x = qrand() % 4 + 2 + i; + xtx = x + tx; + if(xtx > 1 && xtx < 31) + { + qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - AnomC1*2 - fact1 : 20); + if(AnomC1 > 0) + { + if(xtx < 16 ) fact1+=2; + else fact1-=2; + }; + } + + if(xtx > 34 && xtx < 72) + { + qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - WF*2 - fact2 : 20); + + if(WF > 0) + { + if(xtx < 52 ) fact2+=2; + else fact2-=2; + }; + } + + if(xtx > 74 && xtx < 112) + { + qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - BA*2 - fact3 : 20); + + if(BA > 0) + { + if(xtx < 92 ) fact3+=2; + else fact3-=2; + }; + } + + if(xtx > 114 && xtx < 152) + { + qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - Susp*2 - fact4 : 20); + + if(Susp > 0) + { + if(xtx < 132 ) fact4+=2; + else fact4-=2; + }; + } + + if(xtx > 154 && xtx < 192) + { + qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - Overl*2 - fact5 : 20); + + if(Overl > 0) + { + if(xtx < 172 ) fact5+=2; + else fact5-=2; + }; + } + + if(xtx > 194 && xtx < 232) + { + qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - Lowl*2 - fact6 : 20); + + if(Lowl > 0) + { + if(xtx < 212 ) fact6+=2; + else fact6-=2; + }; + } + + if(xtx > 234 && xtx < 269) + { + qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - Alive*2 - fact7 : 20); + + if(Alive > 0) + { + if(xtx < 252 ) fact7+=2; + else fact7-=2; + }; + }; + + vect.append(qp); + tx = x; + }; + AnomC1 = 0; + WF = 0; + BA = 0; + Filt = 0; + Overl = 0; + Lowl = 0; + Alive = 0; + Susp = 0; + vect.append(QPointF(gWidth, 20)); +}; +void DrawerTh_ME2Scanner::run() +{ + int gWidth = ui->graphicLog->width(); + dtME2->doEmitDrawTextPlacers(); + while(ME2ScanFlag) + { + if(widgetIsHidden == false && tray->isVisible() == false) + { + MakePolygonLine(gWidth); + dtME2->doEmitionAddPolyLine(); + } + else + { + msleep(1000); + AnomC1 = 0; + WF = 0; + BA = 0; + Filt = 0; + Overl = 0; + Lowl = 0; + Alive = 0; + Susp = 0; + }; + msleep(150); + }; +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d }; \ No newline at end of file diff --git a/DrawerTh_ME2Scanner.h b/DrawerTh_ME2Scanner.h index fe1f0cd..5af7e8f 100644 --- a/DrawerTh_ME2Scanner.h +++ b/DrawerTh_ME2Scanner.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #ifndef DRAWERTH_ME2SCANNER_H #define DRAWERTH_ME2SCANNER_H @@ -21,3 +22,28 @@ protected: }; extern DrawerTh_ME2Scanner *dtME2; #endif // DRAWERTH_ME2SCANNER_H +======= +#ifndef DRAWERTH_ME2SCANNER_H +#define DRAWERTH_ME2SCANNER_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" + +class DrawerTh_ME2Scanner : public QThread +{ + Q_OBJECT + +public: + static void doEmitionAddPolyLine(); + static void doEmitDrawTextPlacers(); + +public: signals: void sAddPolyLine(); +public: signals: void sDrawTextPlacers(); + +protected: + void run(); +}; +extern DrawerTh_ME2Scanner *dtME2; +#endif // DRAWERTH_ME2SCANNER_H +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/DrawerTh_QoSScanner.cpp b/DrawerTh_QoSScanner.cpp index fb8a96c..b6963f9 100644 --- a/DrawerTh_QoSScanner.cpp +++ b/DrawerTh_QoSScanner.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #pragma once #include "DrawerTh_QoSScanner.h" #include "STh.h" @@ -58,4 +59,66 @@ void DrawerTh_QoSScanner::run() void DrawerTh_QoSScanner::doEmitionAddLine() { emit dtQoS->sAddLine(); +======= +#pragma once +#include "DrawerTh_QoSScanner.h" +#include "STh.h" + +void DrawerTh_QoSScanner::run() +{ + while(QoSScanFlag) + { + tMax = 0; + + if(stt->isRunning() == true && widgetIsHidden == false && tray->isVisible() == false && QOSWait == false) + { + lstOfLabels.clear(); + lstOfLabels.append(Alive); + lstOfLabels.append(AnomC1); + lstOfLabels.append(WF); + lstOfLabels.append(Susp); + lstOfLabels.append(Lowl); + lstOfLabels.append((int)BA); + lstOfLabels.append(Overl); + lstOfLabels.append(ssh); + + QList lstOfLabelsCopy = lstOfLabels; + qSort(lstOfLabelsCopy.begin(), lstOfLabelsCopy.end(), qGreater()); + int curVal = lstOfLabelsCopy[0]; + if(curVal > MaxDataVal) MaxDataVal = curVal; + if(curVal > tMax) tMax = curVal; + + dtQoS->doEmitionAddLine(); + } + else + { + msleep(500); + AnomC1 = 0; + WF = 0; + BA = 0; + Filt = 0; + Overl = 0; + Lowl = 0; + Alive = 0; + Susp = 0; + ssh = 0; + }; + + AnomC1 = 0; + WF = 0; + BA = 0; + Filt = 0; + Overl = 0; + Lowl = 0; + Alive = 0; + Susp = 0; + ssh = 0; + msleep(2000); + }; +}; + +void DrawerTh_QoSScanner::doEmitionAddLine() +{ + emit dtQoS->sAddLine(); +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d }; \ No newline at end of file diff --git a/DrawerTh_QoSScanner.h b/DrawerTh_QoSScanner.h index 27be0e2..3ffeb43 100644 --- a/DrawerTh_QoSScanner.h +++ b/DrawerTh_QoSScanner.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #ifndef DRAWERTH_QOSSCANNER_H #define DRAWERTH_QOSSCANNER_H @@ -20,3 +21,27 @@ protected: extern DrawerTh_QoSScanner *dtQoS; #endif // DRAWERTH_QOSSCANNER_H +======= +#ifndef DRAWERTH_QOSSCANNER_H +#define DRAWERTH_QOSSCANNER_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" + +class DrawerTh_QoSScanner : public QThread +{ + Q_OBJECT + +public: + static void doEmitionAddLine(); + +public: signals: void sAddLine(); + +protected: + void run(); +}; + +extern DrawerTh_QoSScanner *dtQoS; +#endif // DRAWERTH_QOSSCANNER_H +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/DrawerTh_VoiceScanner.cpp b/DrawerTh_VoiceScanner.cpp index b57869f..1699d39 100644 --- a/DrawerTh_VoiceScanner.cpp +++ b/DrawerTh_VoiceScanner.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #include "DrawerTh_VoiceScanner.h" void DrawerTh_VoiceScanner::doEmitAddLine() @@ -131,4 +132,139 @@ void DrawerTh_VoiceScanner::run() ssh = 0; }; }; +======= +#include "DrawerTh_VoiceScanner.h" + +void DrawerTh_VoiceScanner::doEmitAddLine() +{ + emit vsTh->sAddLine(); +}; +void DrawerTh_VoiceScanner::doEmitDrawGrid(int factor) +{ + emit vsTh->sDrawGrid(factor); +}; +void DrawerTh_VoiceScanner::doEmitDrawTextPlacers() +{ + emit vsTh->sDrawTextPlacers(); +}; + +void makeVoiceLine(int Al, int An, int Bd, int Sp, int Lo, int var, int Ovl, int WF, int SSH) +{ + if(vAlivLst.size() < 140) + { + if(Al > 0) vAlivLst.push_back((Al + 1)*10); + } + else + { + vAlivLst.pop_front(); + if(Al > 0) vAlivLst.push_back((Al + 1)*10); + }; + + if(vAnomLst.size() < 140) + { + if(An > 0) vAnomLst.push_back((An + 1)*10); + } + else + { + vAnomLst.pop_front(); + if(An > 0) vAnomLst.push_back((An + 1)*10); + }; + + if(vWFLst.size() < 140) + { + if(Bd > 0) vWFLst.push_back((Bd + 1)*10); + } + else + { + vWFLst.pop_front(); + if(Bd > 0) vWFLst.push_back((Bd + 1)*10); + }; + + if(vSuspLst.size() < 140) + { + if(Sp > 0) vSuspLst.push_back((Sp + 1)*10); + } + else + { + vSuspLst.pop_front(); + if(Sp > 0) vSuspLst.push_back((Sp + 1)*10); + }; + + if(vLowlLst.size() < 140) + { + if(Lo > 0) vLowlLst.push_back((Lo + 1)*10); + } + else + { + vLowlLst.pop_front(); + if(Lo > 0) vLowlLst.push_back((Lo + 1)*10); + }; + + if(vLowlLst.size() < 140) + { + if(var > 0) vBALst.push_back((var + 1)*10); + } + else + { + vBALst.pop_front(); + if(var > 0) vBALst.push_back((var + 1)*10); + }; + + if(vOvrlLst.size() < 140) + { + if(Ovl > 0) vOvrlLst.push_back((Ovl + 1)*10); + } + else + { + vOvrlLst.pop_front(); + if(Ovl > 0) vOvrlLst.push_back((Ovl + 1)*10); + }; + + if(vSSHLst.size() < 140) + { + if(SSH > 0) vSSHLst.push_back((SSH + 1)*10); + } + else + { + vSSHLst.pop_front(); + if(SSH > 0) vSSHLst.push_back((SSH + 1)*10); + }; +}; +void DrawerTh_VoiceScanner::run() +{ + vsTh->doEmitDrawGrid(150); + vsTh->doEmitDrawTextPlacers(); + while(VoiceScanFlag) + { + if(widgetIsHidden == false && tray->isVisible() == false) + { + makeVoiceLine(Alive, AnomC1, WF, Susp, Lowl, BA, Overl, WF, ssh); + Alive = 0; + AnomC1 = 0; + WF = 0; + Filt = 0; + Lowl = 0; + BA = 0; + Overl = 0; + Susp = 0; + ssh = 0; + + vsTh->doEmitAddLine(); + msleep(150); + } + else + { + msleep(500); + Alive = 0; + AnomC1 = 0; + WF = 0; + Filt = 0; + Lowl = 0; + BA = 0; + Overl = 0; + Susp = 0; + ssh = 0; + }; + }; +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d }; \ No newline at end of file diff --git a/DrawerTh_VoiceScanner.h b/DrawerTh_VoiceScanner.h index 3da5997..2a63a80 100644 --- a/DrawerTh_VoiceScanner.h +++ b/DrawerTh_VoiceScanner.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #ifndef DRAWERTH_VOICESCANNER_H #define DRAWERTH_VOICESCANNER_H @@ -22,3 +23,29 @@ protected: }; extern DrawerTh_VoiceScanner *vsTh; #endif // DRAWERTH_VOICESCANNER_H +======= +#ifndef DRAWERTH_VOICESCANNER_H +#define DRAWERTH_VOICESCANNER_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" + +class DrawerTh_VoiceScanner : public QThread +{ + Q_OBJECT + +public: +public: signals: void sAddLine(); +public: signals: void sDrawGrid(int factor); +public: signals: void sDrawTextPlacers(); +public: + void doEmitAddLine(); + void doEmitDrawGrid(int factor); + void doEmitDrawTextPlacers(); +protected: + void run(); +}; +extern DrawerTh_VoiceScanner *vsTh; +#endif // DRAWERTH_VOICESCANNER_H +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d diff --git a/IRCPinger_Th.cpp b/IRCPinger_Th.cpp index 18f9b86..a836ced 100644 --- a/IRCPinger_Th.cpp +++ b/IRCPinger_Th.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #pragma once #include "IRCPinger_Th.h" @@ -27,4 +28,35 @@ void IRCPinger_Th::run() ++globalPinger; msleep(1000); }; +======= +#pragma once +#include "IRCPinger_Th.h" + +void IRCPinger_Th::doEmitChangeRedIRCData(QString str) +{ + emit ircPTh->changeRedIRCData(str); +}; +void IRCPinger_Th::doEmitRestartIRC() +{ + emit ircPTh->RestartIRC(); +}; + +void IRCPinger_Th::run() +{ + while(iWantToConnect) + { + if(globalPinger >= 360) //6min timeout + { +#pragma region QTGUI_Area + ircPTh->doEmitChangeRedIRCData("-//- Ping timeout. Reconnecting... "); +#pragma endregion + + ircPTh->doEmitRestartIRC(); + globalPinger = 0; + msleep(10000); + }; + ++globalPinger; + msleep(1000); + }; +>>>>>>> 5d30af667b7f24c6e91d2bf1888215f755b4378d }; \ No newline at end of file