diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-23 19:04:08 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-23 20:55:44 (GMT) |
commit | 714e831bb9ea2b14cba3c2696c12e2e13b1bb9d7 (patch) | |
tree | e752e00c5ff683ba3550fc663c19f9241c3792f6 /Swiften/LinkLocal/BonjourQuerier.h | |
parent | 3a0309d2d897bf4f399610e52ad439c002e16f9c (diff) | |
download | swift-contrib-714e831bb9ea2b14cba3c2696c12e2e13b1bb9d7.zip swift-contrib-714e831bb9ea2b14cba3c2696c12e2e13b1bb9d7.tar.bz2 |
Add beginning of new DNS-SD query framework.
Diffstat (limited to 'Swiften/LinkLocal/BonjourQuerier.h')
-rw-r--r-- | Swiften/LinkLocal/BonjourQuerier.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Swiften/LinkLocal/BonjourQuerier.h b/Swiften/LinkLocal/BonjourQuerier.h new file mode 100644 index 0000000..037d9e6 --- /dev/null +++ b/Swiften/LinkLocal/BonjourQuerier.h @@ -0,0 +1,45 @@ +#pragma once + +#include <boost/shared_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> +#include <list> +#include <boost/thread.hpp> +#include <boost/thread/mutex.hpp> + +#include "Swiften/EventLoop/EventOwner.h" +#include "Swiften/LinkLocal/DNSSDBrowseQuery.h" +#include "Swiften/LinkLocal/BonjourQuery.h" + +namespace Swift { + class BonjourQuerier : + public boost::enable_shared_from_this<BonjourQuerier>, + public EventOwner { + public: + BonjourQuerier(); + ~BonjourQuerier(); + + boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); + + void start(); + void stop(); + + private: + friend class BonjourQuery; + + void addRunningQuery(boost::shared_ptr<BonjourQuery>); + void removeRunningQuery(boost::shared_ptr<BonjourQuery>); + + private: + void interruptSelect(); + void run(); + + private: + bool stopRequested; + boost::thread* thread; + boost::mutex runningQueriesMutex; + std::list< boost::shared_ptr<BonjourQuery> > runningQueries; + int interruptSelectReadSocket; + int interruptSelectWriteSocket; + boost::condition_variable runningQueriesAvailableEvent; + }; +} |