diff options
author | Frank Schmirler <schmirl@puter.linogate.de> | 2010-12-02 08:53:01 +0100 |
---|---|---|
committer | Frank Schmirler <schmirl@puter.linogate.de> | 2010-12-02 08:53:01 +0100 |
commit | 5e30711bfdb28085234a5ef6da4f4e44305ac3e4 (patch) | |
tree | d15809d23eeeed7fda55d9450b1af7c99d6eb5d6 /server/component.h | |
download | vdr-plugin-streamdev-5e30711bfdb28085234a5ef6da4f4e44305ac3e4.tar.gz vdr-plugin-streamdev-5e30711bfdb28085234a5ef6da4f4e44305ac3e4.tar.bz2 |
Snapshot 2007-03-20
Diffstat (limited to 'server/component.h')
-rw-r--r-- | server/component.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/server/component.h b/server/component.h new file mode 100644 index 0000000..8703348 --- /dev/null +++ b/server/component.h @@ -0,0 +1,51 @@ +/* + * $Id: component.h,v 1.2 2005/05/09 20:22:29 lordjaxom 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: + cTBSocket m_Listen; + const char *m_Protocol; + 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); + 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 |