Home / Function/ decodeFrame() — netty Function Reference

decodeFrame() — netty Function Reference

Architecture documentation for the decodeFrame() function in Http3FrameCodec.java from the netty codebase.

Function java Buffer Allocators calls 4 called by 1

Entity Profile

Dependency Diagram

graph TD
  8b0697bd_1098_91ad_7558_7e1c678364c7["decodeFrame()"]
  57499e74_1040_f300_12bb_215179e108be["Http3FrameCodec"]
  8b0697bd_1098_91ad_7558_7e1c678364c7 -->|defined in| 57499e74_1040_f300_12bb_215179e108be
  a9991e7a_1e1e_f455_19bd_4771a0c28625["decode()"]
  a9991e7a_1e1e_f455_19bd_4771a0c28625 -->|calls| 8b0697bd_1098_91ad_7558_7e1c678364c7
  d0f8d7ea_8076_8153_91a0_088e231e99a1["skipBytes()"]
  8b0697bd_1098_91ad_7558_7e1c678364c7 -->|calls| d0f8d7ea_8076_8153_91a0_088e231e99a1
  40fb57c4_f85d_87ad_ac47_bdfc5af1b6d8["enforceMaxPayloadLength()"]
  8b0697bd_1098_91ad_7558_7e1c678364c7 -->|calls| 40fb57c4_f85d_87ad_ac47_bdfc5af1b6d8
  a494429d_99b3_b9af_835d_5ed99ff53bf4["suspended()"]
  8b0697bd_1098_91ad_7558_7e1c678364c7 -->|calls| a494429d_99b3_b9af_835d_5ed99ff53bf4
  83ad0216_00d7_4331_dd41_48405f09786c["decodeHeaders()"]
  8b0697bd_1098_91ad_7558_7e1c678364c7 -->|calls| 83ad0216_00d7_4331_dd41_48405f09786c
  style 8b0697bd_1098_91ad_7558_7e1c678364c7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/Http3FrameCodec.java lines 220–343

    private int decodeFrame(ChannelHandlerContext ctx, long longType, int payLoadLength, ByteBuf in, List<Object> out) {
        if (longType > Integer.MAX_VALUE && !Http3CodecUtils.isReservedFrameType(longType)) {
            return skipBytes(in, payLoadLength);
        }
        int type = (int) longType;
        // See https://tools.ietf.org/html/draft-ietf-quic-http-32#section-11.2.1
        switch (type) {
            case HTTP3_DATA_FRAME_TYPE:
                // DATA
                // https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.1
                int readable = in.readableBytes();
                if (readable == 0 && payLoadLength > 0) {
                    return 0;
                }
                int length = Math.min(readable, payLoadLength);
                out.add(new DefaultHttp3DataFrame(in.readRetainedSlice(length)));
                return length;
            case HTTP3_HEADERS_FRAME_TYPE:
                // HEADERS
                // https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.2
                if (!enforceMaxPayloadLength(ctx, in, type, payLoadLength,
                        // Let's use the maxHeaderListSize as a limit as this is this is the decompressed amounts of
                        // bytes which means the once we decompressed the headers we will be bigger then the actual
                        // payload size now.
                        maxHeaderListSize, Http3ErrorCode.H3_EXCESSIVE_LOAD)) {
                    return 0;
                }
                assert qpackAttributes != null;
                if (!qpackAttributes.dynamicTableDisabled() && !qpackAttributes.decoderStreamAvailable()) {
                    assert readResumptionListener != null;
                    readResumptionListener.suspended();
                    return 0;
                }

                Http3HeadersFrame headersFrame = new DefaultHttp3HeadersFrame();
                if (decodeHeaders(ctx, headersFrame.headers(), in, payLoadLength, decodeState.receivedFinalHeaders())) {
                    out.add(headersFrame);
                    return payLoadLength;
                }
                return -1;
            case HTTP3_CANCEL_PUSH_FRAME_TYPE:
                // CANCEL_PUSH
                // https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.3
                if (!enforceMaxPayloadLength(ctx, in, type, payLoadLength,
                        HTTP3_CANCEL_PUSH_FRAME_MAX_LEN, Http3ErrorCode.H3_FRAME_ERROR)) {
                    return 0;
                }
                int pushIdLen = numBytesForVariableLengthInteger(in.getByte(in.readerIndex()));
                out.add(new DefaultHttp3CancelPushFrame(readVariableLengthInteger(in, pushIdLen)));
                return payLoadLength;
            case HTTP3_SETTINGS_FRAME_TYPE:
                // SETTINGS
                // https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.4

                // Use 256 as this gives space for 16 maximal size encoder and 128 minimal size encoded settings.
                if (!enforceMaxPayloadLength(ctx, in, type, payLoadLength, HTTP3_SETTINGS_FRAME_MAX_LEN,
                        Http3ErrorCode.H3_EXCESSIVE_LOAD)) {
                    return 0;
                }
                Http3SettingsFrame settingsFrame = decodeSettings(ctx, in, payLoadLength);
                if (settingsFrame != null) {
                    out.add(settingsFrame);
                }
                return payLoadLength;
            case HTTP3_PUSH_PROMISE_FRAME_TYPE:
                // PUSH_PROMISE
                // https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.5
                if (!enforceMaxPayloadLength(ctx, in, type, payLoadLength,
                        // Let's use the maxHeaderListSize as a limit as this is this is the decompressed amounts of
                        // bytes which means the once we decompressed the headers we will be bigger then the actual
                        // payload size now.
                        Math.max(maxHeaderListSize, maxHeaderListSize + 8), Http3ErrorCode.H3_EXCESSIVE_LOAD)) {
                    return 0;
                }

                assert qpackAttributes != null;
                if (!qpackAttributes.dynamicTableDisabled() && !qpackAttributes.decoderStreamAvailable()) {
                    assert readResumptionListener != null;
                    readResumptionListener.suspended();
                    return 0;
                }

Domain

Subdomains

Called By

Frequently Asked Questions

What does decodeFrame() do?
decodeFrame() is a function in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3FrameCodec.java.
Where is decodeFrame() defined?
decodeFrame() is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3FrameCodec.java at line 220.
What does decodeFrame() call?
decodeFrame() calls 4 function(s): decodeHeaders, enforceMaxPayloadLength, skipBytes, suspended.
What calls decodeFrame()?
decodeFrame() is called by 1 function(s): decode.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free