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 
32 {
34 
51 
71 
79 
81 
84 };
85 
88 //
89 //
90 //
93 
95 {
96 
97  protected:
98 
100 
101  HttpServer *m_pHttpServer {nullptr};
102  int m_nServicePort {0};
103 
104  public:
105 
107  static QList<QHostAddress> g_IPAddrList;
108 
109  public:
110  UPnp();
111  virtual ~UPnp();
112 
113  static void SetConfiguration( Configuration *pConfig );
114  static Configuration* GetConfiguration();
115 
116  bool Initialize( int nServicePort, HttpServer *pHttpServer );
117  bool Initialize( QList<QHostAddress> &sIPAddrList, int nServicePort,
118  HttpServer *pHttpServer );
119 
120  bool isInitialized() { return (m_pHttpServer != nullptr); }
121 
122  virtual void Start();
123 
124  static void CleanUp ();
125 
126  static UPnpDevice *RootDevice() { return &(g_UPnpDeviceDesc.m_rootDevice); }
127 
128  HttpServer *GetHttpServer() { return m_pHttpServer; }
129 
130  static UPnpDeviceDesc *GetDeviceDesc( QString &sURL );
131 
132  static QString GetResultDesc( UPnPResultCode eCode );
133  static void FormatErrorResponse( HTTPRequest *pRequest,
134  UPnPResultCode eCode,
135  const QString &sMsg = "" );
136 
137  static void FormatRedirectResponse( HTTPRequest *pRequest,
138  const QString &hostName );
139 
140 
141 };
142 
143 #endif
static Configuration * g_pConfig
Definition: upnp.h:99
Definition: upnp.h:94
UPnPResultCode
Definition: upnp.h:31
UPnpDevice m_rootDevice
Definition: upnpdevice.h:152
bool isInitialized()
Definition: upnp.h:120
#define UPNP_PUBLIC
Definition: upnpexp.h:9
HttpServer * GetHttpServer()
Definition: upnp.h:128
static UPnpDevice * RootDevice()
Definition: upnp.h:126
static QList< QHostAddress > g_IPAddrList
Definition: upnp.h:107
static UPnpDeviceDesc g_UPnpDeviceDesc
Definition: upnp.h:106