X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/3f044094a85b8542286107bd6a9da921fc990681..8569ecdc2c9368dc0fe650b901cce7b37337ffec:/stglibs/srvconf.lib/netunit.h?ds=sidebyside diff --git a/stglibs/srvconf.lib/netunit.h b/stglibs/srvconf.lib/netunit.h index fb2a1e28..f87fb3a8 100644 --- a/stglibs/srvconf.lib/netunit.h +++ b/stglibs/srvconf.lib/netunit.h @@ -18,12 +18,6 @@ * Author : Boris Mikhailenko */ - /* - $Revision: 1.6 $ - $Date: 2010/02/11 12:32:53 $ - $Author: faust $ - */ - #ifndef NetUnitH #define NetUnitH @@ -31,43 +25,37 @@ #include -typedef bool (* RxCallback_t)(void *, const std::string &, bool); - -//--------------------------------------------------------------------------- class NETTRANSACT { public: + typedef bool (* CALLBACK)(const std::string &, bool, void *); + NETTRANSACT(const std::string & server, uint16_t port, const std::string & login, const std::string & password); - int Transact(const char * data); + int Transact(const std::string & request, CALLBACK f, void * data); const std::string & GetError() const { return errorMsg; } - void SetRxCallback(void * data, RxCallback_t cb); - - int Connect(); - int Disconnect(); + int Connect(); + void Disconnect(); private: - int TxHeader(); - int RxHeaderAnswer(); + int TxHeader(); + int RxHeaderAnswer(); - int TxLogin(); - int RxLoginAnswer(); + int TxLogin(); + int RxLoginAnswer(); - int TxLoginS(); - int RxLoginSAnswer(); + int TxLoginS(); + int RxLoginSAnswer(); - int TxData(const char * text); - int TxData(char * data); - int RxDataAnswer(); + int TxData(const std::string & text); + int RxDataAnswer(CALLBACK f, void * data); std::string server; uint16_t port; std::string login; std::string password; int outerSocket; - RxCallback_t RxCallBack; - void * dataRxCallBack; std::string errorMsg; }; -//--------------------------------------------------------------------------- + #endif