From 7b43e522bd9ef0aa0415e042e3b5dbe41c47feaa Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Wed, 8 Dec 2010 16:27:28 +0200 Subject: [PATCH] =?utf8?q?=D0=92=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE?= =?utf8?q?=D1=82=D0=B5=D0=BA=D0=B5=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80?= =?utf8?q?=D0=B6=D0=BA=D0=B8=20=D0=BF=D1=80=D0=BE=D1=82=D0=BE=D0=BA=D0=BE?= =?utf8?q?=D0=BB=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80?= =?utf8?q?=D0=B0=D1=82=D0=BE=D1=80=D0=B0=20=D0=B2=20=D0=BC=D0=BE=D0=B4?= =?utf8?q?=D1=83=D0=BB=D0=B5=20netunit=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?utf8?q?=D0=B4=D0=B5=D0=BD=D0=B0=20=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0?= =?utf8?q?=20=D0=BA=D0=BE=D0=B4=D0=B0,=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD?= =?utf8?q?=D1=8B=20=D0=BD=D0=B5=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?utf8?q?=D1=83=D0=B5=D0=BC=D1=8B=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC?= =?utf8?q?=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5,=20=20=20=20=20=D0=BF=D1=80=D0=BE?= =?utf8?q?=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B8?= =?utf8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D1=87=D0=BB=D0=B5=D0=BD?= =?utf8?q?=D1=8B=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=BE=D0=B2=20=D0=B2=20?= =?utf8?q?=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D0=BE?= =?utf8?q?=D1=80=D0=B0=D1=85=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D1=81?= =?utf8?q?=D0=BF=D0=B8=D1=81=D0=BA=D0=B8=20=20=20=20=20=D0=B8=D0=BD=D0=B8?= =?utf8?q?=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- stglibs/srvconf.lib/netunit.cpp | 33 +++++++++++---------------------- stglibs/srvconf.lib/netunit.h | 5 ----- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/stglibs/srvconf.lib/netunit.cpp b/stglibs/srvconf.lib/netunit.cpp index 68eea748..ec796f7f 100644 --- a/stglibs/srvconf.lib/netunit.cpp +++ b/stglibs/srvconf.lib/netunit.cpp @@ -51,13 +51,20 @@ //--------------------------------------------------------------------------- NETTRANSACT::NETTRANSACT() + : port(0), + outerSocket(-1), + RxCallBack(NULL), + dataRxCallBack(NULL) { -RxCallBack = NULL; + memset(server, 0, SERVER_NAME_LEN); + memset(login, 0, ADM_LOGIN_LEN); + memset(password, 0, ADM_PASSWD_LEN); + memset(errorMsg, 0, MAX_ERR_STR_LEN); } //----------------------------------------------------------------------------- void NETTRANSACT::EnDecryptInit(const char * passwd, int, BLOWFISH_CTX *ctx) { -unsigned char * keyL = NULL;//[PASSWD_LEN]; // ��� ������ +unsigned char * keyL = NULL; // ��� ������ keyL = new unsigned char[PASSWD_LEN]; @@ -72,28 +79,12 @@ delete[] keyL; //----------------------------------------------------------------------------- void NETTRANSACT::Encrypt(char * d, const char * s, BLOWFISH_CTX *ctx) { -/*unsigned char ss[8]; - -memcpy(ss, s, 8); - -Blowfish_Encrypt(ctx, (uint32_t *)ss, (uint32_t *)(ss + 4)); - -memcpy(d, ss, 8);*/ EncodeString(d, s, ctx); - } //--------------------------------------------------------------------------- void NETTRANSACT::Decrypt(char * d, const char * s, BLOWFISH_CTX *ctx) { -/*unsigned char ss[8]; - -memcpy(ss, s, 8); - -Blowfish_Decrypt(ctx, (uint32_t *)ss, (uint32_t *)(ss + 4)); - -memcpy(d, ss, 8);*/ DecodeString(d, s, ctx); - } //--------------------------------------------------------------------------- int NETTRANSACT::Connect() @@ -107,8 +98,8 @@ if (outerSocket < 0) return st_conn_fail; } +struct sockaddr_in outerAddr; memset(&outerAddr, 0, sizeof(outerAddr)); -memset(&localAddr, 0, sizeof(localAddr)); struct hostent he; struct hostent * phe; @@ -219,12 +210,11 @@ return st_ok; int NETTRANSACT::RxHeaderAnswer() { char buffer[sizeof(STG_HEADER)+1]; -int ret;//, we; +int ret; ret = recv(outerSocket, buffer, strlen(OK_HEADER), 0); if (ret <= 0) { - //we = WSAGetLastError(); strcpy(errorMsg, RECV_HEADER_ANSWER_ERROR); return st_recv_fail; } @@ -504,4 +494,3 @@ void NETTRANSACT::Reset() answerList.clear(); } //--------------------------------------------------------------------------- - diff --git a/stglibs/srvconf.lib/netunit.h b/stglibs/srvconf.lib/netunit.h index 72d3b721..f5161503 100644 --- a/stglibs/srvconf.lib/netunit.h +++ b/stglibs/srvconf.lib/netunit.h @@ -111,16 +111,11 @@ private: void EnDecryptInit(const char * passwd, int passwdLen, BLOWFISH_CTX *ctx); void Decrypt(char * d, const char * s, BLOWFISH_CTX *ctx); - //unsigned ip; char server[SERVER_NAME_LEN]; short unsigned port; char login[ADM_LOGIN_LEN]; char password[ADM_PASSWD_LEN]; int outerSocket; - int localSocket; - struct sockaddr_in outerAddr; - struct sockaddr_in localAddr; - int error; std::list answerList; RxCallback_t RxCallBack; void * dataRxCallBack; -- 2.44.2