diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-17 07:03:16 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-17 07:41:26 (GMT) |
commit | 436ae921afbc5c2b461ee9b2d8fa9b1c869ed274 (patch) | |
tree | 9d209712286cc49d4c1f08be5ab8f5b90ef4971c /Swiften/LinkLocal/AppleDNSSDService.cpp | |
parent | 2c954f7e9464b8fdd970eed829e2ba632e8979d8 (diff) | |
download | swift-contrib-436ae921afbc5c2b461ee9b2d8fa9b1c869ed274.zip swift-contrib-436ae921afbc5c2b461ee9b2d8fa9b1c869ed274.tar.bz2 |
Implement LinkLocalServiceInfo TXT record.
Diffstat (limited to 'Swiften/LinkLocal/AppleDNSSDService.cpp')
-rw-r--r-- | Swiften/LinkLocal/AppleDNSSDService.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Swiften/LinkLocal/AppleDNSSDService.cpp b/Swiften/LinkLocal/AppleDNSSDService.cpp index 3b71f74..4dd74eb 100644 --- a/Swiften/LinkLocal/AppleDNSSDService.cpp +++ b/Swiften/LinkLocal/AppleDNSSDService.cpp @@ -6,6 +6,7 @@ #include <sys/socket.h> #include "Swiften/EventLoop/MainEventLoop.h" +#include "Swiften/LinkLocal/LinkLocalServiceInfo.h" namespace Swift { @@ -44,12 +45,12 @@ void AppleDNSSDService::start() { thread = new boost::thread(boost::bind(&AppleDNSSDService::doStart, shared_from_this())); } -void AppleDNSSDService::registerService(const String& name, int port, const std::map<String,String>&) { - // TODO: Use properties +void AppleDNSSDService::registerService(const String& name, int port, const LinkLocalServiceInfo& info) { boost::lock_guard<boost::mutex> lock(sdRefsMutex); assert(!registerSDRef); - DNSServiceErrorType result = DNSServiceRegister(®isterSDRef, 0, 0, name.getUTF8Data(), "_presence._tcp", NULL, NULL, port, 0, NULL, &AppleDNSSDService::handleServiceRegisteredGlobal, this); + ByteArray txtRecord = info.toTXTRecord(); + DNSServiceErrorType result = DNSServiceRegister(®isterSDRef, 0, 0, name.getUTF8Data(), "_presence._tcp", NULL, NULL, port, txtRecord.getSize(), txtRecord.getData(), &AppleDNSSDService::handleServiceRegisteredGlobal, this); interruptSelect(); if (result != kDNSServiceErr_NoError) { onError(); |