#include <servicebrowser.h>
Inherits TQObject.
Public Types | |
enum | Flags { AutoDelete =1 , AutoResolve = 2 } |
enum | State { Working , Stopped , Unsupported } |
Public Slots | |
void | removeDomain (const TQString &domain) |
void | addDomain (const TQString &domain) |
Signals | |
void | serviceAdded (DNSSD::RemoteService::Ptr) |
void | serviceRemoved (DNSSD::RemoteService::Ptr) |
void | finished () |
Public Member Functions | |
ServiceBrowser (const TQStringList &types, DomainBrowser *domains, int flags) | |
ServiceBrowser (const TQString &type, DomainBrowser *domains=0, bool autoResolve=false) | |
ServiceBrowser (const TQString &type, const TQString &domain, int flags) | |
ServiceBrowser (const TQString &type, const TQString &domain, bool autoResolve=false) | |
const TQValueList< RemoteService::Ptr > & | services () const |
virtual void | startBrowse () |
const DomainBrowser * | browsedDomains () const |
Static Public Member Functions | |
static const State | isAvailable () |
Static Public Attributes | |
static const TQString | 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.
Suppose that you need list of web servers running. Example:
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.
Browsing for specific type of services or all available service types
Definition at line 54 of file servicebrowser.h.
Member Enumeration Documentation
◆ Flags
- AutoDelete - DomainBrowser object passes in constructor should be deleted when ServiceBrowser is deleted
- AutoResolve - after disovering new service it will be resolved and then reported with serviceAdded() signal. It raises network usage by resolving all services, so use it only when necessary.
Definition at line 64 of file servicebrowser.h.
◆ State
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 75 of file servicebrowser.h.
Constructor & Destructor Documentation
◆ ServiceBrowser() [1/4]
DNSSD::ServiceBrowser::ServiceBrowser | ( | const TQStringList & | types, |
DomainBrowser * | domains, | ||
int | flags | ||
) |
ServiceBrowser constructor.
- Parameters
-
types List of service types to browse for (example: "_http._tcp"). Can also be DNSSD::ServicesBrowser::AllServices to specify "metaquery" for all service types present on network domains DomainBrowser 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. flags One or more values from Flags
- Since
- 3.5
- Todo:
- KDE4: set default values for domains and flags
Definition at line 59 of file servicebrowser.cpp.
◆ ServiceBrowser() [2/4]
DNSSD::ServiceBrowser::ServiceBrowser | ( | const TQString & | type, |
DomainBrowser * | domains = 0 , |
||
bool | autoResolve = false |
||
) |
The same as above, but allows only one service type.
- Parameters
-
type Type of services to browse for domains DomainBrowser 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. autoResolve auto resolve, if set
- Deprecated:
- use previous constructor instead
Definition at line 54 of file servicebrowser.cpp.
◆ ServiceBrowser() [3/4]
DNSSD::ServiceBrowser::ServiceBrowser | ( | const TQString & | type, |
const TQString & | domain, | ||
int | flags | ||
) |
Overloaded constructor used to create browser for one domain.
- Parameters
-
type Type of services to browse for domain Domain name. You can add more domains later using addDomain and remove them with removeDomain flags One or more values from Flags. AutoDelete flag has no effect
- Since
- 3.5
Definition at line 80 of file servicebrowser.cpp.
◆ ServiceBrowser() [4/4]
DNSSD::ServiceBrowser::ServiceBrowser | ( | const TQString & | type, |
const TQString & | domain, | ||
bool | autoResolve = false |
||
) |
- Deprecated:
- user previous constructor instead
Definition at line 76 of file servicebrowser.cpp.
Member Function Documentation
◆ addDomain
|
slot |
Add new domain to browse.
Definition at line 175 of file servicebrowser.cpp.
◆ browsedDomains()
const DomainBrowser * DNSSD::ServiceBrowser::browsedDomains | ( | ) | const |
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 104 of file servicebrowser.cpp.
◆ finished
|
signal |
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().
◆ isAvailable()
|
static |
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:
Definition at line 85 of file servicebrowser.cpp.
◆ removeDomain
|
slot |
Remove one domain from list of domains to browse.
Definition at line 163 of file servicebrowser.cpp.
◆ serviceAdded
|
signal |
Emitted when new service is discovered (or resolved if autoresolve is set.
◆ serviceRemoved
|
signal |
Emitted when service is no longer announced.
RemoteService object is deleted from services list and destroyed immediately after this signal returns.
◆ services()
const TQValueList< RemoteService::Ptr > & DNSSD::ServiceBrowser::services | ( | ) | const |
Returns list of services.
Definition at line 207 of file servicebrowser.cpp.
◆ startBrowse()
|
virtual |
Starts browsing for services.
To stop it just destroy the object.
Definition at line 127 of file servicebrowser.cpp.
Member Data Documentation
◆ AllServices
|
static |
Special service type to search for all available service types.
Pass it as "type" parameter to ServiceBrowser constructor.
Definition at line 142 of file servicebrowser.h.
The documentation for this class was generated from the following files: