diff options
author | bju <bju@maxi.fritz.box> | 2011-03-31 00:37:16 +0200 |
---|---|---|
committer | bju <bju@maxi.fritz.box> | 2011-03-31 00:37:16 +0200 |
commit | 32ba3fb9f2a1f7b073b3a121762385ac237a2af8 (patch) | |
tree | f3cbdbe2ced3e202d0c1cd3d037a8ed3108817e2 /vdr-vdrmanager/sock.h | |
parent | acc1396153d7fb9c22d2b3cee3f2eef383ad681d (diff) | |
download | vdr-manager-32ba3fb9f2a1f7b073b3a121762385ac237a2af8.tar.gz vdr-manager-32ba3fb9f2a1f7b073b3a121762385ac237a2af8.tar.bz2 |
Renamed from androvdr to vdrmanager
Diffstat (limited to 'vdr-vdrmanager/sock.h')
-rw-r--r-- | vdr-vdrmanager/sock.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/vdr-vdrmanager/sock.h b/vdr-vdrmanager/sock.h new file mode 100644 index 0000000..260efed --- /dev/null +++ b/vdr-vdrmanager/sock.h @@ -0,0 +1,63 @@ +/* + * extendes sockets + */ + +#ifndef _VDRMON_SOCK +#define _VDRMON_SOCK + +#include <sys/types.h> +#include <sys/socket.h> +#include <string> + +using namespace std; + +class cVdrmanagerSocket +{ +protected: + int sock; + const char * password; +protected: + cVdrmanagerSocket(); +public: + virtual ~cVdrmanagerSocket(); + void Close(); + int GetSocket(); + bool MakeDontBlock(); + const char * GetPassword(); +}; + +class cVdrmanagerClientSocket : public cVdrmanagerSocket +{ +private: + string readbuf; + string writebuf; + bool disconnected; + int client; + bool login; +public: + cVdrmanagerClientSocket(const char * password); + virtual ~cVdrmanagerClientSocket(); + bool Attach(int fd); + bool IsLineComplete(); + bool GetLine(string& line); + bool PutLine(string line); + bool Read(); + bool Disconnected(); + void Disconnect(); + bool Flush(); + int GetClientId(); + bool WritePending(); + bool IsLoggedIn(); + void SetLoggedIn(); +}; + +class cVdrmanagerServerSocket : public cVdrmanagerSocket +{ +public: + cVdrmanagerServerSocket(); + virtual ~cVdrmanagerServerSocket(); + bool Create(int port, const char * password); + cVdrmanagerClientSocket * Accept(); +}; + +#endif |