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 QCOAPINTERNALMESSAGE_P_H
6#define QCOAPINTERNALMESSAGE_P_H
7
8#include <private/qcoapmessage_p.h>
9#include <private/qobject_p.h>
10
11//
12// W A R N I N G
13// -------------
14//
15// This file is not part of the Qt API. It exists purely as an
16// implementation detail. This header file may change from version to
17// version without notice, or even be removed.
18//
19// We mean it.
20//
21
22QT_BEGIN_NAMESPACE
23
24class QCoapInternalMessagePrivate;
25class Q_AUTOTEST_EXPORT QCoapInternalMessage : public QObject
26{
27 Q_OBJECT
28public:
29 explicit QCoapInternalMessage(QObject *parent = nullptr);
30 explicit QCoapInternalMessage(const QCoapMessage &message, QObject *parent = nullptr);
31 virtual ~QCoapInternalMessage() {}
32
33 void addOption(QCoapOption::OptionName name, const QByteArray &value);
34 void addOption(QCoapOption::OptionName name, quint32 value);
35 virtual void addOption(const QCoapOption &option);
36 void removeOption(QCoapOption::OptionName name);
37
38 QCoapMessage *message();
39 const QCoapMessage *message() const;
40
41 uint currentBlockNumber() const;
42 bool hasMoreBlocksToReceive() const;
43 uint blockSize() const;
44
45 virtual bool isValid() const;
46 static bool isUrlValid(const QUrl &url);
47
48protected:
49 explicit QCoapInternalMessage(QCoapInternalMessagePrivate &dd, QObject *parent = nullptr);
50
51 void setFromDescriptiveBlockOption(const QCoapOption &option);
52
53 Q_DECLARE_PRIVATE(QCoapInternalMessage)
54};
55
56class Q_AUTOTEST_EXPORT QCoapInternalMessagePrivate : public QObjectPrivate
57{
58public:
59 QCoapInternalMessagePrivate() = default;
60 ~QCoapInternalMessagePrivate();
61
62 QCoapMessage message;
63
64 uint currentBlockNumber = 0;
65 bool hasNextBlock = false;
66 uint blockSize = 0;
67};
68
69QT_END_NAMESPACE
70
71#endif // QCOAPINTERNALMESSAGE_P_H
72

source code of qtcoap/src/coap/qcoapinternalmessage_p.h