DNSSD::ServiceBrowser Class Reference
#include <servicebrowser.h>
Inheritance diagram for DNSSD::ServiceBrowser:

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.
Public Types | |
enum | Flags { AutoDelete = 1, AutoResolve = 2 } |
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 QStringList &types, DomainBrowser *domains, int flags) | |
ServiceBrowser (const QString &type, DomainBrowser *domains=0, bool autoResolve=false) | |
ServiceBrowser (const QString &type, const QString &domain, int flags) | |
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 | |
static const State | isAvailable () |
Static Public Attributes | |
static const QString | AllServices = "_services._dns-sd._udp" |
Protected Member Functions | |
virtual void | virtual_hook (int, void *) |
Member Enumeration Documentation
|
Definition at line 64 of file servicebrowser.h. |
|
Availability of DNS-SD services.
Definition at line 75 of file servicebrowser.h. |
Constructor & Destructor Documentation
|
ServiceBrowser constructor.
Definition at line 60 of file servicebrowser.cpp. |
|
The same as above, but allows only one service type.
Definition at line 55 of file servicebrowser.cpp. |
|
Overloaded constructor used to create browser for one domain.
Definition at line 81 of file servicebrowser.cpp. |
|
Definition at line 77 of file servicebrowser.cpp. |
Member Function Documentation
|
Add new domain to browse.
Definition at line 180 of file servicebrowser.cpp. |
|
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 109 of file servicebrowser.cpp. |
|
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(). |
|
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 86 of file servicebrowser.cpp. |
|
Remove one domain from list of domains to browse.
Definition at line 168 of file servicebrowser.cpp. |
|
Emitted when new service is discovered (or resolved if autoresolve is set.
|
|
Emitted when service is no longer announced. RemoteService object is deleted from services list and destroyed immediately after this signal returns. |
|
Returns list of services.
Definition at line 212 of file servicebrowser.cpp. |
|
Starts browsing for services. To stop it just destroy the object. Definition at line 132 of file servicebrowser.cpp. |
Member Data Documentation
|
Special service type to search for all available service types. Pass it as "type" parameter to ServiceBrowser constructor. Definition at line 38 of file servicebrowser.cpp. |
The documentation for this class was generated from the following files: