qcp/libqtavahi/qtavahi_p.h

51 lines
1.3 KiB
C
Raw Normal View History

2010-07-24 16:16:44 +00:00
#ifndef QTAVAHI_P_H
#define QTAVAHI_P_H
namespace Avahi {
namespace priv {
class LIBQTAVAHISHARED_EXPORT ServiceP;
class BrowseP;
class AnnounceP;
};
}
namespace Avahi {
namespace priv {
class LIBQTAVAHISHARED_EXPORT ServiceP {
private:
friend class Avahi::Service;
friend class Avahi::ServiceKey;
friend class Avahi::Browse;
inline ServiceP(QString name, QString hostname, QString domain, QHostAddress address, int interface, int protocol, quint16 port, QHash<QString, QString> txt)
: m_ref(1), m_name(name), m_hostname(hostname), m_domain(domain), m_address(address), m_interface(interface), m_protocol(protocol), m_port(port), m_txt(txt), m_data(0) { }
Q_DISABLE_COPY(ServiceP);
inline void ref() { m_ref.ref(); }
inline void deref() { if (!m_ref.deref()) { delete this; } }
QAtomicInt m_ref;
QString m_name, m_hostname, m_domain;
QHostAddress m_address;
int m_interface, m_protocol;
quint16 m_port;
QHash<QString, QString> m_txt;
void* m_data;
};
typedef enum { TCP, UDP } Protocol;
inline LIBQTAVAHISHARED_EXPORT QString serv_prot2str(QString service, Protocol prot) {
switch (prot) {
case TCP: return QString("_%1._tcp").arg(service); break;
case UDP: return QString("_%1._udp").arg(service); break;
default: return service;
}
}
}
}
#endif // QTAVAHI_P_H