X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/ad7b95181d5d66817aac46801cd80adbc4f2fac7..e3703f791ff52f6d7a9d6f9e8dca37a506967c2b:/stglibs/srvconf.lib/include/stg/netunit.h diff --git a/stglibs/srvconf.lib/include/stg/netunit.h b/stglibs/srvconf.lib/include/stg/netunit.h index 9e120855..664eee63 100644 --- a/stglibs/srvconf.lib/include/stg/netunit.h +++ b/stglibs/srvconf.lib/include/stg/netunit.h @@ -27,14 +27,15 @@ #ifndef NetUnitH #define NetUnitH -#include "stg/blowfish.h" - -#include - #include #include #include +#include +#include + +#include "stg/blowfish.h" + #define STG_HEADER "SG04" #define OK_HEADER "OKHD" #define ERR_HEADER "ERHD" @@ -48,7 +49,7 @@ #define MAX_ERR_STR_LEN (64) -typedef bool (* RxCallback_t)(void *, const std::string &, bool); +typedef int(*RxCallback_t)(void *, std::list *); enum status { @@ -77,15 +78,21 @@ confData class NETTRANSACT { public: - NETTRANSACT(const std::string & server, uint16_t port, - const std::string & login, const std::string & password); + NETTRANSACT(); int Transact(const char * data); const std::string & GetError() const; void SetRxCallback(void * data, RxCallback_t); + void SetServer(const char * serverName); + void SetServerPort(short unsigned p); + + void SetLogin(const char * l); + void SetPassword(const char * p); + //////////////////////////////////////////// int Connect(); int Disconnect(); + void Reset(); private: int TxHeader(); int RxHeaderAnswer(); @@ -97,14 +104,14 @@ private: int RxLoginSAnswer(); int TxData(const char * text); - int TxData(char * data); int RxDataAnswer(); std::string server; - uint16_t port; + short unsigned port; std::string login; std::string password; int outerSocket; + std::list answerList; RxCallback_t RxCallBack; void * dataRxCallBack; std::string errorMsg;