diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-25 17:32:55 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-25 17:32:55 (GMT) |
commit | 9f51e6c6279ae7fb541774ac4bf9debfa61395c1 (patch) | |
tree | d47cc48f4c162b09bf23b8ebf069a7855609b2b8 /Swiften/LinkLocal/DNSSD | |
parent | d2807a77d39bd1a359f5b85869113ed83e01c204 (diff) | |
download | swift-contrib-9f51e6c6279ae7fb541774ac4bf9debfa61395c1.zip swift-contrib-9f51e6c6279ae7fb541774ac4bf9debfa61395c1.tar.bz2 |
Move LinkLocalServiceID->DNSSDServiceID.
Diffstat (limited to 'Swiften/LinkLocal/DNSSD')
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h | 2 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp | 2 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h | 2 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h | 4 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h | 2 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.h | 6 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/DNSSDQuerier.h | 4 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h | 4 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h | 2 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/DNSSDServiceID.cpp | 7 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/DNSSDServiceID.h | 66 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Makefile.inc | 1 |
12 files changed, 88 insertions, 14 deletions
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/DNSSD/DNSSDServiceID.h b/Swiften/LinkLocal/DNSSD/DNSSDServiceID.h new file mode 100644 index 0000000..b1986d3 --- /dev/null +++ b/Swiften/LinkLocal/DNSSD/DNSSDServiceID.h @@ -0,0 +1,66 @@ +#pragma once + +#include "Swiften/Base/String.h" + +namespace Swift { + class DNSSDServiceID { + public: + static const String PresenceServiceType; + + DNSSDServiceID( + const String& name, + const String& type, + const String& domain = PresenceServiceType, + int networkInterface = 0) : + name(name), + type(type), + domain(domain), + networkInterface(networkInterface) { + } + + 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 DNSSDServiceID& o) const { + if (o.name == name) { + if (o.type == type) { + if (o.domain == domain) { + return networkInterface < o.networkInterface; + } + else { + return domain < o.domain; + } + } + else { + return type < o.type; + } + } + else { + return o.name < name; + } + } + + const String& getName() const { + return name; + } + + const String& getType() const { + return type; + } + + const String& getDomain() const { + return domain; + } + + int getNetworkInterfaceID() const { + return networkInterface; + } + + private: + String name; + String type; + String domain; + int networkInterface; + }; +} 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 \ |