summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-23 19:04:08 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-23 20:55:44 (GMT)
commit714e831bb9ea2b14cba3c2696c12e2e13b1bb9d7 (patch)
treee752e00c5ff683ba3550fc663c19f9241c3792f6 /Swiften/LinkLocal/BonjourQuery.cpp
parent3a0309d2d897bf4f399610e52ad439c002e16f9c (diff)
downloadswift-contrib-714e831bb9ea2b14cba3c2696c12e2e13b1bb9d7.zip
swift-contrib-714e831bb9ea2b14cba3c2696c12e2e13b1bb9d7.tar.bz2
Add beginning of new DNS-SD query framework.
Diffstat (limited to 'Swiften/LinkLocal/BonjourQuery.cpp')
-rw-r--r--Swiften/LinkLocal/BonjourQuery.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/Swiften/LinkLocal/BonjourQuery.cpp b/Swiften/LinkLocal/BonjourQuery.cpp
new file mode 100644
index 0000000..a9c13fb
--- /dev/null
+++ b/Swiften/LinkLocal/BonjourQuery.cpp
@@ -0,0 +1,31 @@
+#include "Swiften/LinkLocal/BonjourQuery.h"
+#include "Swiften/LinkLocal/BonjourQuerier.h"
+
+namespace Swift {
+
+BonjourQuery::BonjourQuery(boost::shared_ptr<BonjourQuerier> q) : querier(q), sdRef(0) {
+}
+
+BonjourQuery::~BonjourQuery() {
+ DNSServiceRefDeallocate(sdRef);
+}
+
+void BonjourQuery::processResult() {
+ boost::lock_guard<boost::mutex> lock(sdRefMutex);
+ DNSServiceProcessResult(sdRef);
+}
+
+int BonjourQuery::getSocketID() const {
+ boost::lock_guard<boost::mutex> lock(sdRefMutex);
+ return DNSServiceRefSockFD(sdRef);
+}
+
+void BonjourQuery::run() {
+ querier->addRunningQuery(shared_from_this());
+}
+
+void BonjourQuery::finish() {
+ querier->removeRunningQuery(shared_from_this());
+}
+
+}