#include <registry.h>
Signals | |
void | foundServiceTypes (QString token, QStringList serviceTypes) |
void | foundService (QString token, Service service, int lifetime) |
void | foundAttributes (QString token, Service service) |
void | foundScopes (QString token, QStringList scopeList) |
void | operationFinished (QString token, bool success, QString msg) |
Public Methods | |
Registry (const QString &language=QString::null, bool allowAnyLanguage=true) | |
virtual | ~Registry () |
Registry (const Registry &other) | |
Registry & | operator= (const Registry &other) |
bool | available () const |
bool | supportsAutoAddress () const |
bool | registerService (const Service &service, bool autoAddress, bool autoDeregister=true, const QStringList &scopes=DefaultScopes, unsigned short lifetime=RecommendedLifetime, bool autoLifetimeExtension=true) |
bool | deregister (const QString &serviceURL) |
bool | deregister (const Service &service) |
bool | findServiceTypes (const QString &token=QString::null, const QString &namingAuthority=AllAuthorities, const QStringList &scopeList=DefaultScopes) |
bool | findServiceTypesAsync (const QString &token=QString::null, const QString &namingAuthority=AllAuthorities, const QStringList &scopeList=DefaultScopes) |
bool | findServices (const QString &token, const QString &srvtype, bool fetchAttributes=true, const Filter::List &filters=Filter::List(), const QString &scopeList=QString::null) |
bool | findServicesAsync (const QString &token, const QString &srvtype, bool fetchAttributes=true, const Filter::List &filters=Filter::List(), const QString &scopeList=QString::null) |
bool | findAttributes (const QString &token, const QString &serviceUrl, const QStringList &attributeIds=QStringList()) |
bool | findAttributesAsync (const QString &token, const QString &serviceUrl, const QStringList &attributeIds=QStringList()) |
bool | findScopes (const QString &token) |
bool | findScopesAsync (const QString &token) |
Static Public Attributes | |
const unsigned short | UnlimitedLifetime = 65535 |
const unsigned short | RecommendedLifetime = 900 |
const QStringList | DefaultScopes |
const QString | DefaultAuthority |
const QString | AllAuthorities |
Registry represents the connection to the SLP daemon. You can use it to find services or to register your own.
Registration example:
// register a new SLP service Service s("service:http://www.kde.org"); s.setString("description", "KDE Web Site"); Registry r(); r.registerService(s, false);
Query example:
// query for HTTP servers that contain "www" in the description Registry r(); connect(&r, SIGNAL(foundService(Service,QString)), yourHandler, SLOT(foundService(Service,QString))); connect(&r, SIGNAL(operationFinished(Service,QString)), yourHandler, SLOT(operationFinished(bool,QString))); r.findServices(QString::null, "service:http", true, Filter::List() << new PredicateFilter("(description=*kde*)"));
|
Creates a new service registration instance for the given language. There can be more than one instance, they will share the connection to the daemon.
|
|
Closes the service registration instance. When the last instance has been closed all services that have been registered with the "autoDeregister" feature will be deregistered automatically. |
|
Copies this registry. Both will share the connection and language configuration, but not signals (if you start an operation on one registry, the other will not emit its signals).
|
|
Returns true if service registration and searching is generally possible. Reasons for a failure could be that the SLP libraries are not installed or no SLP daemon (knotd or slpd) is running.
|
|
Deregisters the given service in all languages.
|
|
Deregisters the given service in all languages.
|
|
Finds the attributes of the service with the given URL. The function emits the signal foundAttributes() if the service has been found, followed by operationFinished(). The function will not return before it finished searching, but the event loop will be running while the function blocks.
|
|
Finds the attributes of the service with the given URL. The function emits the signal foundAttributes() if the service has been found, followed by operationFinished(). The function will return immediately.
|
|
Finds all scopes that can be searched. Always finds at least one scope (the default scope). The function emits the signal foundScopes() every time new scopes have been found, and a operationFinished() when finished. The function will not return before it finished searching, but the event loop will be running while the function blocks.
|
|
Finds all scopes that can be searched. Always finds at least one scope (the default scope). The function emits the signal foundScopes() every time new scopes have been found, and a operationFinished() when finished. The function will return immediately.
|
|
Finds all services in the given scope with the given service type. Examples for service types are "service:ftp" to find all ftp servers or "service:remotedesktop" to find all remote desktop services. You can also specify a list of Filter s to limit the query and modify the list of returned services. The function emits the signal foundService() each time it discovered a service types. When the last service has been found operationFinished() will be emitted. The function will not return before it finished searching, but the event loop will be running while the function blocks.
|
|
Finds all services in the given scope with the given service type. Examples for service types are "service:ftp" to find all ftp servers or "service:remotedesktop" to find all remote desktop services. You can also specify a list of Filter s to limit the query and modify the list of returned services. The function emits the signal foundService() each time it discovered a service types. When the last service has been found operationFinished() will be emitted. The function will return immediately.
|
|
Finds all service types in the given scopes with the given naming authority. This function emits the signal foundServiceTypes() each time it discovered one or more service types. When the last service type has been found operationFinished() will be emitted. The function will not return before it finished searching, but the event loop will be running while the function blocks.
|
|
Finds all service types in the given scopes with the given naming authority. This function emits the signal foundServiceTypes() each time it discovered one or more service types. When the last service type has been found operationFinished() will be emitted. The function will return immediately.
|
|
Called by findAttributes() when the service's attributes have been found.
|
|
Called by findScopes() when the scopes have been discovered.
|
|
Called by findServices() each time a service has been found.
|
|
Called by findServiceTypes() each time one or more service types have been discovered.
|
|
Emitted when a operation finished.
|
|
Makes a copy of the registry. Both will share the connection and language configuration.
|
|
Registers the given service. Registers the given service with the daemon. The daemon will do the rest, like announcing it at DAs and so on. You can safely call register for an existing service - there is no need to deregister() it before. registerService() can do several tasks for you that you would otherwise would have to implement manually. AutoAddress allows you to register a single instance of the service for all interfaces. The SLP daemon will automatically take care that it is announced for each address of this system, even when the interfaces change. This option should only be used for local services that listen to every address using the wildcard. It is required that when this option is activated you use a "service:" type URL with host set to "localhost". On daemons that do not support this feature, "localhost" will be replaced with the host name. Use supportsAutoAddress() to check whether a daemon supports it. AutoDeregister unregisters the service when the last Registry object has been deleted. When the daemon supports it, it will also unregister the service when the connection gets interrupted, for example when this application crashes. AutoLifetimeExtension re-registers a service automatically at the daemon before it expires. It is supported on all servers.
When you register a service that is provided by your application you are almost always fine with the default values for all arguments, you only need
|
|
Checks whether this connection supports the AutoAddress option.
|
|
Use this constant for findServiceTypes()'s namingAuthority argument to get all services, |
|
Use this constant for findServiceTypes()'s namingAuthority argument to get only services from the default (IANA) naming authority. |
|
Use this value in registerService() to register a service with the default scopes. In most cases this is what you want. |
|
The recommended lifetime of a service (15 minutes). |
|
Use this lifetime in registerService() to let a service live forever. This is not recommended in most cases, only do this when you register a service you have no control over and the service will live longer than the application that registers it. |