summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-25 09:37:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-25 09:37:42 (GMT)
commit0f77a684b42f25052eb1cfa688721e321526a90d (patch)
tree226c07deff7a663f8aefdfc8814e9ecd04085999 /Swiften/LinkLocal/BonjourResolveServiceQuery.h
parentb33a2937fe4a3cae0017892ad7f5c27b8a6f976d (diff)
downloadswift-0f77a684b42f25052eb1cfa688721e321526a90d.zip
swift-0f77a684b42f25052eb1cfa688721e321526a90d.tar.bz2
Created DNSSD submodule for LinkLocal.
Diffstat (limited to 'Swiften/LinkLocal/BonjourResolveServiceQuery.h')
-rw-r--r--Swiften/LinkLocal/BonjourResolveServiceQuery.h53
1 files changed, 0 insertions, 53 deletions
diff --git a/Swiften/LinkLocal/BonjourResolveServiceQuery.h b/Swiften/LinkLocal/BonjourResolveServiceQuery.h
deleted file mode 100644
index e4f02ee..0000000
--- a/Swiften/LinkLocal/BonjourResolveServiceQuery.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma once
-
-#include "Swiften/LinkLocal/BonjourQuery.h"
-#include "Swiften/LinkLocal/DNSSDResolveServiceQuery.h"
-#include "Swiften/LinkLocal/LinkLocalServiceInfo.h"
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/EventLoop/MainEventLoop.h"
-
-namespace Swift {
- class BonjourQuerier;
-
- class BonjourResolveServiceQuery : public DNSSDResolveServiceQuery, public BonjourQuery {
- public:
- BonjourResolveServiceQuery(const LinkLocalServiceID& service, boost::shared_ptr<BonjourQuerier> querier) : BonjourQuery(querier) {
- DNSServiceErrorType result = DNSServiceResolve(
- &sdRef, 0, service.getNetworkInterfaceID(),
- service.getName().getUTF8Data(), service.getType().getUTF8Data(),
- service.getDomain().getUTF8Data(),
- &BonjourResolveServiceQuery::handleServiceResolvedStatic, this);
- if (result != kDNSServiceErr_NoError) {
- MainEventLoop::postEvent(boost::bind(boost::ref(onServiceResolved), boost::optional<Result>()), shared_from_this());
- }
- }
-
- void start() {
- run();
- }
-
- void stop() {
- finish();
- }
-
- private:
- static void handleServiceResolvedStatic(DNSServiceRef, DNSServiceFlags, uint32_t, DNSServiceErrorType errorCode, const char *fullname, const char *hosttarget, uint16_t port, uint16_t txtLen, const unsigned char *txtRecord, void *context) {
- static_cast<BonjourResolveServiceQuery*>(context)->handleServiceResolved(errorCode, fullname, hosttarget, port, txtLen, txtRecord);
- }
-
- void handleServiceResolved(DNSServiceErrorType errorCode, const char* fullName, const char* host, uint16_t port, uint16_t txtLen, const unsigned char *txtRecord) {
- if (errorCode != kDNSServiceErr_NoError) {
- MainEventLoop::postEvent(boost::bind(boost::ref(onServiceResolved), boost::optional<Result>()), shared_from_this());
- }
- else {
- MainEventLoop::postEvent(
- boost::bind(
- boost::ref(onServiceResolved),
- Result(String(fullName), String(host), port,
- LinkLocalServiceInfo::createFromTXTRecord(
- ByteArray(reinterpret_cast<const char*>(txtRecord), txtLen)))),
- shared_from_this());
- }
- }
- };
-}