blob: 0234afcd75349ab013dfe4a9a75d4c93e9acbbf2 (
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
|
/*
* 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;
bool forceCheckSvdrp;
protected:
cVdrmanagerSocket();
bool IsPasswordSet();
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, bool forceCheckSvdrp);
cVdrmanagerClientSocket * Accept();
};
#endif
|