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
UPnPResult_CDS_RequiredTag
@ UPnPResult_CDS_RequiredTag
Definition: upnp.h:60
UPnPResult_MythTV_NoNamespaceGiven
@ UPnPResult_MythTV_NoNamespaceGiven
Definition: upnp.h:87
UPnPResult_InvalidArgs
@ UPnPResult_InvalidArgs
Definition: upnp.h:41
UPnPResult_CMGR_NotInNetwork
@ UPnPResult_CMGR_NotInNetwork
Definition: upnp.h:83
HTTPRequest
Definition: httprequest.h:108
UPnPResult_CDS_InvalidSearchCriteria
@ UPnPResult_CDS_InvalidSearchCriteria
Definition: upnp.h:63
upnpdevice.h
MythPower
Definition: mythpower.h:19
UPnPResult_CDS_BadMetadata
@ UPnPResult_CDS_BadMetadata
Definition: upnp.h:67
ssdp.h
UPnPResult_CMGR_IncompatibleProtocol
@ UPnPResult_CMGR_IncompatibleProtocol
Definition: upnp.h:77
UPnPResult_ArgumentValueOutOfRange
@ UPnPResult_ArgumentValueOutOfRange
Definition: upnp.h:44
UPnpDeviceDesc
Definition: upnpdevice.h:149
UPnPResult_CDS_NoSuchDestRes
@ UPnPResult_CDS_NoSuchDestRes
Definition: upnp.h:73
UPnp::GetHttpServer
HttpServer * GetHttpServer()
Definition: upnp.h:134
UPnPResult_OutOfMemory
@ UPnPResult_OutOfMemory
Definition: upnp.h:46
UPnPResult_CMGR_InsufficientNetResources
@ UPnPResult_CMGR_InsufficientNetResources
Definition: upnp.h:79
UPnPResult_CDS_TransferBusy
@ UPnPResult_CDS_TransferBusy
Definition: upnp.h:71
UPnPResult_SignatureMissing
@ UPnPResult_SignatureMissing
Definition: upnp.h:51
UPnPResult_HumanInterventionRequired
@ UPnPResult_HumanInterventionRequired
Definition: upnp.h:47
UPnp::m_power
MythPower * m_power
Definition: upnp.h:151
UPnpDeviceDesc::m_rootDevice
UPnpDevice m_rootDevice
Definition: upnpdevice.h:152
UPnPResult_NoSuchSession
@ UPnPResult_NoSuchSession
Definition: upnp.h:55
UPnPResult_CDS_NoSuchFileTransfer
@ UPnPResult_CDS_NoSuchFileTransfer
Definition: upnp.h:72
UPnPResult_CDS_NoSuchSourceResource
@ UPnPResult_CDS_NoSuchSourceResource
Definition: upnp.h:69
UPnPResult_OptionalActionNotImplemented
@ UPnPResult_OptionalActionNotImplemented
Definition: upnp.h:45
UPnPResult_CMGR_IncompatibleDirections
@ UPnPResult_CMGR_IncompatibleDirections
Definition: upnp.h:78
UPnp::isInitialized
bool isInitialized()
Definition: upnp.h:126
UPnp::g_pConfig
static Configuration * g_pConfig
Definition: upnp.h:105
UPnPResult_CDS_CannotProcessRequest
@ UPnPResult_CDS_CannotProcessRequest
Definition: upnp.h:75
UPnPResult_CDS_InvalidCurrentTagValue
@ UPnPResult_CDS_InvalidCurrentTagValue
Definition: upnp.h:58
UPnPResult_NotEncrypted
@ UPnPResult_NotEncrypted
Definition: upnp.h:52
UPnpDevice
Definition: upnpdevice.h:100
UPnPResult_SignatureFailure
@ UPnPResult_SignatureFailure
Definition: upnp.h:50
UPnPResult_MythTV_XmlParseError
@ UPnPResult_MythTV_XmlParseError
Definition: upnp.h:88
uint
unsigned int uint
Definition: compat.h:141
UPnPResult_CDS_InvalidNewTagValue
@ UPnPResult_CDS_InvalidNewTagValue
Definition: upnp.h:59
UPnPResult_ActionNotAuthorized
@ UPnPResult_ActionNotAuthorized
Definition: upnp.h:49
UPnPResult_CMGR_LocalRestrictions
@ UPnPResult_CMGR_LocalRestrictions
Definition: upnp.h:80
UPnPResult_CDS_NoSuchContainer
@ UPnPResult_CDS_NoSuchContainer
Definition: upnp.h:65
UPnPResult_ActionFailed
@ UPnPResult_ActionFailed
Definition: upnp.h:42
UPnPResult_CMGR_InvalidConnectionRef
@ UPnPResult_CMGR_InvalidConnectionRef
Definition: upnp.h:82
taskqueue.h
UPnPResult_InvalidAction
@ UPnPResult_InvalidAction
Definition: upnp.h:40
UPnPResult_CDS_ParameterMismatch
@ UPnPResult_CDS_ParameterMismatch
Definition: upnp.h:62
UPnp::RootDevice
static UPnpDevice * RootDevice()
Definition: upnp.h:132
UPnPResult_CDS_RestrictedObject
@ UPnPResult_CDS_RestrictedObject
Definition: upnp.h:66
UPnPResult_CMGR_AccessDenied
@ UPnPResult_CMGR_AccessDenied
Definition: upnp.h:81
UPnp
Definition: upnp.h:100
UPnPResult_CDS_InvalidSortCriteria
@ UPnPResult_CDS_InvalidSortCriteria
Definition: upnp.h:64
Configuration
Definition: configuration.h:22
UPnPResult_CDS_ReadOnlyTag
@ UPnPResult_CDS_ReadOnlyTag
Definition: upnp.h:61
UPnPResult_CDS_ResrtictedParentObject
@ UPnPResult_CDS_ResrtictedParentObject
Definition: upnp.h:68
configuration.h
UPnPResult_CDS_NoSuchObject
@ UPnPResult_CDS_NoSuchObject
Definition: upnp.h:57
UPnPResult_StringArgumentTooLong
@ UPnPResult_StringArgumentTooLong
Definition: upnp.h:48
UPNP_PUBLIC
#define UPNP_PUBLIC
Definition: upnpexp.h:9
HttpServer
Definition: httpserver.h:113
UPnPResult_ArgumentValueInvalid
@ UPnPResult_ArgumentValueInvalid
Definition: upnp.h:43
UPnPResult_InvalidControlURL
@ UPnPResult_InvalidControlURL
Definition: upnp.h:54
UPnPResult_CDS_ResourceAccessDenied
@ UPnPResult_CDS_ResourceAccessDenied
Definition: upnp.h:70
UPnPResult_InvalidSequence
@ UPnPResult_InvalidSequence
Definition: upnp.h:53
httpserver.h
UPnPResult_Success
@ UPnPResult_Success
Definition: upnp.h:38
mythpower.h
UPnPResult_MS_AccessDenied
@ UPnPResult_MS_AccessDenied
Definition: upnp.h:85
UPnp::g_UPnpDeviceDesc
static UPnpDeviceDesc g_UPnpDeviceDesc
Definition: upnp.h:112
UPnp::g_IPAddrList
static QList< QHostAddress > g_IPAddrList
Definition: upnp.h:113
UPnPResult_CDS_DestResAccessDenied
@ UPnPResult_CDS_DestResAccessDenied
Definition: upnp.h:74
UPnPResultCode
UPnPResultCode
Definition: upnp.h:37