/* * Copyright (c) 2010 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once #include #include #include #include #include #include "Swiften/LinkLocal/DNSSD/DNSSDQuerier.h" #include "Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h" namespace Swift { class ByteArray; class BonjourQuerier : public DNSSDQuerier, public boost::enable_shared_from_this { public: BonjourQuerier(); ~BonjourQuerier(); boost::shared_ptr createBrowseQuery(); boost::shared_ptr createRegisterQuery( const String& name, int port, const ByteArray& info); boost::shared_ptr createResolveServiceQuery( const DNSSDServiceID&); boost::shared_ptr createResolveHostnameQuery( const String& hostname, int interfaceIndex); void start(); void stop(); private: friend class BonjourQuery; void addRunningQuery(boost::shared_ptr); void removeRunningQuery(boost::shared_ptr); void interruptSelect(); void run(); private: bool stopRequested; boost::thread* thread; boost::mutex runningQueriesMutex; std::list< boost::shared_ptr > runningQueries; int interruptSelectReadSocket; int interruptSelectWriteSocket; boost::condition_variable runningQueriesAvailableEvent; }; }