summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-26 15:06:11 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-26 15:17:35 (GMT)
commite7ab68e8daf120d932d9eefc9053e9e064ca29af (patch)
tree82d7b1c6073b69c8dc91f0d72f5a32a8e9a2a67c /Swiften/LinkLocal/DNSSD
parent26d623d3cfd8937fb52acf76ef33d230f5010538 (diff)
downloadswift-e7ab68e8daf120d932d9eefc9053e9e064ca29af.zip
swift-e7ab68e8daf120d932d9eefc9053e9e064ca29af.tar.bz2
Make DNSSD independent of LinkLocalServiceInfo.
Diffstat (limited to 'Swiften/LinkLocal/DNSSD')
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp2
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h4
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h7
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDQuerier.h4
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h4
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h7
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp2
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h4
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h9
9 files changed, 20 insertions, 23 deletions
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
index 70fbc7c..9c9e64e 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp
@@ -29,7 +29,7 @@ boost::shared_ptr<DNSSDBrowseQuery> BonjourQuerier::createBrowseQuery() {
return boost::shared_ptr<DNSSDBrowseQuery>(new BonjourBrowseQuery(shared_from_this()));
}
-boost::shared_ptr<DNSSDRegisterQuery> BonjourQuerier::createRegisterQuery(const String& name, int port, const LinkLocalServiceInfo& info) {
+boost::shared_ptr<DNSSDRegisterQuery> BonjourQuerier::createRegisterQuery(const String& name, int port, const ByteArray& info) {
return boost::shared_ptr<DNSSDRegisterQuery>(new BonjourRegisterQuery(name, port, info, shared_from_this()));
}
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h
index 644a8d9..d12f94f 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h
@@ -10,7 +10,7 @@
#include "Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h"
namespace Swift {
- class LinkLocalServiceInfo;
+ class ByteArray;
class BonjourQuerier :
public DNSSDQuerier,
@@ -21,7 +21,7 @@ namespace Swift {
boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery();
boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery(
- const String& name, int port, const LinkLocalServiceInfo& info);
+ const String& name, int port, const ByteArray& info);
boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery(
const DNSSDServiceID&);
boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery(
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
index 41e5831..c85b90f 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
@@ -2,7 +2,6 @@
#include "Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h"
#include "Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h"
-#include "Swiften/LinkLocal/LinkLocalServiceInfo.h"
#include "Swiften/Base/ByteArray.h"
#include "Swiften/EventLoop/MainEventLoop.h"
@@ -11,8 +10,7 @@ namespace Swift {
class BonjourRegisterQuery : public DNSSDRegisterQuery, public BonjourQuery {
public:
- BonjourRegisterQuery(const String& name, int port, const LinkLocalServiceInfo& info, boost::shared_ptr<BonjourQuerier> querier) : BonjourQuery(querier) {
- ByteArray txtRecord = info.toTXTRecord();
+ BonjourRegisterQuery(const String& name, int port, const ByteArray& txtRecord, boost::shared_ptr<BonjourQuerier> querier) : BonjourQuery(querier) {
DNSServiceErrorType result = DNSServiceRegister(
&sdRef, 0, 0, name.getUTF8Data(), "_presence._tcp", NULL, NULL, port,
txtRecord.getSize(), txtRecord.getData(),
@@ -35,9 +33,8 @@ namespace Swift {
stop();
}
- void updateServiceInfo(const LinkLocalServiceInfo& info) {
+ void updateServiceInfo(const ByteArray& txtRecord) {
boost::lock_guard<boost::mutex> lock(sdRefMutex);
- ByteArray txtRecord = info.toTXTRecord();
DNSServiceUpdateRecord(sdRef, NULL, NULL, txtRecord.getSize(), txtRecord.getData(), 0);
}
diff --git a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h
index 6c7b576..799bc0c 100644
--- a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h
+++ b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h
@@ -4,7 +4,7 @@
namespace Swift {
class String;
- class LinkLocalServiceInfo;
+ class ByteArray;
class DNSSDServiceID;
class DNSSDBrowseQuery;
class DNSSDRegisterQuery;
@@ -17,7 +17,7 @@ namespace Swift {
virtual boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery() = 0;
virtual boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery(
- const String& name, int port, const LinkLocalServiceInfo& info) = 0;
+ const String& name, int port, const ByteArray& info) = 0;
virtual boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery(
const DNSSDServiceID&) = 0;
virtual boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery(
diff --git a/Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h b/Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h
index 627cc6b..4a04fa9 100644
--- a/Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h
@@ -6,7 +6,7 @@
#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
namespace Swift {
- class LinkLocalServiceInfo;
+ class ByteArray;
class DNSSDRegisterQuery {
public:
@@ -14,7 +14,7 @@ namespace Swift {
virtual void registerService() = 0;
virtual void unregisterService() = 0;
- virtual void updateServiceInfo(const LinkLocalServiceInfo& info) = 0;
+ virtual void updateServiceInfo(const ByteArray& info) = 0;
boost::signal<void (boost::optional<DNSSDServiceID>)> onRegisterFinished;
};
diff --git a/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h
index f79b537..217e396 100644
--- a/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h
+++ b/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h
@@ -4,19 +4,18 @@
#include <boost/optional.hpp>
#include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h"
-#include "Swiften/LinkLocal/LinkLocalServiceInfo.h"
+#include "Swiften/Base/ByteArray.h"
namespace Swift {
class DNSSDResolveServiceQuery {
public:
struct Result {
- Result(const String& fullName, const String& host, int port,
- const LinkLocalServiceInfo& info) :
+ Result(const String& fullName, const String& host, int port, const ByteArray& info) :
fullName(fullName), host(host), port(port), info(info) {}
String fullName;
String host;
int port;
- LinkLocalServiceInfo info;
+ ByteArray info;
};
virtual ~DNSSDResolveServiceQuery();
diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp
index 222500a..88c7774 100644
--- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp
+++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp
@@ -17,7 +17,7 @@ boost::shared_ptr<DNSSDBrowseQuery> FakeDNSSDQuerier::createBrowseQuery() {
return boost::shared_ptr<DNSSDBrowseQuery>(new FakeDNSSDBrowseQuery(shared_from_this()));
}
-boost::shared_ptr<DNSSDRegisterQuery> FakeDNSSDQuerier::createRegisterQuery(const String& name, int port, const LinkLocalServiceInfo& info) {
+boost::shared_ptr<DNSSDRegisterQuery> FakeDNSSDQuerier::createRegisterQuery(const String& name, int port, const ByteArray& info) {
return boost::shared_ptr<DNSSDRegisterQuery>(new FakeDNSSDRegisterQuery(name, port, info, shared_from_this()));
}
diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h
index 6c5f343..43b717e 100644
--- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h
+++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h
@@ -11,7 +11,7 @@
#include "Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h"
namespace Swift {
- class LinkLocalServiceInfo;
+ class ByteArray;
class FakeDNSSDQuery;
class FakeDNSSDBrowseQuery;
@@ -24,7 +24,7 @@ namespace Swift {
boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery();
boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery(
- const String& name, int port, const LinkLocalServiceInfo& info);
+ const String& name, int port, const ByteArray& info);
boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery(
const DNSSDServiceID&);
boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery(
diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h
index b4646fd..82ec623 100644
--- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h
@@ -2,7 +2,7 @@
#include "Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h"
#include "Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h"
-#include "Swiften/LinkLocal/LinkLocalServiceInfo.h"
+#include "Swiften/Base/ByteArray.h"
#include "Swiften/Base/String.h"
namespace Swift {
@@ -10,14 +10,15 @@ namespace Swift {
class FakeDNSSDRegisterQuery : public DNSSDRegisterQuery, public FakeDNSSDQuery {
public:
- FakeDNSSDRegisterQuery(const String& name, int port, const LinkLocalServiceInfo& info, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), name(name), port(port), info(info) {
+ FakeDNSSDRegisterQuery(const String& name, int port, const ByteArray& info, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), name(name), port(port), info(info) {
}
void registerService() {
run();
}
- void updateServiceInfo(const LinkLocalServiceInfo&) {
+ void updateServiceInfo(const ByteArray& i) {
+ info = i;
}
void unregisterService() {
@@ -26,6 +27,6 @@ namespace Swift {
String name;
int port;
- LinkLocalServiceInfo info;
+ ByteArray info;
};
}