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.netty5.handler.codec.http2; 16 17 import io.netty5.buffer.api.Buffer; 18 import io.netty5.channel.ChannelHandlerContext; 19 import io.netty5.util.concurrent.Future; 20 import io.netty5.util.internal.UnstableApi; 21 22 /** 23 * Handler for outbound HTTP/2 traffic. 24 */ 25 @UnstableApi 26 public interface Http2ConnectionEncoder extends Http2FrameWriter { 27 28 /** 29 * Sets the lifecycle manager. Must be called as part of initialization before the encoder is used. 30 */ 31 void lifecycleManager(Http2LifecycleManager lifecycleManager); 32 33 /** 34 * Provides direct access to the underlying connection. 35 */ 36 Http2Connection connection(); 37 38 /** 39 * Provides the remote flow controller for managing outbound traffic. 40 */ 41 Http2RemoteFlowController flowController(); 42 43 /** 44 * Provides direct access to the underlying frame writer object. 45 */ 46 Http2FrameWriter frameWriter(); 47 48 /** 49 * Gets the local settings on the top of the queue that has been sent but not ACKed. This may 50 * return {@code null}. 51 */ 52 Http2Settings pollSentSettings(); 53 54 /** 55 * Sets the settings for the remote endpoint of the HTTP/2 connection. 56 */ 57 void remoteSettings(Http2Settings settings) throws Http2Exception; 58 59 /** 60 * Writes the given data to the internal {@link Http2FrameWriter} without performing any 61 * state checks on the connection/stream. 62 */ 63 @Override 64 Future<Void> writeFrame(ChannelHandlerContext ctx, byte frameType, int streamId, 65 Http2Flags flags, Buffer payload); 66 }