QMdnsEngine 0.2.1
Multicast DNS library for Qt applications
Loading...
Searching...
No Matches
service.h
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2017 Nathan Osman
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25#ifndef QMDNSENGINE_SERVICE_H
26#define QMDNSENGINE_SERVICE_H
27
28#include <QByteArray>
29#include <QHostAddress>
30#include <QList>
31#include <QMap>
32#include <QDebug>
33
34#include "qmdnsengine_export.h"
35
36namespace QMdnsEngine
37{
38
39class QMDNSENGINE_EXPORT ServicePrivate;
40
51class QMDNSENGINE_EXPORT Service
52{
53public:
54
59
63 Service(const Service &other);
64
68 Service &operator=(const Service &other);
69
73 bool operator==(const Service &other) const;
74
78 bool operator!=(const Service &other) const;
79
83 virtual ~Service();
84
88 QByteArray type() const;
89
95 void setType(const QByteArray &type);
96
100 QByteArray name() const;
101
108 void setName(const QByteArray &name);
109
113 QByteArray hostname() const;
114
118 void setHostname(const QByteArray &hostname);
119
123 quint16 port() const;
124
128 void setPort(quint16 port);
129
136 QMap<QByteArray, QByteArray> attributes() const;
137
141 void setAttributes(const QMap<QByteArray, QByteArray> &attributes);
142
146 void addAttribute(const QByteArray &key, const QByteArray &value);
147
148private:
149
150 ServicePrivate *const d;
151};
152
153QMDNSENGINE_EXPORT QDebug operator<<(QDebug debug, const Service &service);
154
155}
156
157#endif // QMDNSENGINE_SERVICE_H
Service available on the local network
Definition service.h:52
QByteArray type() const
Retrieve the service type.
void setHostname(const QByteArray &hostname)
Set the hostname of the device providing the service.
bool operator!=(const Service &other) const
Inequality operator.
void setType(const QByteArray &type)
Set the service type.
void setName(const QByteArray &name)
Set the service name.
void setAttributes(const QMap< QByteArray, QByteArray > &attributes)
Set the attributes for the service.
void addAttribute(const QByteArray &key, const QByteArray &value)
Add an attribute to the service.
Service & operator=(const Service &other)
Assignment operator.
virtual ~Service()
Destroy the service.
bool operator==(const Service &other) const
Equality operator.
QByteArray hostname() const
Retrieve the hostname of the device providing the service.
QMap< QByteArray, QByteArray > attributes() const
Retrieve the attributes for the service.
void setPort(quint16 port)
Set the service port.
Service(const Service &other)
Create a copy of an existing service.
Service()
Create an uninitialized service.
QByteArray name() const
Retrieve the service name.
quint16 port() const
Retrieve the service port.