diff options
Diffstat (limited to '3rdparty')
-rw-r--r-- | 3rdparty/qqbonjour-src/BonjourRecord.h | 57 | ||||
-rw-r--r-- | 3rdparty/qqbonjour-src/BonjourServiceBrowser.cpp | 85 | ||||
-rw-r--r-- | 3rdparty/qqbonjour-src/BonjourServiceBrowser.h | 67 | ||||
-rw-r--r-- | 3rdparty/qqbonjour-src/BonjourServiceRegister.cpp | 98 | ||||
-rw-r--r-- | 3rdparty/qqbonjour-src/BonjourServiceRegister.h | 69 | ||||
-rw-r--r-- | 3rdparty/qqbonjour-src/BonjourServiceResolver.cpp | 103 | ||||
-rw-r--r-- | 3rdparty/qqbonjour-src/BonjourServiceResolver.h | 74 | ||||
-rw-r--r-- | 3rdparty/qqbonjour-src/LICENSE | 25 | ||||
-rw-r--r-- | 3rdparty/qqbonjour-src/README | 13 |
9 files changed, 591 insertions, 0 deletions
diff --git a/3rdparty/qqbonjour-src/BonjourRecord.h b/3rdparty/qqbonjour-src/BonjourRecord.h new file mode 100644 index 000000000..3bf553eb1 --- /dev/null +++ b/3rdparty/qqbonjour-src/BonjourRecord.h @@ -0,0 +1,57 @@ +/* +Copyright (c) 2007, Trenton Schulz + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef MUMBLE_BONJOUR_RECORD_H_ +#define MUMBLE_BONJOUR_RECORD_H_ + +#include <QtCore/QMetaType> +#include <QtCore/QString> + +class BonjourRecord { + public: + BonjourRecord() {} + BonjourRecord(const QString &name, const QString ®Type, const QString &domain) + : serviceName(name), registeredType(regType), replyDomain(domain) {} + BonjourRecord(const char *name, const char *regType, const char *domain) { + serviceName = QString::fromUtf8(name); + registeredType = QString::fromUtf8(regType); + replyDomain = QString::fromUtf8(domain); + } + QString serviceName; + QString registeredType; + QString replyDomain; + bool operator==(const BonjourRecord &other) const { + return serviceName == other.serviceName + && registeredType == other.registeredType + && replyDomain == other.replyDomain; + } +}; + +Q_DECLARE_METATYPE(BonjourRecord) + +#endif diff --git a/3rdparty/qqbonjour-src/BonjourServiceBrowser.cpp b/3rdparty/qqbonjour-src/BonjourServiceBrowser.cpp new file mode 100644 index 000000000..ce30e5f66 --- /dev/null +++ b/3rdparty/qqbonjour-src/BonjourServiceBrowser.cpp @@ -0,0 +1,85 @@ +/* +Copyright (c) 2007, Trenton Schulz + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "murmur_pch.h" + +#include "BonjourServiceBrowser.h" + +BonjourServiceBrowser::BonjourServiceBrowser(QObject *p) + : QObject(p), dnssref(0), bonjourSocket(0) { +} + +BonjourServiceBrowser::~BonjourServiceBrowser() { + if (dnssref) { + DNSServiceRefDeallocate(dnssref); + dnssref = 0; + } +} + +void BonjourServiceBrowser::browseForServiceType(const QString &serviceType) { + DNSServiceErrorType err = DNSServiceBrowse(&dnssref, 0, 0, serviceType.toUtf8().constData(), 0, + bonjourBrowseReply, this); + if (err != kDNSServiceErr_NoError) { + emit error(err); + } else { + int sockfd = DNSServiceRefSockFD(dnssref); + if (sockfd == -1) { + emit error(kDNSServiceErr_Invalid); + } else { + bonjourSocket = new QSocketNotifier(sockfd, QSocketNotifier::Read, this); + connect(bonjourSocket, SIGNAL(activated(int)), this, SLOT(bonjourSocketReadyRead())); + } + } +} + +void BonjourServiceBrowser::bonjourSocketReadyRead() { + DNSServiceErrorType err = DNSServiceProcessResult(dnssref); + if (err != kDNSServiceErr_NoError) + emit error(err); +} + +void BonjourServiceBrowser::bonjourBrowseReply(DNSServiceRef , DNSServiceFlags flags, + quint32 , DNSServiceErrorType errorCode, + const char *serviceName, const char *regType, + const char *replyDomain, void *context) { + BonjourServiceBrowser *serviceBrowser = static_cast<BonjourServiceBrowser *>(context); + if (errorCode != kDNSServiceErr_NoError) { + emit serviceBrowser->error(errorCode); + } else { + BonjourRecord bonjourRecord(serviceName, regType, replyDomain); + if (flags & kDNSServiceFlagsAdd) { + if (!serviceBrowser->bonjourRecords.contains(bonjourRecord)) + serviceBrowser->bonjourRecords.append(bonjourRecord); + } else { + serviceBrowser->bonjourRecords.removeAll(bonjourRecord); + } + if (!(flags & kDNSServiceFlagsMoreComing)) { + emit serviceBrowser->currentBonjourRecordsChanged(serviceBrowser->bonjourRecords); + } + } +} diff --git a/3rdparty/qqbonjour-src/BonjourServiceBrowser.h b/3rdparty/qqbonjour-src/BonjourServiceBrowser.h new file mode 100644 index 000000000..0bc0c743a --- /dev/null +++ b/3rdparty/qqbonjour-src/BonjourServiceBrowser.h @@ -0,0 +1,67 @@ +/* +Copyright (c) 2007, Trenton Schulz +Copyright (c) 2009-2011, Stefan Hacker + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef MUMBLE_BONJOURSERVICEBROWSER_H_ +#define MUMBLE_BONJOURSERVICEBROWSER_H_ + +#include <dns_sd.h> + +#include <QtCore/QObject> + +#include "BonjourRecord.h" + +class QSocketNotifier; + +class BonjourServiceBrowser : public QObject { + Q_OBJECT + public: + BonjourServiceBrowser(QObject *parent = 0); + ~BonjourServiceBrowser(); + void browseForServiceType(const QString &serviceType); + inline QList<BonjourRecord> currentRecords() const { + return bonjourRecords; + } + + signals: + void currentBonjourRecordsChanged(const QList<BonjourRecord> &list); + void error(DNSServiceErrorType err); + + private slots: + void bonjourSocketReadyRead(); + + private: + static void DNSSD_API bonjourBrowseReply(DNSServiceRef , DNSServiceFlags flags, quint32, + DNSServiceErrorType errorCode, const char *serviceName, + const char *regType, const char *replyDomain, void *context); + DNSServiceRef dnssref; + QSocketNotifier *bonjourSocket; + QList<BonjourRecord> bonjourRecords; +}; + +#endif diff --git a/3rdparty/qqbonjour-src/BonjourServiceRegister.cpp b/3rdparty/qqbonjour-src/BonjourServiceRegister.cpp new file mode 100644 index 000000000..110f06aca --- /dev/null +++ b/3rdparty/qqbonjour-src/BonjourServiceRegister.cpp @@ -0,0 +1,98 @@ +/* +Copyright (c) 2007, Trenton Schulz +Copyright (c) 2009-2011, Stefan Hacker + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "murmur_pch.h" + +#include "BonjourServiceRegister.h" + +BonjourServiceRegister::BonjourServiceRegister(QObject *p) + : QObject(p), dnssref(0), bonjourSocket(0) { +} + +BonjourServiceRegister::~BonjourServiceRegister() { + if (dnssref) { + DNSServiceRefDeallocate(dnssref); + dnssref = 0; + } +} + +void BonjourServiceRegister::registerService(const BonjourRecord &record, quint16 servicePort) { + if (dnssref) { + qWarning("Warning: Already registered a service for this object, aborting new register"); + return; + } + quint16 bigEndianPort = servicePort; +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + { + bigEndianPort = static_cast<quint16>(((servicePort & 0x00ff) << 8) | ((servicePort & 0xff00) >> 8)); + } +#endif + + DNSServiceErrorType err = DNSServiceRegister(&dnssref, 0, 0, + record.serviceName.isEmpty() ? 0 + : record.serviceName.toUtf8().constData(), + record.registeredType.toUtf8().constData(), + record.replyDomain.isEmpty() ? 0 + : record.replyDomain.toUtf8().constData(), 0, + bigEndianPort, 0, 0, bonjourRegisterService, this); + if (err != kDNSServiceErr_NoError) { + emit error(err); + } else { + int sockfd = DNSServiceRefSockFD(dnssref); + if (sockfd == -1) { + emit error(kDNSServiceErr_Invalid); + } else { + bonjourSocket = new QSocketNotifier(sockfd, QSocketNotifier::Read, this); + connect(bonjourSocket, SIGNAL(activated(int)), this, SLOT(bonjourSocketReadyRead())); + } + } +} + + +void BonjourServiceRegister::bonjourSocketReadyRead() { + DNSServiceErrorType err = DNSServiceProcessResult(dnssref); + if (err != kDNSServiceErr_NoError) + emit error(err); +} + + +void DNSSD_API BonjourServiceRegister::bonjourRegisterService(DNSServiceRef, DNSServiceFlags, + DNSServiceErrorType errorCode, const char *name, + const char *regtype, const char *domain, + void *data) { + BonjourServiceRegister *serviceRegister = static_cast<BonjourServiceRegister *>(data); + if (errorCode != kDNSServiceErr_NoError) { + emit serviceRegister->error(errorCode); + } else { + serviceRegister->finalRecord = BonjourRecord(QString::fromUtf8(name), + QString::fromUtf8(regtype), + QString::fromUtf8(domain)); + emit serviceRegister->serviceRegistered(serviceRegister->finalRecord); + } +} diff --git a/3rdparty/qqbonjour-src/BonjourServiceRegister.h b/3rdparty/qqbonjour-src/BonjourServiceRegister.h new file mode 100644 index 000000000..6b37749c3 --- /dev/null +++ b/3rdparty/qqbonjour-src/BonjourServiceRegister.h @@ -0,0 +1,69 @@ +/* +Copyright (c) 2007, Trenton Schulz +Copyright (c) 2009-2011, Stefan Hacker + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef MUMBLE_BONJOUR_SERVICE_REGISTER_H_ +#define MUMBLE_BONJOUR_SERVICE_REGISTER_H_ + +// Bonjour flags +#include <dns_sd.h> +#include <QtCore/QObject> + +#include "BonjourRecord.h" + +class QSocketNotifier; + +class BonjourServiceRegister : public QObject { + Q_OBJECT + public: + BonjourServiceRegister(QObject *p = 0); + ~BonjourServiceRegister(); + + void registerService(const BonjourRecord &record, quint16 servicePort); + inline BonjourRecord registeredRecord() const { + return finalRecord; + } + + signals: + void error(DNSServiceErrorType error); + void serviceRegistered(const BonjourRecord &record); + + private slots: + void bonjourSocketReadyRead(); + + private: + static void DNSSD_API bonjourRegisterService(DNSServiceRef sdRef, DNSServiceFlags, + DNSServiceErrorType errorCode, const char *name, + const char *regtype, const char *domain, + void *context); + DNSServiceRef dnssref; + QSocketNotifier *bonjourSocket; + BonjourRecord finalRecord; +}; + +#endif diff --git a/3rdparty/qqbonjour-src/BonjourServiceResolver.cpp b/3rdparty/qqbonjour-src/BonjourServiceResolver.cpp new file mode 100644 index 000000000..503f24c97 --- /dev/null +++ b/3rdparty/qqbonjour-src/BonjourServiceResolver.cpp @@ -0,0 +1,103 @@ +/* +Copyright (c) 2007, Trenton Schulz +Copyright (C) 2009-2011, Thorvald Natvig <thorvald@natvig.com> + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "murmur_pch.h" + +#include "BonjourServiceResolver.h" + +BonjourServiceResolver::ResolveRecord::ResolveRecord(const BonjourRecord &r, BonjourServiceResolver *p) : record(r), bsr(p), dnssref(NULL), bonjourSocket(NULL), bonjourPort(-1) { +} + +BonjourServiceResolver::ResolveRecord::~ResolveRecord() { + delete bonjourSocket; + if (dnssref) + DNSServiceRefDeallocate(dnssref); +} + +BonjourServiceResolver::BonjourServiceResolver(QObject *p) : QObject(p) { +} + +BonjourServiceResolver::~BonjourServiceResolver() { + foreach(ResolveRecord *rr, qmResolvers) + delete rr; +} + +void BonjourServiceResolver::resolveBonjourRecord(const BonjourRecord &record) { + ResolveRecord *rr = new ResolveRecord(record, this); + + DNSServiceErrorType err = DNSServiceResolve(& rr->dnssref, 0, 0, + record.serviceName.toUtf8().constData(), + record.registeredType.toUtf8().constData(), + record.replyDomain.toUtf8().constData(), + static_cast<DNSServiceResolveReply>(bonjourResolveReply), rr); + + if (err == kDNSServiceErr_NoError) { + int sockfd = DNSServiceRefSockFD(rr->dnssref); + if (sockfd == -1) { + err = kDNSServiceErr_Invalid; + } else { + rr->bonjourSocket = new QSocketNotifier(sockfd, QSocketNotifier::Read, this); + connect(rr->bonjourSocket, SIGNAL(activated(int)), this, SLOT(bonjourSocketReadyRead(int))); + qmResolvers.insert(sockfd, rr); + return; + } + } + + emit error(record, err); + delete rr; +} + +void BonjourServiceResolver::bonjourSocketReadyRead(int sockfd) { + ResolveRecord *rr = qmResolvers.value(sockfd); + + if (! rr) + return; + + DNSServiceErrorType err = DNSServiceProcessResult(rr->dnssref); + if (err != kDNSServiceErr_NoError) + emit error(rr->record, err); + +} + + +void BonjourServiceResolver::bonjourResolveReply(DNSServiceRef, DNSServiceFlags , + quint32 , DNSServiceErrorType errorCode, + const char *, const char *hosttarget, quint16 port, + quint16 , const unsigned char *, void *context) { + ResolveRecord *rr = static_cast<ResolveRecord *>(context); + rr->bsr->qmResolvers.remove(DNSServiceRefSockFD(rr->dnssref)); + + if (errorCode != kDNSServiceErr_NoError) { + emit rr->bsr->error(rr->record, errorCode); + return; + } + rr->bonjourPort = qFromBigEndian<quint16>(port); + emit rr->bsr->bonjourRecordResolved(rr->record, QString::fromUtf8(hosttarget), rr->bonjourPort); + delete rr; +} diff --git a/3rdparty/qqbonjour-src/BonjourServiceResolver.h b/3rdparty/qqbonjour-src/BonjourServiceResolver.h new file mode 100644 index 000000000..d2a669ea1 --- /dev/null +++ b/3rdparty/qqbonjour-src/BonjourServiceResolver.h @@ -0,0 +1,74 @@ +/* +Copyright (c) 2007, Trenton Schulz +Copyright (c) 2009-2011, Stefan Hacker +Copyright (C) 2009-2011, Thorvald Natvig <thorvald@natvig.com> + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef MUMBLE_BONJOURSERVICERESOLVER_H_ +#define MUMBLE_BONJOURSERVICERESOLVER_H_ + +#include <QtCore/QMap> +#include <QtCore/QObject> + +#include <dns_sd.h> + +#include "BonjourRecord.h" + +class QSocketNotifier; + +class BonjourServiceResolver : public QObject { + Q_OBJECT + protected: + struct ResolveRecord { + BonjourRecord record; + BonjourServiceResolver *bsr; + DNSServiceRef dnssref; + QSocketNotifier *bonjourSocket; + int bonjourPort; + ResolveRecord(const BonjourRecord &, BonjourServiceResolver *); + ~ResolveRecord(); + }; + + QMap<int, ResolveRecord *> qmResolvers; + public: + BonjourServiceResolver(QObject *parent); + ~BonjourServiceResolver(); + + void resolveBonjourRecord(const BonjourRecord &record); + signals: + void bonjourRecordResolved(BonjourRecord record, QString hostname, int port); + void error(BonjourRecord record, DNSServiceErrorType error); + private slots: + void bonjourSocketReadyRead(int); + private: + static void DNSSD_API bonjourResolveReply(DNSServiceRef sdRef, DNSServiceFlags flags, + quint32 interfaceIndex, DNSServiceErrorType errorCode, + const char *fullName, const char *hosttarget, quint16 port, + quint16 txtLen, const unsigned char *txtRecord, void *context); +}; + +#endif diff --git a/3rdparty/qqbonjour-src/LICENSE b/3rdparty/qqbonjour-src/LICENSE new file mode 100644 index 000000000..0d974d830 --- /dev/null +++ b/3rdparty/qqbonjour-src/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2007, Trenton Schulz + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdparty/qqbonjour-src/README b/3rdparty/qqbonjour-src/README new file mode 100644 index 000000000..c13703607 --- /dev/null +++ b/3rdparty/qqbonjour-src/README @@ -0,0 +1,13 @@ +The files in this directory are originally from an article +in Qt Quarterly 23: + +https://doc.qt.io/archives/qq/qq23-bonjour.html + +The files in this directory are used directly in the +Mumble and Murmur build. Because of this, there is no +"qqbonjour-build" directory. + +These files are modified and are now de facto maintained by +the Mumble project. + +For information about the license, see the LICENSE file. |