/* * connection.h: SVDRP connection * * See the README file for copyright information and how to reach the author. */ #ifndef __SVDRP_CLIENT_H_ #define __SVDRP_CLIENT_H_ #include #include //*************************************************************************** // Line //*************************************************************************** class cLine: public cListObject { public: cLine(const char *s) { line = s ? strdup(s) : 0; }; virtual ~cLine() { if (line) free(line); }; const char* Text() { return line; } int Length() { return strlen(line); } private: char* line; }; //*************************************************************************** // SVDRP Client //*************************************************************************** class cSvdrpClient: public cMutex { private: char* ip; int port; cFile file; char* buffer; int bufSize; int connect(); int readLine(int timeoutMs); public: cSvdrpClient(const char *aIp, int aPort); virtual ~cSvdrpClient(); int open(); void close(); void abort(); int send(const char* cmd, int reconnect = true); int receive(cList* list = 0); }; //*************************************************************************** #endif // __SVDRP_CLIENT_H_