00001
00002
00003
00004
00005
00006
00007
00008 #ifndef _SERVER_H
00009 #define _SERVER_H
00010
00011 #include <netinet/in.h>
00012 #include <vdr/recording.h>
00013 #include <vdr/thread.h>
00014 #include <upnp/upnp.h>
00015 #include "../misc/util.h"
00016 #include "../common.h"
00017 #include "../upnpcomponents/upnpwebserver.h"
00018 #include "../database/metadata.h"
00019 #include "../upnpcomponents/connectionmanager.h"
00020 #include "../upnpcomponents/contentdirectory.h"
00021 #include "../upnp.h"
00022
00030 class cUPnPServer {
00031 friend class cPluginUpnp;
00032 public:
00039 cUPnPServer();
00046 virtual ~cUPnPServer();
00057 void enable(bool enabled);
00067 bool start(void);
00079 bool restart(void);
00086 void stop(void);
00097 bool autoDetectSettings(void);
00105 sockaddr_in* getServerAddress(void);
00111 const char* getInterface(void) const { return this->mInterface; }
00129 bool setServerPort(unsigned short port);
00140 bool setInterface(const char* Interface);
00156 bool setAddress(const char* Address);
00168 bool setAutoDetection(bool enable);
00178 bool isEnabled(void) const { return this->mIsEnabled; }
00188 bool isRunning(void) const { return this->mIsRunning; }
00198 bool isAutoDetectionEnabled() { return this->mIsAutoDetectionEnabled; }
00199 protected:
00200 private:
00206 bool init(void);
00207 bool uninit(void);
00208 static int upnpActionCallback(Upnp_EventType eventtype, void *event, void *cookie);
00209 bool mIsRunning;
00210 bool mIsEnabled;
00211 sockaddr_in* mServerAddr;
00212 cString mInterface;
00213 bool mIsAutoDetectionEnabled;
00214 cString mDeviceDescription;
00215 cUPnPWebServer* mWebServer;
00216 cMediaDatabase* mMediaDatabase;
00217 UpnpDevice_Handle mDeviceHandle;
00218 static cConnectionManager* mConnectionManager;
00219 static cContentDirectory* mContentDirectory;
00220 };
00221 #endif