DNSSD::ServiceBrowser Class Reference
Most important class for applications that want to discover specific services on network. Browsing for specific type of services or all available service types. More...
#include <servicebrowser.h>
Inheritance diagram for DNSSD::ServiceBrowser:

Public Types | |
enum | State { Working, Stopped, Unsupported } |
Public Slots | |
void | removeDomain (const QString &domain) |
void | addDomain (const QString &domain) |
Signals | |
void | serviceAdded (DNSSD::RemoteService::Ptr) |
void | serviceRemoved (DNSSD::RemoteService::Ptr) |
void | finished () |
Public Member Functions | |
ServiceBrowser (const QString &type, DomainBrowser *domains=0, bool autoResolve=false) | |
ServiceBrowser (const QString &type, const QString &domain, bool autoResolve=false) | |
const QValueList< RemoteService::Ptr > & | services () const |
virtual void | startBrowse () |
const DomainBrowser * | browsedDomains () const |
Static Public Member Functions | |
const State | isAvailable () |
Static Public Attributes | |
const QString | AllServices = "_services._dns-sd._udp" |
Protected Member Functions | |
virtual void | virtual_hook (int, void *) |
Detailed Description
Most important class for applications that want to discover specific services on network. Browsing for specific type of services or all available service types.Suppose that you need list of web servers running. Example:
DNSSD::ServiceBrowser* browser = new DNSSD::ServiceBrowser("_http._tcp"); connect(browser,SIGNAL(serviceAdded(RemoteService::Ptr)),this,SLOT(addService(RemoteService::Ptr))); connect(browser,SIGNAL(serviceRemoved(RemoteService::Ptr)),this,SLOT(delService(RemoteService::Ptr))); browser->startBrowse();
In above example addService will be called for every web server already running or just appearing on network and delService will be called when server is stopped. Because no DomainBrowser was passed to constructor, domains configured by user will be searched.
- Author:
- Jakub Stachowski
Definition at line 54 of file servicebrowser.h.
Member Enumeration Documentation
|
Availability of DNS-SD services. Working - available Stopped - not available because mdnsd daemon is not running Unsupported - not available because KDE was compiled without DNS-SD support Definition at line 64 of file servicebrowser.h. |
Constructor & Destructor Documentation
|
ServiceBrowser constructor.
Definition at line 50 of file servicebrowser.cpp. |
|
Overloaded constructor used to create browser for one domain.
Definition at line 67 of file servicebrowser.cpp. |
Member Function Documentation
|
Returns list of services.
Definition at line 188 of file servicebrowser.cpp. |
|
Starts browsing for services. To stop it just destroy the object. Definition at line 112 of file servicebrowser.cpp. References addDomain(). |
|
Return DomainBrowser containing domains being browsed. Valid object will returned even if 'domains' parameters in constructor was set to NULL or single domain constructor was used. Definition at line 89 of file servicebrowser.cpp. |
|
Checks availability of DNS-SD services (this also covers publishing). If you use this function to report an error to the user, below is a suggestion on how to word the errors:
switch(DNSSD::ServiceBrowser::isAvailable()) { case DNSSD::ServiceBrowser::Working: return ""; case DNSSD::ServiceBrowser::Stopped: return i18n("<p>The Zeroconf daemon is not running. See the Service Discovery Handbook" " for more information.<br/>" "Other users will not see this system when browsing" " the network via zeroconf, but normal access will still work.</p>"); case DNSSD::ServiceBrowser::Unsupported: return i18n("<p>Zeroconf support is not available in this version of KDE." " See the Service Discovery Handbook for more information.<br/>" "Other users will not see this system when browsing" " the network via zeroconf, but normal access will still work.</p>"); default: return i18n("<p>Unknown error with Zeroconf.<br/>" "Other users will not see this system when browsing" " the network via zeroconf, but normal access will still work.</p>"); } Definition at line 72 of file servicebrowser.cpp. |
|
Emitted when new service is discovered (or resolved if autoresolve is set.
Referenced by addDomain(). |
|
Emitted when service is no longer announced. RemoteService object is deleted from services list and destroyed immediately after this signal returns. Referenced by addDomain(), and removeDomain(). |
|
Emitted when all services has been reported. This signal can be used by application that just want to get list of currently available services (similar to directory listing) and do not care about dynamic adding/removing services later. This signal can be emitted many time: for example if new host has been connected to network and is announcing some services interesting to this ServiceBrowser, they will be reported by several serviceAdded() signals and whole batch will be concluded by finished(). Referenced by addDomain(). |
|
Remove one domain from list of domains to browse.
Definition at line 147 of file servicebrowser.cpp. References serviceRemoved(). |
|
Add new domain to browse.
Definition at line 159 of file servicebrowser.cpp. References finished(), serviceAdded(), serviceRemoved(), and DNSSD::Query::startQuery(). Referenced by startBrowse(). |
Member Data Documentation
|
Special service type to search for all available service types. Pass it as "type" parameter to ServiceBrowser constructor. Definition at line 33 of file servicebrowser.cpp. |
The documentation for this class was generated from the following files: