summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-25 17:32:55 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-25 17:32:55 (GMT)
commit9f51e6c6279ae7fb541774ac4bf9debfa61395c1 (patch)
treed47cc48f4c162b09bf23b8ebf069a7855609b2b8 /Swiften/LinkLocal
parentd2807a77d39bd1a359f5b85869113ed83e01c204 (diff)
downloadswift-9f51e6c6279ae7fb541774ac4bf9debfa61395c1.zip
swift-9f51e6c6279ae7fb541774ac4bf9debfa61395c1.tar.bz2
Move LinkLocalServiceID->DNSSDServiceID.
Diffstat (limited to 'Swiften/LinkLocal')
-rw-r--r--Swiften/LinkLocal/AppleDNSSDService.cpp8
-rw-r--r--Swiften/LinkLocal/AppleDNSSDService.h8
-rw-r--r--Swiften/LinkLocal/AvahiDNSSDService.cpp10
-rw-r--r--Swiften/LinkLocal/AvahiDNSSDService.h6
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h2
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp2
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h2
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h4
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h2
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.h6
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDQuerier.h4
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h4
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h2
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDServiceID.cpp7
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDServiceID.h (renamed from Swiften/LinkLocal/LinkLocalServiceID.h)8
-rw-r--r--Swiften/LinkLocal/DNSSD/Makefile.inc1
-rw-r--r--Swiften/LinkLocal/DNSSDService.h14
-rw-r--r--Swiften/LinkLocal/LinkLocalRoster.cpp16
-rw-r--r--Swiften/LinkLocal/LinkLocalRoster.h20
-rw-r--r--Swiften/LinkLocal/LinkLocalService.h8
-rw-r--r--Swiften/LinkLocal/LinkLocalServiceBrowser.cpp18
-rw-r--r--Swiften/LinkLocal/LinkLocalServiceBrowser.h24
-rw-r--r--Swiften/LinkLocal/LinkLocalServiceID.cpp7
-rw-r--r--Swiften/LinkLocal/Makefile.inc3
-rw-r--r--Swiften/LinkLocal/UnitTest/Makefile.inc1
25 files changed, 93 insertions, 94 deletions
diff --git a/Swiften/LinkLocal/AppleDNSSDService.cpp b/Swiften/LinkLocal/AppleDNSSDService.cpp
index bf66e50..a052eb1 100644
--- a/Swiften/LinkLocal/AppleDNSSDService.cpp
+++ b/Swiften/LinkLocal/AppleDNSSDService.cpp
@@ -70,7 +70,7 @@ void AppleDNSSDService::unregisterService() {
registerSDRef = NULL;
}
-void AppleDNSSDService::startResolvingService(const LinkLocalServiceID& service) {
+void AppleDNSSDService::startResolvingService(const DNSSDServiceID& service) {
boost::lock_guard<boost::mutex> lock(sdRefsMutex);
DNSServiceRef resolveSDRef;
@@ -87,7 +87,7 @@ void AppleDNSSDService::startResolvingService(const LinkLocalServiceID& service)
interruptSelect();
}
-void AppleDNSSDService::stopResolvingService(const LinkLocalServiceID& service) {
+void AppleDNSSDService::stopResolvingService(const DNSSDServiceID& service) {
boost::lock_guard<boost::mutex> lock(sdRefsMutex);
ServiceSDRefMap::iterator i = resolveSDRefs.find(service);
@@ -238,7 +238,7 @@ void AppleDNSSDService::handleServiceDiscovered(DNSServiceRef, DNSServiceFlags f
return;
}
else {
- LinkLocalServiceID service(serviceName, regtype, replyDomain, interfaceIndex);
+ DNSSDServiceID service(serviceName, regtype, replyDomain, interfaceIndex);
if (flags & kDNSServiceFlagsAdd) {
MainEventLoop::postEvent(boost::bind(boost::ref(onServiceAdded), service), shared_from_this());
}
@@ -258,7 +258,7 @@ void AppleDNSSDService::handleServiceRegistered(DNSServiceRef, DNSServiceFlags,
haveError = true;
}
else {
- MainEventLoop::postEvent(boost::bind(boost::ref(onServiceRegistered), LinkLocalServiceID(name, regtype, domain, 0)), shared_from_this());
+ MainEventLoop::postEvent(boost::bind(boost::ref(onServiceRegistered), DNSSDServiceID(name, regtype, domain, 0)), shared_from_this());
}
}
diff --git a/Swiften/LinkLocal/AppleDNSSDService.h b/Swiften/LinkLocal/AppleDNSSDService.h
index 7fdfd3e..554a154 100644
--- a/Swiften/LinkLocal/AppleDNSSDService.h
+++ b/Swiften/LinkLocal/AppleDNSSDService.h
@@ -6,7 +6,7 @@
#include <dns_sd.h>
#include "Swiften/LinkLocal/DNSSDService.h"
-#include "Swiften/LinkLocal/LinkLocalServiceID.h"
+#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
#include "Swiften/EventLoop/EventOwner.h"
namespace Swift {
@@ -22,8 +22,8 @@ namespace Swift {
virtual void updateService(const LinkLocalServiceInfo&);
virtual void unregisterService();
- virtual void startResolvingService(const LinkLocalServiceID&);
- virtual void stopResolvingService(const LinkLocalServiceID&);
+ virtual void startResolvingService(const DNSSDServiceID&);
+ virtual void stopResolvingService(const DNSSDServiceID&);
virtual void resolveHostname(const String& hostname, int interfaceIndex = 0);
@@ -49,7 +49,7 @@ namespace Swift {
boost::mutex sdRefsMutex;
DNSServiceRef browseSDRef;
DNSServiceRef registerSDRef;
- typedef std::map<LinkLocalServiceID, DNSServiceRef> ServiceSDRefMap;
+ typedef std::map<DNSSDServiceID, DNSServiceRef> ServiceSDRefMap;
ServiceSDRefMap resolveSDRefs;
typedef std::vector<DNSServiceRef> HostnameSDRefs;
HostnameSDRefs hostnameResolveSDRefs;
diff --git a/Swiften/LinkLocal/AvahiDNSSDService.cpp b/Swiften/LinkLocal/AvahiDNSSDService.cpp
index fe9ac83..5f6295f 100644
--- a/Swiften/LinkLocal/AvahiDNSSDService.cpp
+++ b/Swiften/LinkLocal/AvahiDNSSDService.cpp
@@ -62,7 +62,7 @@ void AvahiDNSSDService::unregisterService() {
avahi_threaded_poll_unlock(threadedPoll);
}
-void AvahiDNSSDService::startResolvingService(const LinkLocalServiceID& service) {
+void AvahiDNSSDService::startResolvingService(const DNSSDServiceID& service) {
avahi_threaded_poll_lock(threadedPoll);
AvahiServiceResolver* resolver = avahi_service_resolver_new(
@@ -82,7 +82,7 @@ void AvahiDNSSDService::startResolvingService(const LinkLocalServiceID& service)
avahi_threaded_poll_unlock(threadedPoll);
}
-void AvahiDNSSDService::stopResolvingService(const LinkLocalServiceID& service) {
+void AvahiDNSSDService::stopResolvingService(const DNSSDServiceID& service) {
avahi_threaded_poll_lock(threadedPoll);
ServiceResolverMap::iterator i = serviceResolvers.find(service);
@@ -112,13 +112,13 @@ void AvahiDNSSDService::handleServiceDiscovered(AvahiServiceBrowser *, AvahiIfIn
return;
case AVAHI_BROWSER_NEW: {
std::cerr << "Service added: " << name << " " << type << " " << domain << std::endl;
- LinkLocalServiceID service(name, type, domain, interfaceIndex);
+ DNSSDServiceID service(name, type, domain, interfaceIndex);
MainEventLoop::postEvent(boost::bind(boost::ref(onServiceAdded), service), shared_from_this());
}
break;
case AVAHI_BROWSER_REMOVE: {
std::cerr << "Service removed: " << name << " " << type << " " << domain << std::endl;
- LinkLocalServiceID service(name, type, domain, interfaceIndex);
+ DNSSDServiceID service(name, type, domain, interfaceIndex);
MainEventLoop::postEvent(boost::bind(boost::ref(onServiceRemoved), service), shared_from_this());
}
break;
@@ -146,7 +146,7 @@ void AvahiDNSSDService::handleServiceResolved(AvahiServiceResolver *, AvahiIfInd
HostAddress hostAddress(reinterpret_cast<const unsigned char*>(&address->data.ipv4.address), 4);
hostnameAddresses[String(hostname)] = hostAddress;
MainEventLoop::postEvent(boost::bind(boost::ref(onServiceResolved),
- LinkLocalServiceID(name, type, domain, interfaceIndex),
+ DNSSDServiceID(name, type, domain, interfaceIndex),
ResolveResult(hostname, port,
LinkLocalServiceInfo::createFromTXTRecord(data))),
shared_from_this());
diff --git a/Swiften/LinkLocal/AvahiDNSSDService.h b/Swiften/LinkLocal/AvahiDNSSDService.h
index 99a1d23..7162ade 100644
--- a/Swiften/LinkLocal/AvahiDNSSDService.h
+++ b/Swiften/LinkLocal/AvahiDNSSDService.h
@@ -26,8 +26,8 @@ namespace Swift {
virtual void updateService(const LinkLocalServiceInfo&);
virtual void unregisterService();
- virtual void startResolvingService(const LinkLocalServiceID&);
- virtual void stopResolvingService(const LinkLocalServiceID&);
+ virtual void startResolvingService(const DNSSDServiceID&);
+ virtual void stopResolvingService(const DNSSDServiceID&);
virtual void resolveHostname(const String& hostname, int interfaceIndex = 0);
@@ -47,7 +47,7 @@ namespace Swift {
AvahiClient* client;
AvahiThreadedPoll* threadedPoll;
AvahiServiceBrowser* serviceBrowser;
- typedef std::map<LinkLocalServiceID, AvahiServiceResolver*> ServiceResolverMap;
+ typedef std::map<DNSSDServiceID, AvahiServiceResolver*> ServiceResolverMap;
ServiceResolverMap serviceResolvers;
typedef std::map<String, HostAddress> HostnameAddressMap;
HostnameAddressMap hostnameAddresses;
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h
index edff064..62d8606 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h
@@ -38,7 +38,7 @@ namespace Swift {
return;
}
else {
- LinkLocalServiceID service(name, type, domain, interfaceIndex);
+ DNSSDServiceID service(name, type, domain, interfaceIndex);
if (flags & kDNSServiceFlagsAdd) {
MainEventLoop::postEvent(boost::bind(boost::ref(onServiceAdded), service), shared_from_this());
}
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
index 064e3c5..c065d4d 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
@@ -33,7 +33,7 @@ boost::shared_ptr<DNSSDRegisterQuery> BonjourQuerier::createRegisterQuery(const
return boost::shared_ptr<DNSSDRegisterQuery>(new BonjourRegisterQuery(name, port, info, shared_from_this()));
}
-boost::shared_ptr<DNSSDResolveServiceQuery> BonjourQuerier::createResolveServiceQuery(const LinkLocalServiceID& service) {
+boost::shared_ptr<DNSSDResolveServiceQuery> BonjourQuerier::createResolveServiceQuery(const DNSSDServiceID& service) {
return boost::shared_ptr<DNSSDResolveServiceQuery>(new BonjourResolveServiceQuery(service, shared_from_this()));
}
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h
index 79f9a81..644a8d9 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h
@@ -23,7 +23,7 @@ namespace Swift {
boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery(
const String& name, int port, const LinkLocalServiceInfo& info);
boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery(
- const LinkLocalServiceID&);
+ const DNSSDServiceID&);
boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery(
const String& hostname, int interfaceIndex);
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
index 31e86fc..9c4db13 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
@@ -40,10 +40,10 @@ namespace Swift {
void handleServiceRegistered(DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain) {
if (errorCode != kDNSServiceErr_NoError) {
- MainEventLoop::postEvent(boost::bind(boost::ref(onRegisterFinished), boost::optional<LinkLocalServiceID>()), shared_from_this());
+ MainEventLoop::postEvent(boost::bind(boost::ref(onRegisterFinished), boost::optional<DNSSDServiceID>()), shared_from_this());
}
else {
- MainEventLoop::postEvent(boost::bind(boost::ref(onRegisterFinished), boost::optional<LinkLocalServiceID>(LinkLocalServiceID(name, regtype, domain, 0))), shared_from_this());
+ MainEventLoop::postEvent(boost::bind(boost::ref(onRegisterFinished), boost::optional<DNSSDServiceID>(DNSSDServiceID(name, regtype, domain, 0))), shared_from_this());
}
}
};
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
index 1afdf5a..1ebd487 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h
@@ -11,7 +11,7 @@ namespace Swift {
class BonjourResolveServiceQuery : public DNSSDResolveServiceQuery, public BonjourQuery {
public:
- BonjourResolveServiceQuery(const LinkLocalServiceID& service, boost::shared_ptr<BonjourQuerier> querier) : BonjourQuery(querier) {
+ BonjourResolveServiceQuery(const DNSSDServiceID& service, boost::shared_ptr<BonjourQuerier> querier) : BonjourQuery(querier) {
DNSServiceErrorType result = DNSServiceResolve(
&sdRef, 0, service.getNetworkInterfaceID(),
service.getName().getUTF8Data(), service.getType().getUTF8Data(),
diff --git a/Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.h b/Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.h
index e548ca5..86967ed 100644
--- a/Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.h
+++ b/Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.h
@@ -2,7 +2,7 @@
#include <boost/signal.hpp>
-#include "Swiften/LinkLocal/LinkLocalServiceID.h"
+#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
namespace Swift {
class DNSSDBrowseQuery {
@@ -12,7 +12,7 @@ namespace Swift {
virtual void startBrowsing() = 0;
virtual void stopBrowsing() = 0;
- boost::signal<void (const LinkLocalServiceID&)> onServiceAdded;
- boost::signal<void (const LinkLocalServiceID&)> onServiceRemoved;
+ boost::signal<void (const DNSSDServiceID&)> onServiceAdded;
+ boost::signal<void (const DNSSDServiceID&)> onServiceRemoved;
};
}
diff --git a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h
index 528a6ea..6c7b576 100644
--- a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h
+++ b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h
@@ -5,7 +5,7 @@
namespace Swift {
class String;
class LinkLocalServiceInfo;
- class LinkLocalServiceID;
+ class DNSSDServiceID;
class DNSSDBrowseQuery;
class DNSSDRegisterQuery;
class DNSSDResolveServiceQuery;
@@ -19,7 +19,7 @@ namespace Swift {
virtual boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery(
const String& name, int port, const LinkLocalServiceInfo& info) = 0;
virtual boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery(
- const LinkLocalServiceID&) = 0;
+ const DNSSDServiceID&) = 0;
virtual boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery(
const String& hostname, int interfaceIndex) = 0;
};
diff --git a/Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h b/Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h
index 252fbf0..a643880 100644
--- a/Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h
@@ -3,7 +3,7 @@
#include <boost/signal.hpp>
#include <boost/optional.hpp>
-#include "Swiften/LinkLocal/LinkLocalServiceID.h"
+#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
namespace Swift {
class LinkLocalServiceInfo;
@@ -15,6 +15,6 @@ namespace Swift {
virtual void registerService() = 0;
virtual void updateServiceInfo(const LinkLocalServiceInfo& info) = 0;
- boost::signal<void (boost::optional<LinkLocalServiceID>)> onRegisterFinished;
+ boost::signal<void (boost::optional<DNSSDServiceID>)> onRegisterFinished;
};
}
diff --git a/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h
index d8b5cf1..f79b537 100644
--- a/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h
+++ b/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h
@@ -3,7 +3,7 @@
#include <boost/signal.hpp>
#include <boost/optional.hpp>
-#include "Swiften/LinkLocal/LinkLocalServiceID.h"
+#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
#include "Swiften/LinkLocal/LinkLocalServiceInfo.h"
namespace Swift {
diff --git a/Swiften/LinkLocal/DNSSD/DNSSDServiceID.cpp b/Swiften/LinkLocal/DNSSD/DNSSDServiceID.cpp
new file mode 100644
index 0000000..06a5b81
--- /dev/null
+++ b/Swiften/LinkLocal/DNSSD/DNSSDServiceID.cpp
@@ -0,0 +1,7 @@
+#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
+
+namespace Swift {
+
+const String DNSSDServiceID::PresenceServiceType = String("_presence._tcp");
+
+}
diff --git a/Swiften/LinkLocal/LinkLocalServiceID.h b/Swiften/LinkLocal/DNSSD/DNSSDServiceID.h
index ca5ba17..b1986d3 100644
--- a/Swiften/LinkLocal/LinkLocalServiceID.h
+++ b/Swiften/LinkLocal/DNSSD/DNSSDServiceID.h
@@ -3,11 +3,11 @@
#include "Swiften/Base/String.h"
namespace Swift {
- class LinkLocalServiceID {
+ class DNSSDServiceID {
public:
static const String PresenceServiceType;
- LinkLocalServiceID(
+ DNSSDServiceID(
const String& name,
const String& type,
const String& domain = PresenceServiceType,
@@ -18,11 +18,11 @@ namespace Swift {
networkInterface(networkInterface) {
}
- bool operator==(const LinkLocalServiceID& o) const {
+ bool operator==(const DNSSDServiceID& o) const {
return name == o.name && type == o.type && domain == o.domain && (networkInterface != 0 && o.networkInterface != 0 ? networkInterface == o.networkInterface : true);
}
- bool operator<(const LinkLocalServiceID& o) const {
+ bool operator<(const DNSSDServiceID& o) const {
if (o.name == name) {
if (o.type == type) {
if (o.domain == domain) {
diff --git a/Swiften/LinkLocal/DNSSD/Makefile.inc b/Swiften/LinkLocal/DNSSD/Makefile.inc
index 81beee0..8612fee 100644
--- a/Swiften/LinkLocal/DNSSD/Makefile.inc
+++ b/Swiften/LinkLocal/DNSSD/Makefile.inc
@@ -1,4 +1,5 @@
SWIFTEN_SOURCES += \
+ Swiften/LinkLocal/DNSSD/DNSSDServiceID.cpp \
Swiften/LinkLocal/DNSSD/DNSSDQuerier.cpp \
Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.cpp \
Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.cpp \
diff --git a/Swiften/LinkLocal/DNSSDService.h b/Swiften/LinkLocal/DNSSDService.h
index 4cf1a6e..0ace21b 100644
--- a/Swiften/LinkLocal/DNSSDService.h
+++ b/Swiften/LinkLocal/DNSSDService.h
@@ -4,7 +4,7 @@
#include <map>
#include "Swiften/Base/String.h"
-#include "Swiften/LinkLocal/LinkLocalServiceID.h"
+#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
#include "Swiften/LinkLocal/LinkLocalServiceInfo.h"
namespace Swift {
@@ -29,17 +29,17 @@ namespace Swift {
virtual void updateService(const LinkLocalServiceInfo&) = 0;
virtual void unregisterService() = 0;
- virtual void startResolvingService(const LinkLocalServiceID&) = 0;
- virtual void stopResolvingService(const LinkLocalServiceID&) = 0;
+ virtual void startResolvingService(const DNSSDServiceID&) = 0;
+ virtual void stopResolvingService(const DNSSDServiceID&) = 0;
virtual void resolveHostname(const String& hostname, int interfaceIndex = 0) = 0;
boost::signal<void ()> onStarted;
boost::signal<void (bool)> onStopped;
- boost::signal<void (const LinkLocalServiceID&)> onServiceAdded;
- boost::signal<void (const LinkLocalServiceID&)> onServiceRemoved;
- boost::signal<void (const LinkLocalServiceID&)> onServiceRegistered;
- boost::signal<void (const LinkLocalServiceID&, const ResolveResult&)> onServiceResolved;
+ boost::signal<void (const DNSSDServiceID&)> onServiceAdded;
+ boost::signal<void (const DNSSDServiceID&)> onServiceRemoved;
+ boost::signal<void (const DNSSDServiceID&)> onServiceRegistered;
+ boost::signal<void (const DNSSDServiceID&, const ResolveResult&)> onServiceResolved;
boost::signal<void (const String&, const boost::optional<HostAddress>&)> onHostnameResolved;
};
}
diff --git a/Swiften/LinkLocal/LinkLocalRoster.cpp b/Swiften/LinkLocal/LinkLocalRoster.cpp
index 5a6ccfd..af3c1af 100644
--- a/Swiften/LinkLocal/LinkLocalRoster.cpp
+++ b/Swiften/LinkLocal/LinkLocalRoster.cpp
@@ -30,11 +30,11 @@ std::vector<boost::shared_ptr<Presence> > LinkLocalRoster::getAllPresence() cons
return result;
}
-RosterItemPayload LinkLocalRoster::getRosterItem(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& resolveResult) const {
+RosterItemPayload LinkLocalRoster::getRosterItem(const DNSSDServiceID& service, const DNSSDService::ResolveResult& resolveResult) const {
return RosterItemPayload(getJIDForService(service), getRosterName(service, resolveResult), RosterItemPayload::Both);
}
-String LinkLocalRoster::getRosterName(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& resolveResult) const {
+String LinkLocalRoster::getRosterName(const DNSSDServiceID& service, const DNSSDService::ResolveResult& resolveResult) const {
if (!resolveResult.info.getNick().isEmpty()) {
return resolveResult.info.getNick();
}
@@ -51,11 +51,11 @@ String LinkLocalRoster::getRosterName(const LinkLocalServiceID& service, const D
return service.getName();
}
-JID LinkLocalRoster::getJIDForService(const LinkLocalServiceID& service) const {
+JID LinkLocalRoster::getJIDForService(const DNSSDServiceID& service) const {
return JID(service.getName());
}
-boost::shared_ptr<Presence> LinkLocalRoster::getPresence(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& resolveResult) const {
+boost::shared_ptr<Presence> LinkLocalRoster::getPresence(const DNSSDServiceID& service, const DNSSDService::ResolveResult& resolveResult) const {
boost::shared_ptr<Presence> presence(new Presence());
presence->setFrom(getJIDForService(service));
switch (resolveResult.info.getStatus()) {
@@ -73,14 +73,14 @@ boost::shared_ptr<Presence> LinkLocalRoster::getPresence(const LinkLocalServiceI
return presence;
}
-void LinkLocalRoster::handleServiceAdded(const LinkLocalServiceID& service) {
+void LinkLocalRoster::handleServiceAdded(const DNSSDServiceID& service) {
if (selfService && *selfService == service) {
return;
}
dnsSDService->startResolvingService(service);
}
-void LinkLocalRoster::handleServiceRemoved(const LinkLocalServiceID& service) {
+void LinkLocalRoster::handleServiceRemoved(const DNSSDServiceID& service) {
if (selfService && *selfService == service) {
return;
}
@@ -91,7 +91,7 @@ void LinkLocalRoster::handleServiceRemoved(const LinkLocalServiceID& service) {
onRosterChanged(roster);
}
-void LinkLocalRoster::handleServiceResolved(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& result) {
+void LinkLocalRoster::handleServiceResolved(const DNSSDServiceID& service, const DNSSDService::ResolveResult& result) {
std::pair<ServiceMap::iterator, bool> r = services.insert(std::make_pair(service, result));
if (r.second) {
boost::shared_ptr<RosterPayload> roster(new RosterPayload());
@@ -104,7 +104,7 @@ void LinkLocalRoster::handleServiceResolved(const LinkLocalServiceID& service, c
onPresenceChanged(getPresence(service, result));
}
-void LinkLocalRoster::handleServiceRegistered(const LinkLocalServiceID& service) {
+void LinkLocalRoster::handleServiceRegistered(const DNSSDServiceID& service) {
selfService = service;
}
diff --git a/Swiften/LinkLocal/LinkLocalRoster.h b/Swiften/LinkLocal/LinkLocalRoster.h
index 128e39d..03ed2d5 100644
--- a/Swiften/LinkLocal/LinkLocalRoster.h
+++ b/Swiften/LinkLocal/LinkLocalRoster.h
@@ -28,21 +28,21 @@ namespace Swift {
int getPort(const JID&) const;
private:
- RosterItemPayload getRosterItem(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& info) const;
- String getRosterName(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& info) const;
- JID getJIDForService(const LinkLocalServiceID& service) const;
- boost::shared_ptr<Presence> getPresence(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& info) const;
+ RosterItemPayload getRosterItem(const DNSSDServiceID& service, const DNSSDService::ResolveResult& info) const;
+ String getRosterName(const DNSSDServiceID& service, const DNSSDService::ResolveResult& info) const;
+ JID getJIDForService(const DNSSDServiceID& service) const;
+ boost::shared_ptr<Presence> getPresence(const DNSSDServiceID& service, const DNSSDService::ResolveResult& info) const;
void handleStopped(bool);
- void handleServiceRegistered(const LinkLocalServiceID& service);
- void handleServiceAdded(const LinkLocalServiceID&);
- void handleServiceRemoved(const LinkLocalServiceID&);
- void handleServiceResolved(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& result);
+ void handleServiceRegistered(const DNSSDServiceID& service);
+ void handleServiceAdded(const DNSSDServiceID&);
+ void handleServiceRemoved(const DNSSDServiceID&);
+ void handleServiceResolved(const DNSSDServiceID& service, const DNSSDService::ResolveResult& result);
private:
boost::shared_ptr<DNSSDService> dnsSDService;
- boost::optional<LinkLocalServiceID> selfService;
- typedef std::map<LinkLocalServiceID, DNSSDService::ResolveResult> ServiceMap;
+ boost::optional<DNSSDServiceID> selfService;
+ typedef std::map<DNSSDServiceID, DNSSDService::ResolveResult> ServiceMap;
ServiceMap services;
};
}
diff --git a/Swiften/LinkLocal/LinkLocalService.h b/Swiften/LinkLocal/LinkLocalService.h
index 6616303..2c62307 100644
--- a/Swiften/LinkLocal/LinkLocalService.h
+++ b/Swiften/LinkLocal/LinkLocalService.h
@@ -2,19 +2,19 @@
#include "Swiften/Base/String.h"
#include "Swiften/Network/HostAddress.h"
-#include "Swiften/LinkLocal/LinkLocalServiceID.h"
+#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
#include "Swiften/LinkLocal/LinkLocalServiceInfo.h"
namespace Swift {
class LinkLocalService {
public:
LinkLocalService(
- const LinkLocalServiceID& id,
+ const DNSSDServiceID& id,
const DNSSDService::ResolveResult& info) :
id(id),
info(info) {}
- const LinkLocalServiceID& getID() const {
+ const DNSSDServiceID& getID() const {
return id;
}
@@ -35,7 +35,7 @@ namespace Swift {
}
private:
- LinkLocalServiceID id;
+ DNSSDServiceID id;
DNSSDService::ResolveResult info;
};
}
diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp
index 904f8f0..ab56695 100644
--- a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp
+++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp
@@ -6,35 +6,35 @@
namespace Swift {
-LinkLocalServiceBrowser::LinkLocalServiceBrowser(DNSSDServiceFactory* factory) {
- dnsSDService = factory->createDNSSDService();
+LinkLocalServiceBrowser::LinkLocalServiceBrowser(boost::shared_ptr<DNSSDQuerier> querier) : querier(querier) {
+ /*dnsSDService = factory->createDNSSDService();
dnsSDService->onServiceAdded.connect(
boost::bind(&LinkLocalServiceBrowser::handleServiceAdded, this, _1));
dnsSDService->onServiceRemoved.connect(
boost::bind(&LinkLocalServiceBrowser::handleServiceRemoved, this, _1));
dnsSDService->onServiceResolved.connect(
- boost::bind(&LinkLocalServiceBrowser::handleServiceResolved, this, _1, _2));
+ boost::bind(&LinkLocalServiceBrowser::handleServiceResolved, this, _1, _2));*/
}
std::vector<LinkLocalService> LinkLocalServiceBrowser::getServices() const {
std::vector<LinkLocalService> result;
- for (ServiceMap::const_iterator i = services.begin(); i != services.end(); ++i) {
+ /*for (ServiceMap::const_iterator i = services.begin(); i != services.end(); ++i) {
result.push_back(LinkLocalService(i->first, i->second));
- }
+ }*/
return result;
}
-void LinkLocalServiceBrowser::handleServiceAdded(const LinkLocalServiceID& service) {
+/*void LinkLocalServiceBrowser::handleServiceAdded(const DNSSDServiceID& service) {
dnsSDService->startResolvingService(service);
}
-void LinkLocalServiceBrowser::handleServiceRemoved(const LinkLocalServiceID& service) {
+void LinkLocalServiceBrowser::handleServiceRemoved(const DNSSDServiceID& service) {
dnsSDService->stopResolvingService(service);
services.erase(service);
onServiceRemoved(service);
}
-void LinkLocalServiceBrowser::handleServiceResolved(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& result) {
+void LinkLocalServiceBrowser::handleServiceResolved(const DNSSDServiceID& service, const DNSSDService::ResolveResult& result) {
std::pair<ServiceMap::iterator, bool> r = services.insert(std::make_pair(service, result));
if (r.second) {
onServiceAdded(service);
@@ -44,6 +44,6 @@ void LinkLocalServiceBrowser::handleServiceResolved(const LinkLocalServiceID& se
onServiceChanged(service);
}
}
-
+*/
}
diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.h b/Swiften/LinkLocal/LinkLocalServiceBrowser.h
index 879b286..10b12b7 100644
--- a/Swiften/LinkLocal/LinkLocalServiceBrowser.h
+++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.h
@@ -6,31 +6,31 @@
#include <vector>
#include "Swiften/Base/String.h"
-#include "Swiften/LinkLocal/DNSSDService.h"
-#include "Swiften/LinkLocal/DNSSDServiceFactory.h"
#include "Swiften/LinkLocal/LinkLocalService.h"
+#include "Swiften/LinkLocal/DNSSD/DNSSDQuerier.h"
+#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
namespace Swift {
class HostAddress;
class LinkLocalServiceBrowser {
public:
- LinkLocalServiceBrowser(DNSSDServiceFactory*);
+ LinkLocalServiceBrowser(boost::shared_ptr<DNSSDQuerier> querier);
std::vector<LinkLocalService> getServices() const;
- boost::signal<void (const LinkLocalServiceID&)> onServiceAdded;
- boost::signal<void (const LinkLocalServiceID&)> onServiceChanged;
- boost::signal<void (const LinkLocalServiceID&)> onServiceRemoved;
+ boost::signal<void (const DNSSDServiceID&)> onServiceAdded;
+ boost::signal<void (const DNSSDServiceID&)> onServiceChanged;
+ boost::signal<void (const DNSSDServiceID&)> onServiceRemoved;
private:
- void handleServiceAdded(const LinkLocalServiceID&);
- void handleServiceRemoved(const LinkLocalServiceID&);
- void handleServiceResolved(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& result);
+ //void handleServiceAdded(const DNSSDServiceID&);
+ //void handleServiceRemoved(const DNSSDServiceID&);
+ //void handleServiceResolved(const DNSSDServiceID& service, const DNSSDService::ResolveResult& result);
private:
- boost::shared_ptr<DNSSDService> dnsSDService;
- typedef std::map<LinkLocalServiceID, DNSSDService::ResolveResult> ServiceMap;
- ServiceMap services;
+ boost::shared_ptr<DNSSDQuerier> querier;
+ //typedef std::map<DNSSDServiceID, DNSSDService::ResolveResult> ServiceMap;
+ //ServiceMap services;
};
}
diff --git a/Swiften/LinkLocal/LinkLocalServiceID.cpp b/Swiften/LinkLocal/LinkLocalServiceID.cpp
deleted file mode 100644
index 4248d88..0000000
--- a/Swiften/LinkLocal/LinkLocalServiceID.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "Swiften/LinkLocal/LinkLocalServiceID.h"
-
-namespace Swift {
-
-const String LinkLocalServiceID::PresenceServiceType = String("_presence._tcp");
-
-}
diff --git a/Swiften/LinkLocal/Makefile.inc b/Swiften/LinkLocal/Makefile.inc
index 86a25fd..0980194 100644
--- a/Swiften/LinkLocal/Makefile.inc
+++ b/Swiften/LinkLocal/Makefile.inc
@@ -3,12 +3,11 @@ SWIFTEN_SOURCES += \
Swiften/LinkLocal/DNSSDService.cpp \
Swiften/LinkLocal/PlatformDNSSDServiceFactory.cpp \
Swiften/LinkLocal/LinkLocalRoster.cpp \
- Swiften/LinkLocal/LinkLocalServiceID.cpp \
Swiften/LinkLocal/LinkLocalServiceInfo.cpp \
- Swiften/LinkLocal/LinkLocalServiceBrowser.cpp \
Swiften/LinkLocal/IncomingLinkLocalSession.cpp \
Swiften/LinkLocal/OutgoingLinkLocalSession.cpp \
Swiften/LinkLocal/LinkLocalConnector.cpp
+#Swiften/LinkLocal/LinkLocalServiceBrowser.cpp
ifeq ($(HAVE_BONJOUR),yes)
SWIFTEN_SOURCES += \
diff --git a/Swiften/LinkLocal/UnitTest/Makefile.inc b/Swiften/LinkLocal/UnitTest/Makefile.inc
index 9640fa7..abc1180 100644
--- a/Swiften/LinkLocal/UnitTest/Makefile.inc
+++ b/Swiften/LinkLocal/UnitTest/Makefile.inc
@@ -1,3 +1,2 @@
UNITTEST_SOURCES += \
- Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp \
Swiften/LinkLocal/UnitTest/LinkLocalServiceInfoTest.cpp