Go to the documentation of this file.
22 #include "msocketdevice.h"
26 #define SSDP_GROUP "239.255.255.250"
27 #define SSDP_PORT 1900
28 #define SSDP_SEARCHPORT 6549
53 #define SocketIdx_Search 0
54 #define SocketIdx_Multicast 1
55 #define SocketIdx_Broadcast 2
63 QRegularExpression m_procReqLineExp {
"\\s+"};
64 constexpr
static int kNumberOfSockets = 3;
65 std::array<MSocketDevice*,kNumberOfSockets> m_sockets {
nullptr,
nullptr,
nullptr};
69 int m_nServicePort {0};
72 bool m_bAnnouncementsEnabled {
false};
74 bool m_bTermRequested {
false};
75 QMutex m_lock {QMutex::NonRecursive};
87 bool ProcessSearchRequest (
const QStringMap &sHeaders,
88 const QHostAddress& peerAddress,
89 quint16 peerPort )
const;
90 static bool ProcessSearchResponse(
const QStringMap &sHeaders );
91 static bool ProcessNotify (
const QStringMap &sHeaders );
93 bool IsTermRequested ();
95 static QString GetHeaderValue (
const QStringMap &headers,
97 const QString &sDefault );
99 void ProcessData ( MSocketDevice *pSocket );
107 static SSDP* Instance();
108 static void Shutdown();
112 void RequestTerminate(
void);
114 void PerformSearch(
const QString &sST,
uint timeout_secs = 2);
116 void EnableNotifications (
int nServicePort );
117 void DisableNotifications();
QStringList GetBasePaths() override
static SSDPCacheEntries * Find(const QString &sURI)
static SSDPCache * Instance()
static DeviceLocation * Find(const QString &sURI, const QString &sUSN)
void addListener(QObject *listener)
Add a listener to the observable.
static SSDPMethod GetMethod(const QString &sURI)
SSDPCacheEntries * Find(const QString &sURI)
Finds the SSDPCacheEntries in the cache, returns nullptr when absent.
QMap< QString, QString > QStringMap
~SSDPExtension() override=default
bool ProcessRequest(HTTPRequest *pRequest) override
virtual void run(void)
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
static void GetDeviceList(HTTPRequest *pRequest)
void GetDeviceDesc(HTTPRequest *pRequest) const
This is a wrapper around QThread that does several additional things.
static void AddListener(QObject *listener)
SSDPExtension(int nServicePort, const QString &sSharePath)
void removeListener(QObject *listener)
Remove a listener to the observable.
void GetFile(HTTPRequest *pRequest, const QString &sFileName)
static void RemoveListener(QObject *listener)