blob: 6c3fba32393d5cb9322eb15c5017b51ed22202ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* extendes sockets
*/
#ifndef _VDRMON_CLIENTSOCK
#define _VDRMON_CLIENTSOCK
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#if VDRMANAGER_USE_SSL
#include <openssl/ssl.h>
#else
#define SSL_CTX void
#endif
#include <string>
#include "sock.h"
using namespace std;
class cVdrmanagerClientSocket : public cVdrmanagerSocket
{
private:
string readbuf;
string writebuf;
char * sendbuf;
size_t sendsize;
size_t sendoffset;
bool disconnected;
bool initDisconnect;
int client;
bool login;
bool compression;
bool initCompression;
int compressionMode;
#if VDRMANAGER_USE_SSL
SSL * ssl;
int sslReadWrite;
int sslWantsSelect;
#endif
public:
cVdrmanagerClientSocket(const char * password, int compressionMode);
virtual ~cVdrmanagerClientSocket();
bool Attach(int fd, SSL_CTX * sslCtx);
bool IsLineComplete();
bool GetLine(string& line);
void Write(string line);
bool Read();
int ReadNoSSL();
bool Flush();
int FlushNoSSL();
#if VDRMANAGER_USE_SSL
int ReadSSL();
int FlushSSL();
int GetSslReadWrite();
int GetSslWantsSelect();
bool IsSSL();
#endif
bool Disconnected();
void Disconnect();
int GetClientId();
bool WritePending();
bool IsLoggedIn();
void SetLoggedIn();
void ActivateCompression();
#if VDRMANAGER_USE_GZIP || VDRMANAGER_USE_ZLIB
void Compress();
#endif
};
#endif
|