Go to the documentation of this file.
13 #include <QNetworkInterface>
44 LOG(VB_UPNP, LOG_DEBUG,
"UPnp - Constructor");
64 LOG(VB_UPNP, LOG_DEBUG,
"UPnp - Destructor");
102 if (sList.contains(QHostAddress(QHostAddress::AnyIPv4)))
104 sList.removeAll(QHostAddress(QHostAddress::AnyIPv4));
105 sList.removeAll(QHostAddress(QHostAddress::AnyIPv6));
106 sList.append(QNetworkInterface::allAddresses());
108 return Initialize( sList, nServicePort, pHttpServer );
117 LOG(VB_UPNP, LOG_DEBUG,
"UPnp::Initialize - Begin");
121 LOG(VB_GENERAL, LOG_ERR,
122 "UPnp::Initialize - Already initialized, programmer error.");
128 LOG(VB_GENERAL, LOG_ERR,
129 "UPnp::Initialize - Must call SetConfiguration.");
135 LOG(VB_GENERAL, LOG_ERR,
136 "UPnp::Initialize - Invalid Parameter (pHttpServer == NULL)");
150 if ((
g_IPAddrList[it].protocol() == QAbstractSocket::IPv4Protocol
152 ||(
g_IPAddrList[it].protocol() == QAbstractSocket::IPv6Protocol
166 LOG(VB_UPNP, LOG_DEBUG,
"UPnp::Initialize - End");
177 LOG(VB_UPNP, LOG_DEBUG,
"UPnp::Start - Enabling SSDP Notifications");
185 LOG(VB_UPNP, LOG_DEBUG,
"UPnp::Start - Returning");
194 LOG(VB_UPNP, LOG_INFO,
"UPnp::CleanUp() - disabling SSDP notifications");
286 if (pRequest !=
nullptr)
288 QString sDetails =
"";
291 sDetails =
"<UPnPResult xmlns=\"urn:schemas-upnp-org:control-1-0\">";
293 if (sMsg.length() == 0)
296 sDetails += QString(
"<errorCode>%1</errorCode>"
297 "<errorDescription>%2</errorDescription>" )
302 sDetails +=
"</UPnPResult>";
310 LOG(VB_GENERAL, LOG_ERR,
"Response not created - pRequest == NULL" );
318 const QString &hostName )
324 QString sUrl =
"http://" + pRequest->
GetLastHeader(
"host" ) + sItems[1];
327 (
"BackendServerAddr",hostName,hostName);
328 url.setHost( ipAddress );
332 LOG(VB_UPNP, LOG_INFO, QString(
"Sending http redirect to: %1")
333 .
arg(url.toString()));
@ UPnPResult_CDS_RequiredTag
@ UPnPResult_MythTV_NoNamespaceGiven
void WokeUp(qint64 SecondsAsleep)
@ UPnPResult_CMGR_NotInNetwork
@ UPnPResult_CDS_InvalidSearchCriteria
static UPnpDeviceDesc * Retrieve(QString &sURL)
@ UPnPResult_CDS_BadMetadata
void RegisterExtension(HttpServerExtension *pExtension)
@ UPnPResult_ArgumentValueOutOfRange
arg(title).arg(filename).arg(doDelete))
@ UPnPResult_CDS_NoSuchDestRes
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void WillSuspend(uint MilliSeconds=0)
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
@ 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
@ UPnPResult_CDS_NoSuchSourceResource
@ UPnPResult_OptionalActionNotImplemented
static Configuration * g_pConfig
@ 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
@ 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
static MythPower * AcquireRelease(void *Reference, bool Acquire, uint MinimumDelay=0)
@ 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
@ UPnPResult_CDS_ResrtictedParentObject
static void DisableNotifications(uint)
@ UPnPResult_CDS_NoSuchObject
@ UPnPResult_StringArgumentTooLong
@ UPnPResult_ArgumentValueInvalid
static Configuration * GetConfiguration()
@ UPnPResult_InvalidControlURL
HttpServer * m_pHttpServer
@ UPnPResult_CDS_ResourceAccessDenied
@ UPnPResult_InvalidSequence
void EnableNotifications(int nServicePort)
qint64 SendResponse(void)
void WillRestart(uint MilliSeconds=0)
@ UPnPResult_MS_AccessDenied
static void SetConfiguration(Configuration *pConfig)
void WillShutDown(uint MilliSeconds=0)
static UPnpDeviceDesc g_UPnpDeviceDesc
static QList< QHostAddress > g_IPAddrList
void EnableNotificatins(qint64) const
@ UPnPResult_CDS_DestResAccessDenied
static QString GetResultDesc(UPnPResultCode eCode)