From: Maxim Mamontov Date: Sun, 7 Dec 2014 12:29:56 +0000 (+0200) Subject: Some small changes in srvconf.lib. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/faf619a9b927923d90782ab28734916197ff16b4?ds=sidebyside;hp=-c Some small changes in srvconf.lib. --- faf619a9b927923d90782ab28734916197ff16b4 diff --git a/stglibs/srvconf.lib/include/stg/servconf_types.h b/stglibs/srvconf.lib/include/stg/servconf_types.h index 998e3b47..167b8091 100644 --- a/stglibs/srvconf.lib/include/stg/servconf_types.h +++ b/stglibs/srvconf.lib/include/stg/servconf_types.h @@ -29,16 +29,6 @@ #include #include -#define STG_HEADER "SG04" -#define OK_HEADER "OKHD" -#define ERR_HEADER "ERHD" -#define OK_LOGIN "OKLG" -#define ERR_LOGIN "ERLG" -#define OK_LOGINS "OKLS" -#define ERR_LOGINS "ERLS" - -#define ENC_MSG_LEN (8) - struct ADMIN_CONF; struct TARIFF_DATA; struct SERVICE_CONF; @@ -63,14 +53,6 @@ st_xml_parse_error, st_data_error }; -enum CONF_STATE -{ -confHdr = 0, -confLogin, -confLoginCipher, -confData -}; - namespace SIMPLE { @@ -87,7 +69,7 @@ struct CALLBACK typedef void (* TYPE)(bool result, const std::string & reason, const std::vector & info, void * data); }; -} +} // namespace GET_CONTAINER namespace AUTH_BY { @@ -119,7 +101,7 @@ namespace RAW_XML typedef void (* CALLBACK)(bool result, const std::string & reason, const std::string & response, void * data); -} +} // namespace RAW_XML namespace GET_USER { @@ -176,7 +158,7 @@ namespace GET_ADMIN typedef ADMIN_CONF INFO; typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data); -} +} // namespace GET_ADMIN namespace GET_TARIFF { @@ -184,7 +166,7 @@ namespace GET_TARIFF typedef TARIFF_DATA INFO; typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data); -} +} // namespace GET_TARIFF namespace GET_SERVICE { @@ -192,7 +174,7 @@ namespace GET_SERVICE typedef SERVICE_CONF INFO; typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data); -} +} // namespace GET_SERVICE namespace GET_CORP { @@ -200,7 +182,7 @@ namespace GET_CORP typedef CORP_CONF INFO; typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data); -} +} // namespace GET_CORP } // namespace STG diff --git a/stglibs/srvconf.lib/netunit.cpp b/stglibs/srvconf.lib/netunit.cpp index 24d7ae77..65151587 100644 --- a/stglibs/srvconf.lib/netunit.cpp +++ b/stglibs/srvconf.lib/netunit.cpp @@ -39,6 +39,14 @@ #include #include +const char STG_HEADER[] = "SG04"; +const char OK_HEADER[] = "OKHD"; +const char ERR_HEADER[] = "ERHD"; +const char OK_LOGIN[] = "OKLG"; +const char ERR_LOGIN[] = "ERLG"; +const char OK_LOGINS[] = "OKLS"; +const char ERR_LOGINS[] = "ERLS"; + using namespace STG; namespace @@ -56,19 +64,18 @@ struct ReadState //--------------------------------------------------------------------------- -#define SEND_DATA_ERROR "Send data error!" -#define RECV_DATA_ANSWER_ERROR "Recv data answer error!" -#define UNKNOWN_ERROR "Unknown error!" -#define CONNECT_FAILED "Connect failed!" -#define BIND_FAILED "Bind failed!" -#define INCORRECT_LOGIN "Incorrect login!" -#define INCORRECT_HEADER "Incorrect header!" -#define SEND_LOGIN_ERROR "Send login error!" -#define RECV_LOGIN_ANSWER_ERROR "Recv login answer error!" -#define CREATE_SOCKET_ERROR "Create socket failed!" -#define WSASTARTUP_FAILED "WSAStartup failed!" -#define SEND_HEADER_ERROR "Send header error!" -#define RECV_HEADER_ANSWER_ERROR "Recv header answer error!" +const char SEND_DATA_ERROR[] = "Error sending data."; +const char RECV_DATA_ANSWER_ERROR[] = "Error receiving data answer."; +const char UNKNOWN_ERROR[] = "Unknown error"; +const char CONNECT_FAILED[] = "Failed to connect."; +const char BIND_FAILED[] = "Failed to bind."; +const char INCORRECT_LOGIN[] = "Incorrect login."; +const char INCORRECT_HEADER[] = "Incorrect header."; +const char SEND_LOGIN_ERROR[] = "Error sending login."; +const char RECV_LOGIN_ANSWER_ERROR[] = "Error receiving login answer."; +const char CREATE_SOCKET_ERROR[] = "Failed to create socket."; +const char SEND_HEADER_ERROR[] = "Error sending header."; +const char RECV_HEADER_ANSWER_ERROR[] = "Error receiving header answer."; //--------------------------------------------------------------------------- NETTRANSACT::NETTRANSACT(const std::string & s, uint16_t p, diff --git a/stglibs/srvconf.lib/netunit.h b/stglibs/srvconf.lib/netunit.h index d1191435..ca13bbc8 100644 --- a/stglibs/srvconf.lib/netunit.h +++ b/stglibs/srvconf.lib/netunit.h @@ -25,6 +25,9 @@ #include +namespace STG +{ + class NETTRANSACT { public: @@ -67,4 +70,6 @@ private: static bool RxCrypto(const void * block, size_t size, void * data); }; +} // namespace STG + #endif