1 /*
2 * Copyright 2014 The Netty Project
3 *
4 * The Netty Project licenses this file to you under the Apache License, version 2.0 (the
5 * "License"); you may not use this file except in compliance with the License. You may obtain a
6 * 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 distributed under the License
11 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing permissions and limitations under
13 * the License.
14 */
15 package io.netty.handler.codec.http2;
16
17 import io.netty.buffer.ByteBuf;
18 import io.netty.channel.ChannelFuture;
19 import io.netty.channel.ChannelHandlerContext;
20 import io.netty.channel.ChannelPromise;
21 import io.netty.util.internal.UnstableApi;
22
23
24 /**
25 * Handler for outbound HTTP/2 traffic.
26 */
27 @UnstableApi
28 public interface Http2ConnectionEncoder extends Http2FrameWriter {
29
30 /**
31 * Sets the lifecycle manager. Must be called as part of initialization before the encoder is used.
32 */
33 void lifecycleManager(Http2LifecycleManager lifecycleManager);
34
35 /**
36 * Provides direct access to the underlying connection.
37 */
38 Http2Connection connection();
39
40 /**
41 * Provides the remote flow controller for managing outbound traffic.
42 */
43 Http2RemoteFlowController flowController();
44
45 /**
46 * Provides direct access to the underlying frame writer object.
47 */
48 Http2FrameWriter frameWriter();
49
50 /**
51 * Gets the local settings on the top of the queue that has been sent but not ACKed. This may
52 * return {@code null}.
53 */
54 Http2Settings pollSentSettings();
55
56 /**
57 * Sets the settings for the remote endpoint of the HTTP/2 connection.
58 */
59 void remoteSettings(Http2Settings settings) throws Http2Exception;
60
61 /**
62 * Writes the given data to the internal {@link Http2FrameWriter} without performing any
63 * state checks on the connection/stream.
64 */
65 @Override
66 ChannelFuture writeFrame(ChannelHandlerContext ctx, byte frameType, int streamId,
67 Http2Flags flags, ByteBuf payload, ChannelPromise promise);
68 }