summaryrefslogtreecommitdiffstats
path: root/src/InputReader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/InputReader.h')
-rw-r--r--src/InputReader.h44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/InputReader.h b/src/InputReader.h
index daacc9e..4d0792b 100644
--- a/src/InputReader.h
+++ b/src/InputReader.h
@@ -3,8 +3,10 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyrigth (C) 2013, 2015
+ Copyright (C) 2016
Matthias P. Braendli, matthias.braendli@mpb.li
+
+ http://www.opendigitalradio.org
*/
/*
This file is part of ODR-DabMod.
@@ -39,6 +41,14 @@
#endif
#include "porting.h"
#include "Log.h"
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#define SOCKET int
+#define INVALID_SOCKET -1
+#define SOCKET_ERROR -1
/* Known types of input streams. Description taken from the CRC mmbTools forum.
@@ -115,8 +125,8 @@ class InputFileReader : public InputReader
}
private:
- InputFileReader(const InputFileReader& other);
- InputFileReader& operator=(const InputFileReader& other);
+ InputFileReader(const InputFileReader& other) = delete;
+ InputFileReader& operator=(const InputFileReader& other) = delete;
int IdentifyType();
@@ -134,6 +144,30 @@ class InputFileReader : public InputReader
// after 2**32 * 24ms ~= 3.3 years
};
+class InputTcpReader : public InputReader
+{
+ public:
+ InputTcpReader();
+ ~InputTcpReader();
+
+ // Endpoint is either host:port or tcp://host:port
+ void Open(const std::string& endpoint);
+
+ // Put next frame into buffer. This function will never write more than
+ // 6144 bytes into buffer.
+ // returns number of bytes written to buffer, 0 on eof, -1 on error
+ virtual int GetNextFrame(void* buffer);
+
+ // Print some information
+ virtual void PrintInfo();
+
+ private:
+ InputTcpReader(const InputTcpReader& other) = delete;
+ InputTcpReader& operator=(const InputTcpReader& other) = delete;
+ SOCKET m_sock;
+ std::string m_uri;
+};
+
struct zmq_input_overflow : public std::exception
{
const char* what () const throw ()
@@ -201,8 +235,8 @@ class InputZeroMQReader : public InputReader
void PrintInfo();
private:
- InputZeroMQReader(const InputZeroMQReader& other);
- InputZeroMQReader& operator=(const InputZeroMQReader& other);
+ InputZeroMQReader(const InputZeroMQReader& other) = delete;
+ InputZeroMQReader& operator=(const InputZeroMQReader& other) = delete;
std::string uri_;
InputZeroMQWorker worker_;