проведена чистка кода, убраны неиспользуемые переменные,
проинициализированы члены классов в конструкторах через списки
инициализации
//---------------------------------------------------------------------------
NETTRANSACT::NETTRANSACT()
//---------------------------------------------------------------------------
NETTRANSACT::NETTRANSACT()
+ : port(0),
+ outerSocket(-1),
+ RxCallBack(NULL),
+ dataRxCallBack(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)
{
}
//-----------------------------------------------------------------------------
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];
keyL = new unsigned char[PASSWD_LEN];
//-----------------------------------------------------------------------------
void NETTRANSACT::Encrypt(char * d, const char * s, BLOWFISH_CTX *ctx)
{
//-----------------------------------------------------------------------------
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);*/
}
//---------------------------------------------------------------------------
void NETTRANSACT::Decrypt(char * d, const char * s, BLOWFISH_CTX *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);*/
}
//---------------------------------------------------------------------------
int NETTRANSACT::Connect()
}
//---------------------------------------------------------------------------
int NETTRANSACT::Connect()
+struct sockaddr_in outerAddr;
memset(&outerAddr, 0, sizeof(outerAddr));
memset(&outerAddr, 0, sizeof(outerAddr));
-memset(&localAddr, 0, sizeof(localAddr));
struct hostent he;
struct hostent * phe;
struct hostent he;
struct hostent * phe;
int NETTRANSACT::RxHeaderAnswer()
{
char buffer[sizeof(STG_HEADER)+1];
int NETTRANSACT::RxHeaderAnswer()
{
char buffer[sizeof(STG_HEADER)+1];
ret = recv(outerSocket, buffer, strlen(OK_HEADER), 0);
if (ret <= 0)
{
ret = recv(outerSocket, buffer, strlen(OK_HEADER), 0);
if (ret <= 0)
{
- //we = WSAGetLastError();
strcpy(errorMsg, RECV_HEADER_ANSWER_ERROR);
return st_recv_fail;
}
strcpy(errorMsg, RECV_HEADER_ANSWER_ERROR);
return st_recv_fail;
}
answerList.clear();
}
//---------------------------------------------------------------------------
answerList.clear();
}
//---------------------------------------------------------------------------
void EnDecryptInit(const char * passwd, int passwdLen, BLOWFISH_CTX *ctx);
void Decrypt(char * d, const char * s, BLOWFISH_CTX *ctx);
void EnDecryptInit(const char * passwd, int passwdLen, BLOWFISH_CTX *ctx);
void Decrypt(char * d, const char * s, BLOWFISH_CTX *ctx);
char server[SERVER_NAME_LEN];
short unsigned port;
char login[ADM_LOGIN_LEN];
char password[ADM_PASSWD_LEN];
int outerSocket;
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<std::string> answerList;
RxCallback_t RxCallBack;
void * dataRxCallBack;
std::list<std::string> answerList;
RxCallback_t RxCallBack;
void * dataRxCallBack;