.TH "DNSSD::ServiceBrowser" kde3 "11 Jun 2005" "Version Version 3.4.1" "dnssd Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
DNSSD::ServiceBrowser \- Most important class for applications that want to discover specific services on network. Browsing for specific type of services or all available service types.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <servicebrowser.h>\fP
.PP
Inherits \fBQObject\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBState\fP { \fBWorking\fP, \fBStopped\fP, \fBUnsupported\fP }"
.br
.in -1c
.SS "Public Slots"

.in +1c
.ti -1c
.RI "void \fBremoveDomain\fP (const \fBQString\fP &domain)"
.br
.ti -1c
.RI "void \fBaddDomain\fP (const \fBQString\fP &domain)"
.br
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBserviceAdded\fP (DNSSD::RemoteService::Ptr)"
.br
.ti -1c
.RI "void \fBserviceRemoved\fP (DNSSD::RemoteService::Ptr)"
.br
.ti -1c
.RI "void \fBfinished\fP ()"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBServiceBrowser\fP (const \fBQString\fP &type, \fBDomainBrowser\fP *domains=0, bool autoResolve=false)"
.br
.ti -1c
.RI "\fBServiceBrowser\fP (const \fBQString\fP &type, const \fBQString\fP &domain, bool autoResolve=false)"
.br
.ti -1c
.RI "const \fBQValueList\fP< RemoteService::Ptr > & \fBservices\fP () const "
.br
.ti -1c
.RI "virtual void \fBstartBrowse\fP ()"
.br
.ti -1c
.RI "const \fBDomainBrowser\fP * \fBbrowsedDomains\fP () const "
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static const \fBState\fP \fBisAvailable\fP ()"
.br
.in -1c
.SS "Static Public Attributes"

.in +1c
.ti -1c
.RI "static const \fBQString\fP \fBAllServices\fP = '_services._dns-sd._udp'"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int, void *)"
.br
.in -1c
.SH "Detailed Description"
.PP 
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:
.PP
.PP
.nf
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();
.fi
.PP
.PP
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 \fBDomainBrowser\fP was passed to constructor, domains configured by user will be searched.
.PP
\fBAuthor:\fP
.RS 4
Jakub Stachowski 
.RE
.PP

.PP
Definition at line 54 of file servicebrowser.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBDNSSD::ServiceBrowser::State\fP"
.PP
Availability of DNS-SD services. 
.PP
Working - available Stopped - not available because mdnsd daemon is not running Unsupported - not available because KDE was compiled without DNS-SD support
.PP
Definition at line 64 of file servicebrowser.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "DNSSD::ServiceBrowser::ServiceBrowser (const \fBQString\fP & type, \fBDomainBrowser\fP * domains = \fC0\fP, bool autoResolve = \fCfalse\fP)"
.PP
\fBServiceBrowser\fP constructor. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP Type of services to browse for (example: '_http._tcp'). Can also be DNSSD::ServicesBrowser::AllServices to specify 'metaquery' for all service types present on network 
.br
\fIdomains\fP \fBDomainBrowser\fP object used to specify domains to browse. You do not have to connect its domainAdded() signal - it will be done automatically. You can left this parameter as NULL for default domains. 
.br
\fIautoResolve\fP If set to TRUE, after disovering new service it will be resolved and then reported with \fBserviceAdded()\fP signal. It raises network usage by resolving all services, so use it only when necessary.
.RE
.PP

.PP
Definition at line 50 of file servicebrowser.cpp.
.SS "DNSSD::ServiceBrowser::ServiceBrowser (const \fBQString\fP & type, const \fBQString\fP & domain, bool autoResolve = \fCfalse\fP)"
.PP
Overloaded constructor used to create browser for one domain. 
.PP
\fBParameters:\fP
.RS 4
\fIdomain\fP Domain name. You can add more domains later using addDomain and remove them with removeDomain
.RE
.PP

.PP
Definition at line 67 of file servicebrowser.cpp.
.SH "Member Function Documentation"
.PP 
.SS "const \fBQValueList\fP< RemoteService::Ptr > & DNSSD::ServiceBrowser::services () const"
.PP
Returns list of services. 
.PP
Definition at line 188 of file servicebrowser.cpp.
.SS "void DNSSD::ServiceBrowser::startBrowse ()\fC [virtual]\fP"
.PP
Starts browsing for services. 
.PP
To stop it just destroy the object.
.PP
Definition at line 112 of file servicebrowser.cpp.
.PP
References addDomain(), QValueList::begin(), and QValueList::end().
.SS "const \fBDomainBrowser\fP * DNSSD::ServiceBrowser::browsedDomains () const"
.PP
Return \fBDomainBrowser\fP containing domains being browsed. 
.PP
Valid object will returned even if 'domains' parameters in constructor was set to NULL or single domain constructor was used.
.PP
Definition at line 89 of file servicebrowser.cpp.
.SS "const \fBServiceBrowser::State\fP DNSSD::ServiceBrowser::isAvailable ()\fC [static]\fP"
.PP
Checks availability of DNS-SD services (this also covers publishing). 
.PP
If you use this function to report an error to the user, below is a suggestion on how to word the errors:
.PP
.PP
.nf
    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>');
        }
.fi
.PP

.PP
Definition at line 72 of file servicebrowser.cpp.
.SS "void DNSSD::ServiceBrowser::serviceAdded (DNSSD::RemoteService::Ptr)\fC [signal]\fP"
.PP
Emitted when new service is discovered (or resolved if autoresolve is set. 
.PP
Referenced by addDomain().
.SS "void DNSSD::ServiceBrowser::serviceRemoved (DNSSD::RemoteService::Ptr)\fC [signal]\fP"
.PP
Emitted when service is no longer announced. 
.PP
\fBRemoteService\fP object is deleted from services list and destroyed immediately after this signal returns.
.PP
Referenced by addDomain(), and removeDomain().
.SS "void DNSSD::ServiceBrowser::finished ()\fC [signal]\fP"
.PP
Emitted when all services has been reported. 
.PP
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 \fBServiceBrowser\fP, they will be reported by several \fBserviceAdded()\fP signals and whole batch will be concluded by \fBfinished()\fP.
.PP
Referenced by addDomain().
.SS "void DNSSD::ServiceBrowser::removeDomain (const \fBQString\fP & domain)\fC [slot]\fP"
.PP
Remove one domain from list of domains to browse. 
.PP
Definition at line 147 of file servicebrowser.cpp.
.PP
References QValueList::begin(), QValueList::end(), QValueList::remove(), and serviceRemoved().
.SS "void DNSSD::ServiceBrowser::addDomain (const \fBQString\fP & domain)\fC [slot]\fP"
.PP
Add new domain to browse. 
.PP
Definition at line 159 of file servicebrowser.cpp.
.PP
References QObject::connect(), finished(), serviceAdded(), serviceRemoved(), and DNSSD::Query::startQuery().
.PP
Referenced by startBrowse().
.SH "Member Data Documentation"
.PP 
.SS "const \fBQString\fP \fBDNSSD::ServiceBrowser::AllServices\fP = '_services._dns-sd._udp'\fC [static]\fP"
.PP
Special service type to search for all available service types. 
.PP
Pass it as 'type' parameter to \fBServiceBrowser\fP constructor.
.PP
Definition at line 33 of file servicebrowser.cpp.

.SH "Author"
.PP 
Generated automatically by Doxygen for dnssd Library from the source code.
