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

DNSSD

  • DNSSD
  • ServiceBase
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DNSSD::ServiceBase Class Reference

#include <DNSSD/ServiceBase>

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

Public Types

typedef KSharedPtr< ServiceBase > Ptr
 

Public Member Functions

 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
 

Protected Member Functions

 ServiceBase (ServiceBasePrivate *const d)
 
virtual void virtual_hook (int, void *)
 

Protected Attributes

ServiceBasePrivate *const d
 

Detailed Description

Describes a service.

This class is used to describe a service. The service can be published by the current application (in which case it is probably a PublicService) or by another application, either on the current machine or a remote machine, in which case it is probably a RemoteService returned by ServiceBrowser.

You should not normally need to create a ServiceBase object yourself.

Author
Jakub Stachowski
See also
PublicService

Definition at line 51 of file servicebase.h.

Member Typedef Documentation

typedef KSharedPtr<ServiceBase> DNSSD::ServiceBase::Ptr

Definition at line 54 of file servicebase.h.

Constructor & Destructor Documentation

DNSSD::ServiceBase::ServiceBase ( const QString &  name = QString(),
const QString &  type = QString(),
const QString &  domain = QString(),
const QString &  host = QString(),
unsigned short  port = 0 
)
explicit

Creates a ServiceBase object.

Note that name, type and domain uniquely identify the service in the DNS-SD system, and host and port provide the actual location of the service.

For example, RemoteService populates host and port based on the name, type and domain attributes using the DNS-SD resolution system.

Parameters
nameservice name
typeservice type
domainthe DNS-SD domain name for service
hostthe host name of the service (a fully-qualified domain name)
portthe port number of the service

Definition at line 30 of file servicebase.cpp.

DNSSD::ServiceBase::~ServiceBase ( )
virtual

Definition at line 39 of file servicebase.cpp.

DNSSD::ServiceBase::ServiceBase ( ServiceBasePrivate *const  d)
protected

Definition at line 35 of file servicebase.cpp.

Member Function Documentation

QString DNSSD::ServiceBase::domain ( ) const

The domain that the service belongs to.

It is "local." for link-local services.

Definition at line 54 of file servicebase.cpp.

QString DNSSD::ServiceBase::hostName ( ) const

The hostname of the service.

Only valid for local and resolved remote services.

Together with port(), this can be used to actually access the service.

See also
RemoteService::resolve() and RemoteService::resolveAsync()

Definition at line 59 of file servicebase.cpp.

bool DNSSD::ServiceBase::operator!= ( const ServiceBase &  o) const

Compares services based on name, type and domain.

This is enough to for unique identification and omitting port, host and text data allows to compare resolved and unresolved services

Parameters
othe service to compare this service to
Returns
false if this service represents the same service (from the point of view of DNS-SD) as o, true otherwise

Definition at line 78 of file servicebase.cpp.

bool DNSSD::ServiceBase::operator== ( const ServiceBase &  o) const

Compares services based on name, type and domain.

This is enough to for unique identification and omitting port, host and text data allows to compare resolved and unresolved services

Parameters
othe service to compare this service to
Returns
true if this service represents the same service (from the point of view of DNS-SD) as o, false otherwise

Definition at line 73 of file servicebase.cpp.

unsigned short DNSSD::ServiceBase::port ( ) const

The port number of the service.

Only valid for local and resolved remote services.

Together with hostName(), this can be used to actually access the service.

See also
RemoteService::resolve() and RemoteService::resolveAsync()

Definition at line 64 of file servicebase.cpp.

QString DNSSD::ServiceBase::serviceName ( ) const

The name of the service.

Definition at line 44 of file servicebase.cpp.

QMap< QString, QByteArray > DNSSD::ServiceBase::textData ( ) const

Additional text data associated with the service.

Only valid for local and resolved remote services.

This is data that provides additional information about the service. For example, it might be used to specify a printer queue on the printer server specified by hostName() and port().

You can check for the data that might be associated with a particular service on the service types list. If a key=value pair is given, this will appear with the value in a QByteArray indexed by the key. If the data is on its own (does not have an = in it), it will be used to index an empty QByteArray, and can be checked for with QMap::contains().

For example, if you are accessing the _ipp._tcp service, you might do something like

QString printerModel = "unknown";
if (service->textData().contains("ty")) {
printQueue = QString::fromUtf8(service->textData()["ty"].constData());
}

since the TXT data of the IPP service may contain data like "ty=Apple LaserWriter Pro 630". Note that you actually have to be a bit more clever than this, since the key should usually be case insensitive.

Definition at line 68 of file servicebase.cpp.

QString DNSSD::ServiceBase::type ( ) const

The type of the service.

This is always in the format _sometype._udp or _sometype._tcp.

See the DNS-SD website for a full list of service types.

Definition at line 49 of file servicebase.cpp.

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

Reimplemented in DNSSD::PublicService, and DNSSD::RemoteService.

Definition at line 83 of file servicebase.cpp.

Member Data Documentation

ServiceBasePrivate* const DNSSD::ServiceBase::d
protected

Definition at line 189 of file servicebase.h.


The documentation for this class was generated from the following files:
  • servicebase.h
  • servicebase.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:30 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • 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