1 /*
2 * Copyright 2021 The Netty Project
3 *
4 * The Netty Project licenses this file to you under the Apache License,
5 * version 2.0 (the "License"); you may not use this file except in compliance
6 * with the License. You may obtain a copy of the License at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations
14 * under the License.
15 */
16 package io.netty.handler.codec.http3;
17
18 /**
19 * State of encoding or decoding for a stream following the <a
20 * href="https://quicwg.org/base-drafts/draft-ietf-quic-http.html#name-http-message-exchanges">
21 * HTTP message exchange semantics</a>
22 */
23 interface Http3RequestStreamCodecState {
24 /**
25 * An implementation of {@link Http3RequestStreamCodecState} that managed no state.
26 */
27 Http3RequestStreamCodecState NO_STATE = new Http3RequestStreamCodecState() {
28 @Override
29 public boolean started() {
30 return false;
31 }
32
33 @Override
34 public boolean receivedFinalHeaders() {
35 return false;
36 }
37
38 @Override
39 public boolean terminated() {
40 return false;
41 }
42 };
43
44 /**
45 * If any {@link Http3HeadersFrame} or {@link Http3DataFrame} has been received/sent on this stream.
46 *
47 * @return {@code true} if any {@link Http3HeadersFrame} or {@link Http3DataFrame} has been received/sent on this
48 * stream.
49 */
50 boolean started();
51
52 /**
53 * If a final {@link Http3HeadersFrame} has been received/sent before {@link Http3DataFrame} starts.
54 *
55 * @return {@code true} if a final {@link Http3HeadersFrame} has been received/sent before {@link Http3DataFrame}
56 * starts
57 */
58 boolean receivedFinalHeaders();
59
60 /**
61 * If no more frames are expected on this stream.
62 *
63 * @return {@code true} if no more frames are expected on this stream.
64 */
65 boolean terminated();
66 }