summaryrefslogtreecommitdiff
path: root/muggle-plugin/vdr_network.h
diff options
context:
space:
mode:
Diffstat (limited to 'muggle-plugin/vdr_network.h')
-rw-r--r--muggle-plugin/vdr_network.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/muggle-plugin/vdr_network.h b/muggle-plugin/vdr_network.h
new file mode 100644
index 0000000..4725d2a
--- /dev/null
+++ b/muggle-plugin/vdr_network.h
@@ -0,0 +1,47 @@
+/*
+ * Adapted from
+ * MP3/MPlayer plugin to VDR (C++)
+ * (C) 2001,2002 Stefan Huelswitt <huels@iname.com>
+ */
+
+#ifndef ___NETWORK_H
+#define ___NETWORK_H
+
+#include <thread.h>
+#include <ringbuffer.h>
+#include <config.h>
+
+class cRingBufferLinear;
+
+// ----------------------------------------------------------------
+
+class mgNet:public cRingBufferLinear, cThread
+{
+ private:
+ int m_fd;
+ bool m_connected, m_netup;
+ int m_deferedErrno;
+ int m_rwTimeout, m_conTimeout;
+ unsigned char m_lineBuff[4096];
+ int m_count;
+//
+ void close (void);
+ int ringRead (unsigned char *dest, int len);
+ void copyFromBuff (unsigned char *dest, int n);
+ protected:
+ virtual void action (void);
+ public:
+ mgNet (int size, int ConTimeoutMs, int RwTimeoutMs);
+ ~mgNet ();
+ bool connect (const char *hostname, const int port);
+ void disconnect (void);
+ bool connected (void)
+ {
+ return m_connected;
+ }
+ int gets (char *dest, int len);
+ int puts (char *dest);
+ int read (unsigned char *dest, int len);
+ int write (unsigned char *dest, int len);
+};
+#endif //___NETWORK_H