From: Maxim Mamontov Date: Sun, 15 Sep 2013 02:08:32 +0000 (+0300) Subject: [NY] Made NETUNIT private. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/113c3cef204f3380a266483ec9120f673640c673 [NY] Made NETUNIT private. --- diff --git a/projects/sgconf/main.cpp b/projects/sgconf/main.cpp index 66f580f6..5d82e9f0 100644 --- a/projects/sgconf/main.cpp +++ b/projects/sgconf/main.cpp @@ -38,7 +38,7 @@ #include #include "stg/common.h" -#include "stg/netunit.h" +//#include "stg/netunit.h" #include "request.h" #include "common_sg.h" #include "sg_error_codes.h" diff --git a/stglibs/srvconf.lib/include/stg/netunit.h b/stglibs/srvconf.lib/include/stg/netunit.h deleted file mode 100644 index 4d3bcfb0..00000000 --- a/stglibs/srvconf.lib/include/stg/netunit.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Author : Boris Mikhailenko - */ - - /* - $Revision: 1.6 $ - $Date: 2010/02/11 12:32:53 $ - $Author: faust $ - */ - -#ifndef NetUnitH -#define NetUnitH - -#include "stg/os_int.h" - -#include - -typedef bool (* RxCallback_t)(void *, const std::string &, bool); - -//--------------------------------------------------------------------------- -class NETTRANSACT -{ -public: - NETTRANSACT(const std::string & server, uint16_t port, - const std::string & login, const std::string & password); - int Transact(const char * data); - const std::string & GetError() const; - - void SetRxCallback(void * data, RxCallback_t); - - int Connect(); - int Disconnect(); -private: - int TxHeader(); - int RxHeaderAnswer(); - - int TxLogin(); - int RxLoginAnswer(); - - int TxLoginS(); - int RxLoginSAnswer(); - - int TxData(const char * text); - int TxData(char * data); - int RxDataAnswer(); - - std::string server; - uint16_t port; - std::string login; - std::string password; - int outerSocket; - RxCallback_t RxCallBack; - void * dataRxCallBack; - std::string errorMsg; -}; -//--------------------------------------------------------------------------- -#endif diff --git a/stglibs/srvconf.lib/netunit.cpp b/stglibs/srvconf.lib/netunit.cpp index 68d64678..73f0f485 100644 --- a/stglibs/srvconf.lib/netunit.cpp +++ b/stglibs/srvconf.lib/netunit.cpp @@ -26,7 +26,8 @@ //--------------------------------------------------------------------------- -#include "stg/netunit.h" +#include "netunit.h" + #include "stg/servconf_types.h" #include "stg/common.h" #include "stg/blowfish.h" diff --git a/stglibs/srvconf.lib/netunit.h b/stglibs/srvconf.lib/netunit.h new file mode 100644 index 00000000..4d3bcfb0 --- /dev/null +++ b/stglibs/srvconf.lib/netunit.h @@ -0,0 +1,73 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * Author : Boris Mikhailenko + */ + + /* + $Revision: 1.6 $ + $Date: 2010/02/11 12:32:53 $ + $Author: faust $ + */ + +#ifndef NetUnitH +#define NetUnitH + +#include "stg/os_int.h" + +#include + +typedef bool (* RxCallback_t)(void *, const std::string &, bool); + +//--------------------------------------------------------------------------- +class NETTRANSACT +{ +public: + NETTRANSACT(const std::string & server, uint16_t port, + const std::string & login, const std::string & password); + int Transact(const char * data); + const std::string & GetError() const; + + void SetRxCallback(void * data, RxCallback_t); + + int Connect(); + int Disconnect(); +private: + int TxHeader(); + int RxHeaderAnswer(); + + int TxLogin(); + int RxLoginAnswer(); + + int TxLoginS(); + int RxLoginSAnswer(); + + int TxData(const char * text); + int TxData(char * data); + int RxDataAnswer(); + + std::string server; + uint16_t port; + std::string login; + std::string password; + int outerSocket; + RxCallback_t RxCallBack; + void * dataRxCallBack; + std::string errorMsg; +}; +//--------------------------------------------------------------------------- +#endif diff --git a/stglibs/srvconf.lib/servconf.cpp b/stglibs/srvconf.lib/servconf.cpp index 45d60f66..c45dfb9b 100644 --- a/stglibs/srvconf.lib/servconf.cpp +++ b/stglibs/srvconf.lib/servconf.cpp @@ -20,7 +20,7 @@ #include "stg/servconf.h" -#include "stg/netunit.h" +#include "netunit.h" #include "stg/servconf_types.h" #include "stg/common.h"