summaryrefslogtreecommitdiff
path: root/plugins/streamdev/streamdev-cvs/server/component.h
diff options
context:
space:
mode:
authorkwacker <vdr@w-i-r.com>2010-04-11 13:46:11 +0200
committerkwacker <vdr@w-i-r.com>2010-04-11 13:46:11 +0200
commit9b144d30e0ea8ce900c37b96ba2cbdda14b0ae88 (patch)
tree3a52de029f950dcd9f9856a53fd67abef8519e68 /plugins/streamdev/streamdev-cvs/server/component.h
parent9cd931834ecadbf5efefdf484abb966e9248ebbb (diff)
downloadx-vdr-9b144d30e0ea8ce900c37b96ba2cbdda14b0ae88.tar.gz
x-vdr-9b144d30e0ea8ce900c37b96ba2cbdda14b0ae88.tar.bz2
Burn 0.2.0-beta3 und Streamdev mit Paches aktualisiert
Diffstat (limited to 'plugins/streamdev/streamdev-cvs/server/component.h')
-rw-r--r--plugins/streamdev/streamdev-cvs/server/component.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/plugins/streamdev/streamdev-cvs/server/component.h b/plugins/streamdev/streamdev-cvs/server/component.h
new file mode 100644
index 0000000..7efd4ba
--- /dev/null
+++ b/plugins/streamdev/streamdev-cvs/server/component.h
@@ -0,0 +1,51 @@
+/*
+ * $Id: component.h,v 1.3 2009/02/13 10:39:22 schmirl Exp $
+ */
+
+#ifndef VDR_STREAMDEV_SERVERS_COMPONENT_H
+#define VDR_STREAMDEV_SERVERS_COMPONENT_H
+
+#include "tools/socket.h"
+#include "tools/select.h"
+
+#include <vdr/tools.h>
+
+class cServerConnection;
+
+/* Basic TCP listen server, all functions virtual if a derivation wants to do
+ things different */
+
+class cServerComponent: public cListObject {
+private:
+ const char *m_Protocol;
+ cTBSocket m_Listen;
+ const char *m_ListenIp;
+ uint m_ListenPort;
+
+protected:
+ /* Returns a new connection object for Accept() */
+ virtual cServerConnection *NewClient(void) = 0;
+
+public:
+ cServerComponent(const char *Protocol, const char *ListenIp, uint ListenPort, int Type = SOCK_STREAM, int IpProto = 0);
+ virtual ~cServerComponent();
+
+ /* Starts listening on the specified Port, override if you want to do things
+ different */
+ virtual bool Initialize(void);
+
+ /* Stops listening, override if you want to do things different */
+ virtual void Destruct(void);
+
+ /* Get the listening socket's file number */
+ virtual int Socket(void) const { return (int)m_Listen; }
+
+ /* Adds the listening socket to the Select object */
+ virtual void Add(cTBSelect &Select) const { Select.Add(m_Listen); }
+
+ /* Accepts the connection on a NewClient() object and calls the
+ Welcome() on it, override if you want to do things different */
+ virtual cServerConnection *Accept(void);
+};
+
+#endif // VDR_STREAMDEV_SERVERS_COMPONENT_H