MythTV  master
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SSDP Class Reference

#include <ssdp.h>

Inheritance diagram for SSDP:
Inheritance graph
[legend]
Collaboration diagram for SSDP:
Collaboration graph
[legend]

Public Member Functions

 ~SSDP ()
 
void RequestTerminate (void)
 
void PerformSearch (const QString &sST, uint timeout_secs=2)
 
void EnableNotifications (int nServicePort)
 
void DisableNotifications ()
 
- Public Member Functions inherited from MThread
 MThread (const QString &objectName)
 Standard constructor. More...
 
 MThread (const QString &objectName, QRunnable *runnable)
 Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More...
 
virtual ~MThread ()
 
void RunProlog (void)
 Sets up a thread, call this if you reimplement run(). More...
 
void RunEpilog (void)
 Cleans up a thread's resources, call this if you reimplement run(). More...
 
QThread * qthread (void)
 Returns the thread, this will always return the same pointer no matter how often you restart the thread. More...
 
void setObjectName (const QString &name)
 
QString objectName (void) const
 
void setPriority (QThread::Priority priority)
 
QThread::Priority priority (void) const
 
bool isFinished (void) const
 
bool isRunning (void) const
 
void setStackSize (uint stackSize)
 
uint stackSize (void) const
 
void exit (int retcode=0)
 Use this to exit from the thread if you are using a Qt event loop. More...
 
void start (QThread::Priority=QThread::InheritPriority)
 Tell MThread to start running the thread in the near future. More...
 
void terminate (void)
 Kill a thread unsafely. More...
 
void quit (void)
 calls exit(0) More...
 
bool wait (unsigned long time=ULONG_MAX)
 Wait for the MThread to exit, with a maximum timeout. More...
 

Static Public Member Functions

static SSDPInstance ()
 
static void Shutdown ()
 
static void AddListener (QObject *listener)
 
static void RemoveListener (QObject *listener)
 
static SSDPCacheEntriesFind (const QString &sURI)
 
static DeviceLocationFind (const QString &sURI, const QString &sUSN)
 
- Static Public Member Functions inherited from MThread
static void ThreadSetup (const QString &)
 This is to be called on startup in those few threads that haven't been ported to MThread. More...
 
static void ThreadCleanup (void)
 This is to be called on exit in those few threads that haven't been ported to MThread. More...
 
static void Cleanup (void)
 This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More...
 
static void GetAllThreadNames (QStringList &list)
 
static void GetAllRunningThreadNames (QStringList &list)
 

Protected Member Functions

bool ProcessSearchRequest (const QStringMap &sHeaders, const QHostAddress &peerAddress, quint16 peerPort)
 
bool IsTermRequested ()
 
void ProcessData (MSocketDevice *pSocket)
 
SSDPRequestType ProcessRequestLine (const QString &sLine)
 
void run () override
 Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead. More...
 
- Protected Member Functions inherited from MThread
int exec (void)
 Enters the qt event loop. call exit or quit to exit thread. More...
 

Static Protected Member Functions

static bool ProcessSearchResponse (const QStringMap &sHeaders)
 
static bool ProcessNotify (const QStringMap &sHeaders)
 
static QString GetHeaderValue (const QStringMap &headers, const QString &sKey, const QString &sDefault)
 
- Static Protected Member Functions inherited from MThread
static void setTerminationEnabled (bool enabled=true)
 
static void sleep (unsigned long time)
 
static void msleep (unsigned long time)
 
static void usleep (unsigned long time)
 

Private Member Functions

 SSDP ()
 

Private Attributes

QRegExp m_procReqLineExp {"[ \r\n][ \r\n]*"}
 
MSocketDevice * m_Sockets [3] {nullptr,nullptr,nullptr}
 
int m_nPort {SSDP_PORT}
 
int m_nSearchPort {SSDP_SEARCHPORT}
 
int m_nServicePort {0}
 
UPnpNotifyTaskm_pNotifyTask {nullptr}
 
bool m_bAnnouncementsEnabled {false}
 
bool m_bTermRequested {false}
 
QMutex m_lock {QMutex::NonRecursive}
 

Static Private Attributes

static SSDPg_pSSDP = nullptr
 

Additional Inherited Members

- Static Public Attributes inherited from MThread
static const int kDefaultStartTimeout
 
- Protected Attributes inherited from MThread
MThreadInternalm_thread {nullptr}
 
QRunnable * m_runnable {nullptr}
 
bool m_prolog_executed {true}
 
bool m_epilog_executed {true}
 

Detailed Description

Definition at line 61 of file ssdp.h.

Constructor & Destructor Documentation

◆ SSDP()

SSDP::SSDP ( )
private

Definition at line 75 of file ssdp.cpp.

◆ ~SSDP()

SSDP::~SSDP ( )

Definition at line 115 of file ssdp.cpp.

Member Function Documentation

◆ ProcessSearchRequest()

bool SSDP::ProcessSearchRequest ( const QStringMap sHeaders,
const QHostAddress &  peerAddress,
quint16  peerPort 
)
protected

Definition at line 511 of file ssdp.cpp.

Referenced by ProcessData().

