/usr/include/dnssd/servicebase.h is in kdelibs5-dev 4:4.8.4-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | /* This file is part of the KDE project
*
* Copyright (C) 2004 Jakub Stachowski <qbast@go2.pl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DNSSDSERVICEBASE_H
#define DNSSDSERVICEBASE_H
#include <QtCore/QMap>
#include <QtCore/QString>
#include <ksharedptr.h>
#include <dnssd/dnssd_export.h>
namespace DNSSD
{
class ServiceBasePrivate;
/**
* @class ServiceBase servicebase.h DNSSD/ServiceBase
* @short 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 PublicService
*/
class KDNSSD_EXPORT ServiceBase : public QSharedData //krazy:exclude=dpointer (protected)
{
public:
typedef KSharedPtr<ServiceBase> Ptr;
/**
* Creates a ServiceBase object
*
* Note that @p name, @p type and @p domain uniquely identify
* the service in the DNS-SD system, and @p host and @p port
* provide the actual location of the service.
*
* For example, RemoteService populates @p host and @p port
* based on the @p name, @p type and @p domain attributes
* using the DNS-SD resolution system.
*
* @param name service name
* @param type service type
* @param domain the DNS-SD domain name for service
* @param host the host name of the service (a fully-qualified domain name)
* @param port the port number of the service
*/
explicit ServiceBase(const QString& name = QString(),
const QString& type = QString(),
const QString& domain = QString(),
const QString& host = QString(),
unsigned short port = 0);
virtual ~ServiceBase();
/**
* The name of the service
*/
QString serviceName() const;
/**
* The type of the service
*
* This is always in the format _sometype._udp or _sometype._tcp.
*
* See the <a href="http://www.dns-sd.org">DNS-SD website</a> for
* <a href="http://www.dns-sd.org/ServiceTypes.html">a full list of service types</a>.
*/
QString type() const;
/**
* The domain that the service belongs to
*
* It is "local." for link-local services.
*/
QString domain() 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 RemoteService::resolve() and RemoteService::resolveAsync()
*/
QString hostName() 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 RemoteService::resolve() and RemoteService::resolveAsync()
*/
unsigned short port() 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 <a
* href="http://www.dns-sd.org/ServiceTypes.html">service types list</a>.
* If a @c key=value pair is given, this will appear with the @c value
* in a QByteArray indexed by the @c key. If the data is on its own
* (does not have an @c = 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
* @code
* QString printerModel = "unknown";
* if (service->textData().contains("ty")) {
* printQueue = QString::fromUtf8(service->textData()["ty"].constData());
* }
* @endcode
* 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.
*/
QMap<QString,QByteArray> textData() 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
*
* @param o the service to compare this service to
* @return @c true if this service represents the same
* service (from the point of view of DNS-SD) as
* @p o, @c false otherwise
*/
bool 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
*
* @param o the service to compare this service to
* @return @c false if this service represents the same
* service (from the point of view of DNS-SD) as
* @p o, @c true otherwise
*/
bool operator!=(const ServiceBase& o) const;
protected:
ServiceBase(ServiceBasePrivate* const d);
virtual void virtual_hook(int, void*);
ServiceBasePrivate* const d;
};
/* Utility functions */
/**
* Check if the domain is link-local
*
* @return @c true if domain is link-local ('local.'), @c false otherwise
*/
bool domainIsLocal(const QString& domain);
}
#endif
|