QMdnsEngine  0.1.0
Multicast DNS library for Qt applications
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 
36 namespace QMdnsEngine
37 {
38 
39 class QMDNSENGINE_EXPORT RecordPrivate;
40 
59 class QMDNSENGINE_EXPORT Record
60 {
61 public:
62 
66  Record();
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 
127  void setFlushCache(bool flushCache);
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 
246 private:
247 
248  RecordPrivate *const d;
249 };
250 
251 QMDNSENGINE_EXPORT QDebug operator<<(QDebug dbg, const Record &record);
252 
253 }
254 
255 #endif // QMDNSENGINE_RECORD_H
Definition: abstractserver.h:32
DNS record.
Definition: record.h:59
256-bit bitmap
Definition: bitmap.h:41