• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

DNSSD

  • DNSSD
  • PublicService
Signals | Public Member Functions | Protected Member Functions | List of all members
DNSSD::PublicService Class Reference

#include <DNSSD/PublicService>

Inheritance diagram for DNSSD::PublicService:
Inheritance graph
[legend]

Signals

void published (bool successful)
 

Public Member Functions

 PublicService (const QString &name=QString(), const QString &type=QString(), unsigned int port=0, const QString &domain=QString(), const QStringList &subtypes=QStringList())
 
 ~PublicService ()
 
bool isPublished () const
 
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
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 
- Public Member Functions inherited from DNSSD::ServiceBase
 ServiceBase (const QString &name=QString(), const QString &type=QString(), const QString &domain=QString(), const QString &host=QString(), unsigned short port=0)
 
virtual ~ServiceBase ()
 
QString domain () const
 
QString hostName () const
 
bool operator!= (const ServiceBase &o) const
 
bool operator== (const ServiceBase &o) const
 
unsigned short port () const
 
QString serviceName () const
 
QMap< QString, QByteArray > textData () const
 
QString type () const
 
- Public Member Functions inherited from QSharedData
 QSharedData ()
 
 QSharedData (const QSharedData &other)
 

Protected Member Functions

virtual void virtual_hook (int, void *)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Member Functions inherited from DNSSD::ServiceBase
 ServiceBase (ServiceBasePrivate *const d)
 

Additional Inherited Members

- Public Types inherited from DNSSD::ServiceBase
typedef KSharedPtr< ServiceBase > Ptr
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Protected Attributes inherited from DNSSD::ServiceBase
ServiceBasePrivate *const d
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Represents a service to be published.

This class allows you to publish the existence of a network service provided by your application.

If you are providing a web server and want to advertise it on the local network, you might do

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 an application's GUI for a moment. To publish asynchronously instead, do:

DNSSD::PublicService *service = new DNSSD::PublicService("My files", "_http._tcp", 80);
connect(service, SIGNAL(published(bool)), this, SLOT(wasPublished(bool)));
service->publishAsync();
Author
Jakub Stachowski

Definition at line 59 of file publicservice.h.

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

Creates a service description that can be published.

If no name is given, the computer name is used instead. If there is already a service with the same name, type and domain a number will be appended to the name to make it unique.

If no domain is specified, the service is published on the link-local domain (.local).

The subtypes can be used to specify server attributes, such as "_anon" for anonymous FTP servers, or can specify a specific protocol (such as a web service interface) on top of a generic protocol like SOAP.

There is a comprehensive list of possible types available, but you are largely on your own for subtypes.

Parameters
namea service name to use instead of the computer name
typeservice type, in the form _sometype._udp or _sometype._tcp
portport number, or 0 to "reserve" the service name
domainthe domain to publish the service on (see DomainBrowser)
subtypesoptional list of subtypes, each with a leading underscore
See also
ServiceBrowser::ServiceBrowser()

Definition at line 28 of file dummy-publicservice.cpp.

DNSSD::PublicService::~PublicService ( )

Definition at line 36 of file dummy-publicservice.cpp.

Member Function Documentation

bool DNSSD::PublicService::isPublished ( ) const

Whether the service is currently published.

Returns
true if the service is being published to the domain, false otherwise

Definition at line 74 of file dummy-publicservice.cpp.

bool DNSSD::PublicService::publish ( )

Publish the service synchronously.

The method will not return (and hence the application interface will freeze, since KDElibs code should be executed in the main thread) until either the service is published or publishing fails.

published(bool) is emitted before this method returns.

Returns
true if the service was successfully published, false otherwise

Definition at line 79 of file dummy-publicservice.cpp.

void DNSSD::PublicService::publishAsync ( )

Publish the service asynchronously.

Returns immediately and emits published(bool) when completed. Note that published(bool) may be emitted before this method returns when an error is detected immediately.

Definition at line 87 of file dummy-publicservice.cpp.

void DNSSD::PublicService::published ( bool  successful)
signal

Emitted when publishing is complete.

It will also emitted when an already-published service is republished after a property of the service (such as the name or port) is changed.

void DNSSD::PublicService::setDomain ( const QString &  domain)

Sets the domain where the service is published.

"local." means link-local, ie: the IP subnet on the LAN containing this computer.

If service is already published, it will be removed from the current domain and published on domain instead.

Parameters
domainthe new domain to publish the service on

Definition at line 44 of file dummy-publicservice.cpp.

void DNSSD::PublicService::setPort ( unsigned short  port)

Sets the port.

If the service is already published, it will be re-announced with the new port.

Parameters
portthe port of the service, or 0 to simply "reserve" the name

Definition at line 64 of file dummy-publicservice.cpp.

void DNSSD::PublicService::setServiceName ( const QString &  serviceName)

Sets the name of the service.

If the service is already published, it will be re-announced with the new name.

Parameters
serviceNamethe new name of the service

Definition at line 39 of file dummy-publicservice.cpp.

void DNSSD::PublicService::setSubTypes ( const QStringList &  subtypes)

Sets the subtypetypes of the service.

If the service is already published, it will be re-announced with the new subtypes.

The existing list of substypes is replaced, so an empty list will cause all existing subtypes to be removed.

Parameters
subtypesthe new list of subtypes

Definition at line 59 of file dummy-publicservice.cpp.

void DNSSD::PublicService::setTextData ( const QMap< QString, QByteArray > &  textData)

Sets new text properties.

If the service is already published, it will be re-announced with the new data.

Parameters
textDatathe new text properties for the service
See also
ServiceBase::textData()

Definition at line 49 of file dummy-publicservice.cpp.

void DNSSD::PublicService::setType ( const QString &  type)

Sets the service type.

If the service is already published, it will be re-announced with the new type.

Parameters
typethe new type of the service

See PublicService() for details on the format of type

Definition at line 54 of file dummy-publicservice.cpp.

void DNSSD::PublicService::stop ( )

Stops publishing or aborts an incomplete publish request.

Useful when you want to disable the service for some time.

Note that if you stop providing a service (without exiting the application), you should stop publishing it.

Definition at line 84 of file dummy-publicservice.cpp.

QStringList DNSSD::PublicService::subtypes ( ) const

The subtypes of service.

See also
setSubTypes()

Definition at line 69 of file dummy-publicservice.cpp.

void DNSSD::PublicService::virtual_hook ( int  ,
void *   
)
protectedvirtual

Reimplemented from DNSSD::ServiceBase.

Definition at line 92 of file dummy-publicservice.cpp.


The documentation for this class was generated from the following files:
  • publicservice.h
  • dummy-publicservice.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

DNSSD

Skip menu "DNSSD"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal