summaryrefslogtreecommitdiff
path: root/server/connection.h
diff options
context:
space:
mode:
authorFrank Schmirler <vdr@schmirler.de>2010-12-02 09:48:23 +0100
committerFrank Schmirler <vdr@schmirler.de>2010-12-02 09:48:23 +0100
commit11b22d9f33d50f20cba1eaee2aadb55d3580d879 (patch)
tree5c4e7fe1046bd9cc1ef7a7b21abe118f43689902 /server/connection.h
parent435f01649c2ee8c23c21e0680d0a39e773008549 (diff)
downloadvdr-plugin-streamdev-11b22d9f33d50f20cba1eaee2aadb55d3580d879.tar.gz
vdr-plugin-streamdev-11b22d9f33d50f20cba1eaee2aadb55d3580d879.tar.bz2
Streamdev 0.5.0-rc1
Diffstat (limited to 'server/connection.h')
-rw-r--r--server/connection.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/server/connection.h b/server/connection.h
index 2c28a09..dfaff91 100644
--- a/server/connection.h
+++ b/server/connection.h
@@ -1,5 +1,5 @@
/*
- * $Id: connection.h,v 1.7 2009/02/13 10:39:22 schmirl Exp $
+ * $Id: connection.h,v 1.8.2.1 2010/06/11 06:06:02 schmirl Exp $
*/
#ifndef VDR_STREAMDEV_SERVER_CONNECTION_H
@@ -8,6 +8,11 @@
#include "tools/socket.h"
#include "common.h"
+#include <map>
+
+typedef std::map<std::string,std::string> tStrStrMap;
+typedef std::pair<std::string,std::string> tStrStr;
+
class cChannel;
class cDevice;
@@ -28,6 +33,8 @@ private:
uint m_WriteBytes;
uint m_WriteIndex;
+ tStrStrMap m_Headers;
+
protected:
/* Will be called when a command terminated by a newline has been
received */
@@ -41,6 +48,11 @@ protected:
virtual bool Respond(const char *Message, bool Last = true, ...);
//__attribute__ ((format (printf, 2, 4)));
+ /* Add a request header */
+ void SetHeader(const char *Name, const char *Value, const char *Prefix = "") { m_Headers.insert(tStrStr(std::string(Prefix) + Name, Value)); }
+
+ static const cChannel *ChannelFromString(const char *String, int *Apid = NULL, int *Dpid = NULL);
+
public:
/* If you derive, specify a short string such as HTTP for Protocol, which
will be displayed in error messages */
@@ -87,6 +99,12 @@ public:
virtual void Detach(void) = 0;
virtual void Attach(void) = 0;
+
+ /* This connections protocol name */
+ virtual const char* Protocol(void) const { return m_Protocol; }
+
+ /* std::map with additional information */
+ const tStrStrMap& Headers(void) const { return m_Headers; }
};
inline bool cServerConnection::HasData(void) const