MythTV  master
bonjourregister.h
Go to the documentation of this file.
1 #ifndef BONJOURREGISTER_H
2 #define BONJOURREGISTER_H
3 
4 #include <QObject>
5 #include <QMutex>
6 #include <dns_sd.h>
7 #include "mythbaseexp.h"
8 
9 class QSocketNotifier;
10 
11 class MBASE_PUBLIC BonjourRegister : public QObject
12 {
13  Q_OBJECT
14  public:
15  explicit BonjourRegister(QObject *parent = nullptr);
16  ~BonjourRegister() override;
17 
18  bool Register(uint16_t port, const QByteArray &type, const QByteArray &name,
19  const QByteArray &txt);
20  bool ReAnnounceService(void);
21 
22  QByteArray m_name;
23  QByteArray m_type;
24 
25  private slots:
26  void socketReadyRead();
27 
28  private:
29  static void DNSSD_API BonjourCallback(DNSServiceRef ref,
30  DNSServiceFlags flags,
31  DNSServiceErrorType errorcode,
32  const char *name, const char *type,
33  const char *domain, void *object);
34  QByteArray RandomizeData(void);
35 
36  DNSServiceRef m_dnssref {nullptr};
37  QSocketNotifier *m_socket {nullptr};
38 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
39  QMutexLocker *m_lock {nullptr};
40 #else
41  QMutexLocker<QMutex> *m_lock {nullptr};
42 #endif
43  static QMutex g_lock;
44  QByteArray m_data;
45 };
46 #endif
BonjourRegister::m_name
QByteArray m_name
Definition: bonjourregister.h:22
mythbaseexp.h
BonjourRegister
Definition: bonjourregister.h:11
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
BonjourRegister::g_lock
static QMutex g_lock
Definition: bonjourregister.h:43
BonjourRegister::m_data
QByteArray m_data
Definition: bonjourregister.h:44
uint16_t
unsigned short uint16_t
Definition: iso6937tables.h:3
BonjourRegister::m_type
QByteArray m_type
Definition: bonjourregister.h:23