1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef HTTP2STREAMS_P_H
5#define HTTP2STREAMS_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of the Network Access API. This header file may change from
13// version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "http2frames_p.h"
19#include "hpack_p.h"
20
21#include <private/qhttpnetworkconnectionchannel_p.h>
22#include <private/qhttpnetworkrequest_p.h>
23
24#include <QtCore/qglobal.h>
25#include <QtCore/qstring.h>
26
27#include <vector>
28
29QT_REQUIRE_CONFIG(http);
30
31QT_BEGIN_NAMESPACE
32
33class QNonContiguousByteDevice;
34
35namespace Http2
36{
37
38struct Q_AUTOTEST_EXPORT Stream
39{
40 enum StreamState {
41 idle,
42 open,
43 halfClosedLocal,
44 halfClosedRemote,
45 remoteReserved,
46 closed
47 };
48
49 Stream();
50 // That's a ctor for a client-initiated stream:
51 Stream(const HttpMessagePair &message, quint32 streamID, qint32 sendSize,
52 qint32 recvSize);
53 // That's a reserved stream, created by PUSH_PROMISE from a server:
54 Stream(const QString &key, quint32 streamID, qint32 recvSize);
55
56 QHttpNetworkReply *reply() const;
57 const QHttpNetworkRequest &request() const;
58 QHttpNetworkRequest &request();
59 QHttpNetworkRequest::Priority priority() const;
60 uchar weight() const;
61
62 QNonContiguousByteDevice *data() const;
63
64 HttpMessagePair httpPair;
65 quint32 streamID = 0;
66 // Signed as window sizes can become negative:
67 qint32 sendWindow = 65535;
68 qint32 recvWindow = 65535;
69
70 StreamState state = idle;
71 QString key; // for PUSH_PROMISE
72};
73
74struct PushPromise
75{
76 quint32 reservedID = 0;
77 // PUSH_PROMISE has its own HEADERS,
78 // usually similar to what request has:
79 HPack::HttpHeader pushHeader;
80 // Response has its own (normal) HEADERS:
81 HPack::HttpHeader responseHeader;
82 // DATA frames on a promised stream:
83 std::vector<Frame> dataFrames;
84};
85
86} // namespace Http2
87
88QT_END_NAMESPACE
89
90#endif
91
92

source code of qtbase/src/network/access/http2/http2streams_p.h