This commit is contained in:
cora32 2015-12-12 02:46:27 +03:00
parent 4cf3b15f36
commit b39014f783
2 changed files with 78 additions and 42 deletions

View File

@ -213,8 +213,8 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("NConnect failed (curl_code: " + QString::number(res) + ") [<a href=\"" + QString(ip) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>]");
stt->doEmitionDebugFoundData("NConnect failed (curl_code: " + QString::number(res) + ") [<a href=\"" + QString(ip) +
"/\"><font color=\"#0084ff\">" + QString(ip) + " Port:" + QString::number(port) + "</font></a>]");
}
SOCKET eNobuffSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
shutdown(eNobuffSocket, SD_BOTH);

View File

@ -110,30 +110,42 @@ bool HikVis::checkHikk(const char * sDVRIP, int port) {
char tBuff[32] = { 0 };
int offset = 0;
int sz = 0;
int bsz = 0;
while ((sz = recvWT(sock, tBuff, 16, gTimeOut, &bTO)) > 0) {
memcpy(buff + offset, tBuff, sz);
offset = sz;
bsz += sz;
}
shutdown(sock, SD_BOTH);
closesocket(sock);
if (buff[3] == 0x10) {
if (bsz == 0) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("iVMS check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return true;
}
else {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("iVMS check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
stt->doEmitionDebugFoundData("iVMS check failed - size = 0, code = (" + QString::number(sz) + ") [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return false;
}
else {
if (buff[3] == 0x10) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("iVMS check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return true;
}
else {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("iVMS check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return false;
}
}
}
shutdown(sock, SD_BOTH);
@ -189,30 +201,42 @@ bool HikVis::checkRVI(const char * sDVRIP, int port) {
char tBuff[32] = { 0 };
int offset = 0;
int sz = 0;
int bsz = 0;
while ((sz = recvWT(sock, tBuff, 16, gTimeOut, &bTO)) > 0) {
memcpy(buff + offset, tBuff, sz);
offset = sz;
bsz += sz;
}
shutdown(sock, SD_BOTH);
closesocket(sock);
if (buff[0] == -80) {
if (bsz == 0) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("RVI check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return true;
}
else {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("RVI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
stt->doEmitionDebugFoundData("RVI check failed - size = 0, code = (" + QString::number(sz) + ") [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return false;
}
else {
if (buff[0] == -80) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("RVI check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return true;
}
else {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("RVI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
stt->doEmitionDebugFoundData("Buffer: " + QString(buff).toLocal8Bit().toHex());
}
return false;
}
}
}
shutdown(sock, SD_BOTH);
@ -268,39 +292,51 @@ bool HikVis::checkSAFARI(const char * sDVRIP, int port) {
char tBuff[128] = { 0 };
int offset = 0;
int sz = 0;
int bsz = 0;
while ((sz = recvWT(sock, tBuff, 128, gTimeOut, &bTO)) > 0) {
memcpy(buff + offset, tBuff, sz);
offset = sz;
bsz += sz;
}
shutdown(sock, SD_BOTH);
closesocket(sock);
if (buff[0] != '\0') {
if (bsz == 0) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("SAFARI check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return true;
}
if (buff[0] == 8) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("SAFARI check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return true;
}
else {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("SAFARI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
stt->doEmitionDebugFoundData("SAFARI check failed - size = 0, code = (" + QString::number(sz) + ") [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return false;
}
else {
if (buff[0] != '\0') {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("SAFARI check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return true;
}
if (buff[0] == 8) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("SAFARI check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return true;
}
else {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("SAFARI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return false;
}
}
}
shutdown(sock, SD_BOTH);