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

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