DNSSD
DNSSD::PublicService Class Reference
#include <DNSSD/PublicService>

Detailed Description
This class is most important for application that wants to announce its service on network.Suppose that you want to make your web server public - this is simplest way:
DNSSD::PublicService *service = new DNSSD::PublicService("My files","_http._tcp",80); bool isOK = service->publish();
In this example publish() is synchronous - it will not return until publishing is complete. This is usually not too long but it can freeze application's GUI for a moment. Asynchronous publishing is better for responsiveness. Example:
DNSSD::PublicService *service = new DNSSD::PublicService("My files","_http._tcp",80); connect(service,SIGNAL(published(bool)),this,SLOT(wasPublished(bool))); service->publishAsync();
This class represents local service being published
Definition at line 58 of file publicservice.h.
Signals | |
void | published (bool) |
Public Member Functions | |
bool | isPublished () const |
PublicService (const QString &name=QString(), const QString &type=QString(), unsigned int port=0, const QString &domain=QString(), const QStringList &subtypes=QStringList()) | |
bool | publish () |
void | publishAsync () |
void | setDomain (const QString &domain) |
void | setPort (unsigned short port) |
void | setServiceName (const QString &serviceName) |
void | setSubTypes (const QStringList &subtypes) |
void | setTextData (const QMap< QString, QByteArray > &textData) |
void | setType (const QString &type) |
void | stop () |
QStringList | subtypes () const |
~PublicService () | |
Protected Member Functions | |
virtual void | virtual_hook (int, void *) |
Constructor & Destructor Documentation
DNSSD::PublicService::PublicService | ( | const QString & | name = QString() , |
|
const QString & | type = QString() , |
|||
unsigned int | port = 0 , |
|||
const QString & | domain = QString() , |
|||
const QStringList & | subtypes = QStringList() | |||
) | [explicit] |
- Parameters:
-
name Service name.
If set to QString(), computer name will be used and will be available via serviceName() after successful registration
- Parameters:
-
type Service type. Has to be in form _sometype._udp or _sometype._tcp port Port number. Set to 0 to "reserve" service name. domain Domain name. If left as QString:null, user configuration will be used. "local." means local LAN subtypes Optional list of subtypes. Each subtype name must have leading underscore. Example: service of type _ftp._tcp may have subtype _anon meaning that it is anonymous FTP server.
Definition at line 41 of file avahi-publicservice.cpp.
DNSSD::PublicService::~PublicService | ( | ) |
Definition at line 51 of file avahi-publicservice.cpp.
Member Function Documentation
bool DNSSD::PublicService::isPublished | ( | ) | const |
bool DNSSD::PublicService::publish | ( | ) |
Synchrounous publish.
Application will be freezed until publishing is complete.
- Returns:
- true if successful.
Definition at line 138 of file avahi-publicservice.cpp.
void DNSSD::PublicService::publishAsync | ( | ) |
Asynchronous version of publish().
It return immediately and emits signal published(bool) when completed. Note that in case of early detected error (like bad service type) signal may be emitted before return of this function.
Definition at line 200 of file avahi-publicservice.cpp.
void DNSSD::PublicService::published | ( | bool | ) | [signal] |
Emitted when publishing is complete - parameter is set to true if it was successful.
It will also emitted when name, port or type of already published service is changed.
void DNSSD::PublicService::setDomain | ( | const QString & | domain | ) |
Sets domain where service is published.
"local." means local LAN. If service is currently published, it will be re-announced with new data.
Definition at line 75 of file avahi-publicservice.cpp.
void DNSSD::PublicService::setPort | ( | unsigned short | port | ) |
Sets port.
If service is currently published, it will be re-announced with new data.
Definition at line 112 of file avahi-publicservice.cpp.
void DNSSD::PublicService::setServiceName | ( | const QString & | serviceName | ) |
Sets name of the service.
If service is currently published, it will be re-announced with new data.
Definition at line 65 of file avahi-publicservice.cpp.
void DNSSD::PublicService::setSubTypes | ( | const QStringList & | subtypes | ) |
Sets subtypetypes of service.
Pass empty list to remove subtype. If service is currently published, it will be re-announced with new data.
Definition at line 96 of file avahi-publicservice.cpp.
void DNSSD::PublicService::setTextData | ( | const QMap< QString, QByteArray > & | textData | ) |
Sets new text properties.
If services is already published, it will be re-announced with new data.
Definition at line 122 of file avahi-publicservice.cpp.
void DNSSD::PublicService::setType | ( | const QString & | type | ) |
Sets type of service.
It has to in form of _type._udp or _type._tcp. If service is currently published, it will be re-announced with new data.
Definition at line 86 of file avahi-publicservice.cpp.
void DNSSD::PublicService::stop | ( | ) |
Stops publishing or abort incomplete publish request.
Useful when you want to disable service for some time.
Definition at line 146 of file avahi-publicservice.cpp.
QStringList DNSSD::PublicService::subtypes | ( | ) | const |
Returns otpional subtype of service.
It is always empty for domains and in most cases empty for normal services.
Definition at line 106 of file avahi-publicservice.cpp.
void DNSSD::PublicService::virtual_hook | ( | int | , | |
void * | ||||
) | [protected, virtual] |
The documentation for this class was generated from the following files: