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 // Qt
17 #include <QObject>
18 
19 // MythTV
20 #include "configuration.h"
21 #include "mythpower.h"
22 
24 //
26 
27 #include "upnpdevice.h"
28 #include "taskqueue.h"
29 #include "httpserver.h"
30 #include "ssdp.h"
31 
33 //
35 
37 {
39 
56 
76 
84 
86 
89 };
90 
93 //
94 //
95 //
98 
99 class UPNP_PUBLIC UPnp : public QObject
100 {
101  Q_OBJECT
102 
103  protected:
104 
106 
107  HttpServer *m_pHttpServer {nullptr};
108  int m_nServicePort {0};
109 
110  public:
111 
113  static QList<QHostAddress> g_IPAddrList;
114 
115  public:
116  UPnp();
117  ~UPnp() override;
118 
119  static void SetConfiguration( Configuration *pConfig );
120  static Configuration* GetConfiguration();
121 
122  bool Initialize( int nServicePort, HttpServer *pHttpServer );
123  bool Initialize( QList<QHostAddress> &sIPAddrList, int nServicePort,
124  HttpServer *pHttpServer );
125 
126  bool isInitialized() { return (m_pHttpServer != nullptr); }
127 
128  virtual void Start();
129 
130  static void CleanUp ();
131 
132  static UPnpDevice *RootDevice() { return &(g_UPnpDeviceDesc.m_rootDevice); }
133 
134  HttpServer *GetHttpServer() { return m_pHttpServer; }
135 
136  static UPnpDeviceDesc *GetDeviceDesc( QString &sURL );
137 
138  static QString GetResultDesc( UPnPResultCode eCode );
139  static void FormatErrorResponse( HTTPRequest *pRequest,
140  UPnPResultCode eCode,
141  const QString &sMsg = "" );
142 
143  static void FormatRedirectResponse( HTTPRequest *pRequest,
144  const QString &hostName );
145 
146  public slots:
147  static void DisableNotifications(uint /*unused*/);
148  void EnableNotificatins(qint64 /*unused*/) const;
149 
150  private:
152 };
153 
154 #endif // UPNP_H
static Configuration * g_pConfig
Definition: upnp.h:105
MythPower * m_power
Definition: upnp.h:151
Definition: upnp.h:99
UPnPResultCode
Definition: upnp.h:36
unsigned int slots[4]
Definition: element.cpp:38
UPnpDevice m_rootDevice
Definition: upnpdevice.h:152
bool isInitialized()
Definition: upnp.h:126
unsigned int uint
Definition: compat.h:140
#define UPNP_PUBLIC
Definition: upnpexp.h:9
HttpServer * GetHttpServer()
Definition: upnp.h:134
static UPnpDevice * RootDevice()
Definition: upnp.h:132
static QList< QHostAddress > g_IPAddrList
Definition: upnp.h:113
static UPnpDeviceDesc g_UPnpDeviceDesc
Definition: upnp.h:112