1 | // Copyright (C) 2017 Witekio. |
2 | // Copyright (C) 2018 The Qt Company Ltd. |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
4 | |
5 | #ifndef QCOAPINTERNALREPLY_H |
6 | #define QCOAPINTERNALREPLY_H |
7 | |
8 | #include <QtCoap/qcoapglobal.h> |
9 | #include <QtCoap/qcoapnamespace.h> |
10 | #include <private/qcoapinternalmessage_p.h> |
11 | #include <QtNetwork/qhostaddress.h> |
12 | |
13 | // |
14 | // W A R N I N G |
15 | // ------------- |
16 | // |
17 | // This file is not part of the Qt API. It exists purely as an |
18 | // implementation detail. This header file may change from version to |
19 | // version without notice, or even be removed. |
20 | // |
21 | // We mean it. |
22 | // |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class QCoapInternalReplyPrivate; |
27 | class Q_AUTOTEST_EXPORT QCoapInternalReply : public QCoapInternalMessage |
28 | { |
29 | Q_OBJECT |
30 | public: |
31 | explicit QCoapInternalReply(QObject *parent = nullptr); |
32 | |
33 | static QCoapInternalReply *createFromFrame(const QByteArray &frame, QObject *parent = nullptr); |
34 | void appendData(const QByteArray &data); |
35 | bool hasMoreBlocksToSend() const; |
36 | int nextBlockToSend() const; |
37 | |
38 | using QCoapInternalMessage::addOption; |
39 | void addOption(const QCoapOption &option) override; |
40 | void setSenderAddress(const QHostAddress &address); |
41 | |
42 | QtCoap::ResponseCode responseCode() const; |
43 | QHostAddress senderAddress() const; |
44 | |
45 | private: |
46 | Q_DECLARE_PRIVATE(QCoapInternalReply) |
47 | }; |
48 | |
49 | class Q_AUTOTEST_EXPORT QCoapInternalReplyPrivate : public QCoapInternalMessagePrivate |
50 | { |
51 | public: |
52 | QCoapInternalReplyPrivate() = default; |
53 | |
54 | QtCoap::ResponseCode responseCode = QtCoap::ResponseCode::InvalidCode; |
55 | QHostAddress senderAddress; |
56 | }; |
57 | |
58 | QT_END_NAMESPACE |
59 | |
60 | #endif // QCOAPINTERNALREPLY_H |
61 | |