blob: 2a7f5ba2ca7f902ff6bc6b8e25ee6a57c946765a (
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
|
/*
* encapsulated poll
*/
#ifndef _VDRMON_SELECT
#define _VDRMON_SELECT
#include <string>
#include <sys/select.h>
#include "clientsock.h"
#include "serversock.h"
#include "handler.h"
struct node;
class cSelect
{
private:
node * clientsockets;
int clientsocketcount;
cVdrmanagerServerSocket * serversocket;
cVdrmanagerServerSocket * sslServersocket;
cHandler * handler;
struct pollfd * pollfds;
bool stopped;
time_t nexttimer;
time_t shutdown;
public:
cSelect();
virtual ~cSelect();
void DispatchVdrEvent(string event);
void SetServerSockets(cVdrmanagerServerSocket * sock, cVdrmanagerServerSocket * sslSock);
void AddClientSocket(cVdrmanagerClientSocket * sock);
void RemoveClientSocket(cVdrmanagerClientSocket * sock);
bool Action();
bool Stop();
private:
int CreatePollfds();
cVdrmanagerClientSocket * GetClientSocket(int fd);
bool Poll();
void NotifyClients(string event);
};
#endif
|