Go to the documentation of this file.
13 #include <QNetworkInterface>
39 LOG(VB_UPNP, LOG_DEBUG,
"UPnp - Constructor");
59 LOG(VB_UPNP, LOG_DEBUG,
"UPnp - Destructor");
77 if (sList.contains(QHostAddress(QHostAddress::AnyIPv4)))
79 sList.removeAll(QHostAddress(QHostAddress::AnyIPv4));
80 sList.removeAll(QHostAddress(QHostAddress::AnyIPv6));
81 sList.append(QNetworkInterface::allAddresses());
83 return Initialize( sList, nServicePort, pHttpServer );
92 LOG(VB_UPNP, LOG_DEBUG,
"UPnp::Initialize - Begin");
96 LOG(VB_GENERAL, LOG_ERR,
97 "UPnp::Initialize - Already initialized, programmer error.");
103 LOG(VB_GENERAL, LOG_ERR,
104 "UPnp::Initialize - Invalid Parameter (pHttpServer == NULL)");
118 if ((
g_IPAddrList[it].protocol() == QAbstractSocket::IPv4Protocol
120 ||(
g_IPAddrList[it].protocol() == QAbstractSocket::IPv6Protocol
134 LOG(VB_UPNP, LOG_DEBUG,
"UPnp::Initialize - End");
145 LOG(VB_UPNP, LOG_DEBUG,
"UPnp::Start - Enabling SSDP Notifications");
153 LOG(VB_UPNP, LOG_DEBUG,
"UPnp::Start - Returning");
162 LOG(VB_UPNP, LOG_INFO,
"UPnp::CleanUp() - disabling SSDP notifications");
247 if (pRequest !=
nullptr)
249 QString sDetails =
"";
252 sDetails =
"<UPnPResult xmlns=\"urn:schemas-upnp-org:control-1-0\">";
254 if (sMsg.length() == 0)
257 sDetails += QString(
"<errorCode>%1</errorCode>"
258 "<errorDescription>%2</errorDescription>" )
263 sDetails +=
"</UPnPResult>";
271 LOG(VB_GENERAL, LOG_ERR,
"Response not created - pRequest == NULL" );
279 const QString &hostName )
285 QString sUrl =
"http://" + pRequest->
GetLastHeader(
"host" ) + sItems[1];
288 (
"BackendServerAddr",hostName,hostName);
289 url.setHost( ipAddress );
293 LOG(VB_UPNP, LOG_INFO, QString(
"Sending http redirect to: %1")
294 .arg(url.toString()));
@ UPnPResult_CDS_RequiredTag
@ UPnPResult_MythTV_NoNamespaceGiven
@ UPnPResult_CMGR_NotInNetwork
@ UPnPResult_CDS_InvalidSearchCriteria
static UPnpDeviceDesc * Retrieve(QString &sURL)
@ UPnPResult_CDS_BadMetadata
void RegisterExtension(HttpServerExtension *pExtension)
@ UPnPResult_ArgumentValueOutOfRange
@ UPnPResult_CDS_NoSuchDestRes
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void WillSuspend(std::chrono::milliseconds MilliSeconds=0ms)
static QString Encode(const QString &sIn)
static void FormatErrorResponse(HTTPRequest *pRequest, UPnPResultCode eCode, const QString &sMsg="")
bool Initialize(int nServicePort, HttpServer *pHttpServer)
@ UPnPResult_CDS_TransferBusy
void WillRestart(std::chrono::milliseconds MilliSeconds=0ms)
@ UPnPResult_SignatureMissing
@ UPnPResult_HumanInterventionRequired
QStringMap m_mapRespHeaders
static void FormatRedirectResponse(HTTPRequest *pRequest, const QString &hostName)
@ UPnPResult_NoSuchSession
static UPnpDeviceDesc * GetDeviceDesc(QString &sURL)
@ UPnPResult_CDS_NoSuchFileTransfer
static MythPower * AcquireRelease(void *Reference, bool Acquire, std::chrono::seconds MinimumDelay=0s)
@ UPnPResult_CDS_NoSuchSourceResource
static void DisableNotifications(std::chrono::milliseconds)
@ UPnPResult_OptionalActionNotImplemented
@ UPnPResult_CDS_CannotProcessRequest
@ UPnPResult_CDS_InvalidCurrentTagValue
@ UPnPResult_NotEncrypted
static QList< QHostAddress > DefaultListen(void)
@ UPnPResult_SignatureFailure
@ UPnPResult_MythTV_XmlParseError
@ UPnPResult_CDS_InvalidNewTagValue
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
@ UPnPResult_ActionNotAuthorized
void EnableNotificatins(std::chrono::milliseconds) const
@ UPnPResult_CDS_NoSuchContainer
@ UPnPResult_ActionFailed
@ UPnPResult_InvalidAction
void DisableNotifications()
bool GetBoolSetting(const QString &key, bool defaultval=false)
@ UPnPResult_CDS_ParameterMismatch
QString GetSharePath(void) const
@ UPnPResult_CDS_RestrictedObject
@ UPnPResult_CDS_InvalidSortCriteria
void FormatErrorResponse(bool bServerError, const QString &sFaultString, const QString &sDetails)
QString GetLastHeader(const QString &sType) const
QString GetSettingOnHost(const QString &key, const QString &host, const QString &defaultval="")
@ UPnPResult_CDS_ReadOnlyTag
HttpResponseType m_eResponseType
void WillShutDown(std::chrono::milliseconds MilliSeconds=0ms)
@ UPnPResult_CDS_ResrtictedParentObject
@ UPnPResult_CDS_NoSuchObject
@ UPnPResult_StringArgumentTooLong
@ UPnPResult_ArgumentValueInvalid
@ UPnPResult_InvalidControlURL
HttpServer * m_pHttpServer
@ UPnPResult_CDS_ResourceAccessDenied
@ UPnPResult_InvalidSequence
void EnableNotifications(int nServicePort)
qint64 SendResponse(void)
@ UPnPResult_MS_AccessDenied
static UPnpDeviceDesc g_UPnpDeviceDesc
static QList< QHostAddress > g_IPAddrList
void WokeUp(std::chrono::seconds SecondsAsleep)
@ UPnPResult_CDS_DestResAccessDenied
static QString GetResultDesc(UPnPResultCode eCode)