QMdnsEngine 0.2.1
Multicast DNS library for Qt applications
Loading...
Searching...
No Matches
record.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_RECORD_H
26#define QMDNSENGINE_RECORD_H
27
28#include <QByteArray>
29#include <QHostAddress>
30#include <QMap>
31
32#include <qmdnsengine/bitmap.h>
33
34#include "qmdnsengine_export.h"
35
36namespace QMdnsEngine
37{
38
39class QMDNSENGINE_EXPORT RecordPrivate;
40
59class QMDNSENGINE_EXPORT Record
60{
61public:
62
67
71 Record(const Record &other);
72
76 Record &operator=(const Record &other);
77
81 bool operator==(const Record &other) const;
82
86 bool operator!=(const Record &other) const;
87
91 virtual ~Record();
92
96 QByteArray name() const;
97
101 void setName(const QByteArray &name);
102
106 quint16 type() const;
107
114 void setType(quint16 type);
115
122 bool flushCache() const;
123
128
132 quint32 ttl() const;
133
137 void setTtl(quint32 ttl);
138
144 QHostAddress address() const;
145
149 void setAddress(const QHostAddress &address);
150
156 QByteArray target() const;
157
161 void setTarget(const QByteArray &target);
162
168 QByteArray nextDomainName() const;
169
173 void setNextDomainName(const QByteArray &nextDomainName);
174
180 quint16 priority() const;
181
188 void setPriority(quint16 priority);
189
195 quint16 weight() const;
196
203 void setWeight(quint16 weight);
204
210 quint16 port() const;
211
215 void setPort(quint16 port);
216
222 QMap<QByteArray, QByteArray> attributes() const;
223
227 void setAttributes(const QMap<QByteArray, QByteArray> &attributes);
228
232 void addAttribute(const QByteArray &key, const QByteArray &value);
233
239 Bitmap bitmap() const;
240
244 void setBitmap(const Bitmap &bitmap);
245
246private:
247
248 RecordPrivate *const d;
249};
250
251QMDNSENGINE_EXPORT QDebug operator<<(QDebug dbg, const Record &record);
252
253}
254
255#endif // QMDNSENGINE_RECORD_H
256-bit bitmap
Definition bitmap.h:42
DNS record.
Definition record.h:60
void setAttributes(const QMap< QByteArray, QByteArray > &attributes)
Set attributes for the record.
QHostAddress address() const
Retrieve the address for the record.
bool operator==(const Record &other) const
Equality operator.
void setFlushCache(bool flushCache)
Set whether to replace or append to existing records.
void addAttribute(const QByteArray &key, const QByteArray &value)
Add an attribute to the record.
QByteArray nextDomainName() const
Retrieve the next domain name.
Record()
Create an uninitialized record.
QByteArray target() const
Retrieve the target for the record.
void setWeight(quint16 weight)
Set the weight of the record.
void setNextDomainName(const QByteArray &nextDomainName)
Set the next domain name.
void setAddress(const QHostAddress &address)
Set the address for the record.
Record(const Record &other)
Create a copy of an existing record.
void setTarget(const QByteArray &target)
Set the target for the record.
void setType(quint16 type)
Set the type of the record.
void setPort(quint16 port)
Set the port for the record.
bool flushCache() const
Determine whether to replace or append to existing records.
bool operator!=(const Record &other) const
Inequality operator.
void setTtl(quint32 ttl)
Set the TTL (time to live) for the record.
QByteArray name() const
Retrieve the name of the record.
void setName(const QByteArray &name)
Set the name of the record.
virtual ~Record()
Destroy the record.
quint16 priority() const
Retrieve the priority for the record.
void setBitmap(const Bitmap &bitmap)
Set the bitmap for the record.
void setPriority(quint16 priority)
Set the priority for the record.
quint16 type() const
Retrieve the type of the record.
quint16 weight() const
Retrieve the weight of the record.
QMap< QByteArray, QByteArray > attributes() const
Retrieve attributes for the record.
quint16 port() const
Retrieve the port for the record.
Bitmap bitmap() const
Retrieve the bitmap for the record.
quint32 ttl() const
Retrieve the TTL (time to live) for the record.
Record & operator=(const Record &other)
Assignment operator.