◆ ProcessSearchResponse()

bool SSDP::ProcessSearchResponse ( const QStringMap sHeaders)
staticprotected

Definition at line 602 of file ssdp.cpp.

Referenced by ProcessData().

◆ ProcessNotify()

bool SSDP::ProcessNotify ( const QStringMap sHeaders)
staticprotected

Definition at line 636 of file ssdp.cpp.

Referenced by ProcessData().

◆ IsTermRequested()

bool SSDP::IsTermRequested ( )
protected

◆ GetHeaderValue()

QString SSDP::GetHeaderValue ( const QStringMap headers,
const QString &  sKey,
const QString &  sDefault 
)
staticprotected

Definition at line 496 of file ssdp.cpp.

Referenced by ProcessNotify(), ProcessSearchRequest(), and ProcessSearchResponse().

◆ ProcessData()

void SSDP::ProcessData ( MSocketDevice *  pSocket)
protected

Definition at line 318 of file ssdp.cpp.

Referenced by run().

◆ ProcessRequestLine()

SSDPRequestType SSDP::ProcessRequestLine ( const QString &  sLine)
protected

Definition at line 469 of file ssdp.cpp.

Referenced by ProcessData().

◆ run()

void SSDP::run ( void  )
overrideprotectedvirtual

Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.

Note
If you override this method you must call RunProlog before you do any work and RunEpilog before you exit the run method.

Reimplemented from MThread.

Definition at line 250 of file ssdp.cpp.

◆ Instance()

SSDP * SSDP::Instance ( )
static

◆ Shutdown()

void SSDP::Shutdown ( void  )
static

Definition at line 64 of file ssdp.cpp.

Referenced by MythContext::~MythContext().

◆ RequestTerminate()

void SSDP::RequestTerminate ( void  )

Definition at line 141 of file ssdp.cpp.

Referenced by cleanup().

◆ PerformSearch()

void SSDP::PerformSearch ( const QString &  sST,
uint  timeout_secs = 2 
)

◆ EnableNotifications()

void SSDP::EnableNotifications ( int  nServicePort)

Definition at line 150 of file ssdp.cpp.

Referenced by UPnp::Start().

◆ DisableNotifications()

void SSDP::DisableNotifications ( )

Definition at line 190 of file ssdp.cpp.

Referenced by UPnp::CleanUp(), and ~SSDP().

◆ AddListener()

static void SSDP::AddListener ( QObject *  listener)
inlinestatic

Definition at line 124 of file ssdp.h.

Referenced by BackendSelection::Load(), and UPNPScanner::Start().

◆ RemoveListener()

static void SSDP::RemoveListener ( QObject *  listener)
inlinestatic

Definition at line 126 of file ssdp.h.

Referenced by UPNPScanner::Stop(), and BackendSelection::~BackendSelection().

◆ Find() [1/2]

static SSDPCacheEntries* SSDP::Find ( const QString &  sURI)
inlinestatic

◆ Find() [2/2]

static DeviceLocation* SSDP::Find ( const QString &  sURI,
const QString &  sUSN 
)
inlinestatic

Definition at line 131 of file ssdp.h.

Member Data Documentation

◆ g_pSSDP

SSDP * SSDP::g_pSSDP = nullptr
staticprivate

Definition at line 65 of file ssdp.h.

◆ m_procReqLineExp

QRegExp SSDP::m_procReqLineExp {"[ \r\n][ \r\n]*"}
private

Definition at line 67 of file ssdp.h.

Referenced by ProcessRequestLine().

◆ m_Sockets

MSocketDevice* SSDP::m_Sockets[3] {nullptr,nullptr,nullptr}
private

Definition at line 68 of file ssdp.h.

Referenced by PerformSearch(), run(), SSDP(), and ~SSDP().

◆ m_nPort

int SSDP::m_nPort {SSDP_PORT}
private

Definition at line 70 of file ssdp.h.

Referenced by SSDP().

◆ m_nSearchPort

int SSDP::m_nSearchPort {SSDP_SEARCHPORT}
private

Definition at line 71 of file ssdp.h.

Referenced by SSDP().

◆ m_nServicePort

int SSDP::m_nServicePort {0}
private

Definition at line 72 of file ssdp.h.

Referenced by EnableNotifications(), and ProcessSearchRequest().

◆ m_pNotifyTask

UPnpNotifyTask* SSDP::m_pNotifyTask {nullptr}
private

Definition at line 74 of file ssdp.h.

Referenced by DisableNotifications(), EnableNotifications(), ProcessData(), and ~SSDP().

◆ m_bAnnouncementsEnabled

bool SSDP::m_bAnnouncementsEnabled {false}
private

Definition at line 75 of file ssdp.h.

Referenced by DisableNotifications(), and EnableNotifications().

◆ m_bTermRequested

bool SSDP::m_bTermRequested {false}
private

Definition at line 77 of file ssdp.h.

Referenced by RequestTerminate(), run(), and ~SSDP().

◆ m_lock

QMutex SSDP::m_lock {QMutex::NonRecursive}
private

Definition at line 78 of file ssdp.h.


The documentation for this class was generated from the following files: