summaryrefslogtreecommitdiff
path: root/vdr-androvdr/select.h
diff options
context:
space:
mode:
authorbju <bju@maxi.fritz.box>2011-03-19 15:54:21 +0100
committerbju <bju@maxi.fritz.box>2011-03-19 15:54:21 +0100
commitb4558f9dac4977c6ac933f52fc98b9eea9dfdbca (patch)
tree2f0c36309c44235d4bd8121d82271cd16bcd5348 /vdr-androvdr/select.h
downloadvdr-manager-b4558f9dac4977c6ac933f52fc98b9eea9dfdbca.tar.gz
vdr-manager-b4558f9dac4977c6ac933f52fc98b9eea9dfdbca.tar.bz2
First revision
Diffstat (limited to 'vdr-androvdr/select.h')
-rw-r--r--vdr-androvdr/select.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/vdr-androvdr/select.h b/vdr-androvdr/select.h
new file mode 100644
index 0000000..fbdeb02
--- /dev/null
+++ b/vdr-androvdr/select.h
@@ -0,0 +1,41 @@
+/*
+ * encapsulated poll
+ */
+
+#ifndef _VDRMON_SELECT
+#define _VDRMON_SELECT
+
+#include <string>
+#include <sys/select.h>
+#include "sock.h"
+#include "handler.h"
+
+struct node;
+class cSelect
+{
+private:
+ node * clientsockets;
+ int clientsocketcount;
+ cVdrmanagerServerSocket * serversocket;
+ cHandler * handler;
+ struct pollfd * pollfds;
+ bool stopped;
+ time_t nexttimer;
+ time_t shutdown;
+public:
+ cSelect();
+ virtual ~cSelect();
+ void DispatchVdrEvent(string event);
+ void SetServerSocket(cVdrmanagerServerSocket * sock);
+ void AddClientSocket(cVdrmanagerClientSocket * sock);
+ void RemoveClientSocket(cVdrmanagerClientSocket * sock);
+ bool Action();
+ bool Stop();
+private:
+ void CreatePollfds();
+ cVdrmanagerClientSocket * GetClientSocket(int fd);
+ bool Poll();
+ void NotifyClients(string event);
+};
+
+#endif