-
Notifications
You must be signed in to change notification settings - Fork 51
/
qzeroconfservice.h
58 lines (48 loc) · 1.34 KB
/
qzeroconfservice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef QZEROCONFSERVICE_H
#define QZEROCONFSERVICE_H
#include <QHostAddress>
#include <QMutexLocker>
#include <QSharedPointer>
#include "qzeroconfglobal.h"
class QZeroConfPrivate;
class Q_ZEROCONF_EXPORT QZeroConfServiceData
{
Q_GADGET
Q_PROPERTY( QString name READ name )
Q_PROPERTY( QString type READ type )
Q_PROPERTY( QString domain READ domain )
Q_PROPERTY( QString host READ host )
friend class QZeroConfPrivate;
public:
inline QString name() const {return m_name;}
inline QString type() const {return m_type;}
inline QString domain() const {return m_domain;}
inline QString host() const {return m_host;}
QHostAddress ip()
{
QMutexLocker locker(&m_lock);
return m_ip;
}
inline quint32 interfaceIndex() const {return m_interfaceIndex;}
quint16 port() const {return m_port;}
QMap <QByteArray, QByteArray> txt() const {return m_txt;}
private:
void setIp(QHostAddress &ip)
{
QMutexLocker locker(&m_lock);
m_ip = ip;
}
QString m_name;
QString m_type;
QString m_domain;
QString m_host;
QHostAddress m_ip;
quint32 m_interfaceIndex;
quint16 m_port;
QMap <QByteArray, QByteArray> m_txt;
QMutex m_lock;
};
typedef QSharedPointer<QZeroConfServiceData> QZeroConfService;
Q_DECLARE_METATYPE(QZeroConfService)
QDebug Q_ZEROCONF_EXPORT operator<<(QDebug debug, const QZeroConfService &service);
#endif // QZEROCONFSERVICE_H