MythTV  master
upnp.h
Go to the documentation of this file.
1 // Program Name: upnp.h
3 // Created : Oct. 24, 2005
4 //
5 // Purpose : UPnp Main Class
6 //
7 // Copyright (c) 2005 David Blain <dblain@mythtv.org>
8 //
9 // Licensed under the GPL v2 or later, see COPYING for details
10 //
12 
13 #ifndef __UPNP_H__
14 #define __UPNP_H__
15 
16 #include "configuration.h"
17 
19 //
21 
22 #include "upnpdevice.h"
23 #include "taskqueue.h"
24 #include "httpserver.h"
25 #include "ssdp.h"
26 
28 //
30 
31 typedef enum
32 {
34 
51 
71 
79 
81 
84 
86 
89 //
90 //
91 //
94 
96 {
97 
98  protected:
99 
101 
102  HttpServer *m_pHttpServer {nullptr};
103  int m_nServicePort {0};
104 
105  public:
106 
108  static QList<QHostAddress> g_IPAddrList;
109 
110  public:
111  UPnp();
112  virtual ~UPnp();
113 
114  static void SetConfiguration( Configuration *pConfig );
115  static Configuration* GetConfiguration();
116 
117  bool Initialize( int nServicePort, HttpServer *pHttpServer );
118  bool Initialize( QList<QHostAddress> &sIPAddrList, int nServicePort,
119  HttpServer *pHttpServer );
120 
121  bool isInitialized() { return (m_pHttpServer != nullptr); }
122 
123  virtual void Start();
124 
125  void CleanUp ();
126 
127  UPnpDevice *RootDevice() { return &(g_UPnpDeviceDesc.m_rootDevice); }
128 
129  HttpServer *GetHttpServer() { return m_pHttpServer; }
130 
131  static UPnpDeviceDesc *GetDeviceDesc( QString &sURL );
132 
133  static QString GetResultDesc( UPnPResultCode eCode );
134  static void FormatErrorResponse( HTTPRequest *pRequest,
135  UPnPResultCode eCode,
136  const QString &sMsg = "" );
137 
138  static void FormatRedirectResponse( HTTPRequest *pRequest,
139  const QString &hostName );
140 
141 
142 };
143 
144 #endif
static Configuration * g_pConfig
Definition: upnp.h:100
Definition: upnp.h:95
UPnPResultCode
Definition: upnp.h:31
UPnpDevice * RootDevice()
Definition: upnp.h:127
UPnpDevice m_rootDevice
Definition: upnpdevice.h:148
bool isInitialized()
Definition: upnp.h:121
#define UPNP_PUBLIC
Definition: upnpexp.h:9
HttpServer * GetHttpServer()
Definition: upnp.h:129
static QList< QHostAddress > g_IPAddrList
Definition: upnp.h:108
static UPnpDeviceDesc g_UPnpDeviceDesc
Definition: upnp.h:107