1/*
2 This file is part of the KDE project
3
4 SPDX-FileCopyrightText: 2004 Jakub Stachowski <qbast@go2.pl>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "servicebase.h"
10#include "servicebase_p.h"
11#include <QDataStream>
12#include <QUrl>
13
14namespace KDNSSD
15{
16ServiceBase::ServiceBase(const QString &name, const QString &type, const QString &domain, const QString &host, unsigned short port)
17 : d(new ServiceBasePrivate(name, type, domain, host, port))
18{
19}
20
21ServiceBase::ServiceBase(ServiceBasePrivate *const _d)
22 : d(_d)
23{
24}
25
26ServiceBase::~ServiceBase() = default;
27
28QString ServiceBase::serviceName() const
29{
30 return d->m_serviceName;
31}
32
33QString ServiceBase::type() const
34{
35 return d->m_type;
36}
37
38QString ServiceBase::domain() const
39{
40 return d->m_domain;
41}
42
43QString ServiceBase::hostName() const
44{
45 return d->m_hostName;
46}
47
48unsigned short ServiceBase::port() const
49{
50 return d->m_port;
51}
52QMap<QString, QByteArray> ServiceBase::textData() const
53{
54 return d->m_textData;
55}
56
57bool ServiceBase::operator==(const ServiceBase &o) const
58{
59 return d->m_domain == o.d->m_domain && d->m_serviceName == o.d->m_serviceName && d->m_type == o.d->m_type;
60}
61
62bool ServiceBase::operator!=(const ServiceBase &o) const
63{
64 return !(*this == o);
65}
66
67void ServiceBase::virtual_hook(int, void *)
68{
69}
70
71bool domainIsLocal(const QString &domain)
72{
73 return domain.section(asep: QLatin1Char('.'), astart: -1, aend: -1).toLower() == QLatin1String("local");
74}
75
76}
77

source code of kdnssd/src/servicebase.cpp