Home / Class/ WebSocket08FrameDecoder Class — netty Architecture

WebSocket08FrameDecoder Class — netty Architecture

Architecture documentation for the WebSocket08FrameDecoder class in WebSocket08FrameDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c9b44ce3_48da_97b4_c171_21f4f8367ad8["WebSocket08FrameDecoder"]
  13af57bf_0c37_4c6b_a621_51eb1b1f8b6b["WebSocket08FrameDecoder.java"]
  c9b44ce3_48da_97b4_c171_21f4f8367ad8 -->|defined in| 13af57bf_0c37_4c6b_a621_51eb1b1f8b6b
  15b92907_40aa_cf6d_986c_c8c34dc75249["WebSocket08FrameDecoder()"]
  c9b44ce3_48da_97b4_c171_21f4f8367ad8 -->|method| 15b92907_40aa_cf6d_986c_c8c34dc75249
  0cc1f80d_2de8_eba7_1c1b_044be6cac6ba["decode()"]
  c9b44ce3_48da_97b4_c171_21f4f8367ad8 -->|method| 0cc1f80d_2de8_eba7_1c1b_044be6cac6ba
  eae6aaf4_a2cd_080e_53f7_5c3107c8c81a["unmask()"]
  c9b44ce3_48da_97b4_c171_21f4f8367ad8 -->|method| eae6aaf4_a2cd_080e_53f7_5c3107c8c81a
  052c117e_18bc_0a73_ffad_e40824a99630["protocolViolation()"]
  c9b44ce3_48da_97b4_c171_21f4f8367ad8 -->|method| 052c117e_18bc_0a73_ffad_e40824a99630
  1cbe5772_a8f4_98b0_b431_993c17d078a7["toFrameLength()"]
  c9b44ce3_48da_97b4_c171_21f4f8367ad8 -->|method| 1cbe5772_a8f4_98b0_b431_993c17d078a7
  f1364653_ca1d_d1d2_a507_8c02eba374f5["checkCloseFrameBody()"]
  c9b44ce3_48da_97b4_c171_21f4f8367ad8 -->|method| f1364653_ca1d_d1d2_a507_8c02eba374f5

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java lines 75–492

public class WebSocket08FrameDecoder extends ByteToMessageDecoder
        implements WebSocketFrameDecoder {

    enum State {
        READING_FIRST,
        READING_SECOND,
        READING_SIZE,
        MASKING_KEY,
        PAYLOAD,
        CORRUPT
    }

    private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket08FrameDecoder.class);

    private static final byte OPCODE_CONT = 0x0;
    private static final byte OPCODE_TEXT = 0x1;
    private static final byte OPCODE_BINARY = 0x2;
    private static final byte OPCODE_CLOSE = 0x8;
    private static final byte OPCODE_PING = 0x9;
    private static final byte OPCODE_PONG = 0xA;

    private final WebSocketDecoderConfig config;

    private int fragmentedFramesCount;
    private boolean frameFinalFlag;
    private boolean frameMasked;
    private int frameRsv;
    private int frameOpcode;
    private long framePayloadLength;
    private int mask;
    private int framePayloadLen1;
    private boolean receivedClosingHandshake;
    private State state = State.READING_FIRST;

    /**
     * Constructor
     *
     * @param expectMaskedFrames
     *            Web socket servers must set this to true processed incoming masked payload. Client implementations
     *            must set this to false.
     * @param allowExtensions
     *            Flag to allow reserved extension bits to be used or not
     * @param maxFramePayloadLength
     *            Maximum length of a frame's payload. Setting this to an appropriate value for you application
     *            helps check for denial of services attacks.
     */
    public WebSocket08FrameDecoder(boolean expectMaskedFrames, boolean allowExtensions, int maxFramePayloadLength) {
        this(expectMaskedFrames, allowExtensions, maxFramePayloadLength, false);
    }

    /**
     * Constructor
     *
     * @param expectMaskedFrames
     *            Web socket servers must set this to true processed incoming masked payload. Client implementations
     *            must set this to false.
     * @param allowExtensions
     *            Flag to allow reserved extension bits to be used or not
     * @param maxFramePayloadLength
     *            Maximum length of a frame's payload. Setting this to an appropriate value for you application
     *            helps check for denial of services attacks.
     * @param allowMaskMismatch
     *            When set to true, frames which are not masked properly according to the standard will still be
     *            accepted.
     */
    public WebSocket08FrameDecoder(boolean expectMaskedFrames, boolean allowExtensions, int maxFramePayloadLength,
                                   boolean allowMaskMismatch) {
        this(WebSocketDecoderConfig.newBuilder()
            .expectMaskedFrames(expectMaskedFrames)
            .allowExtensions(allowExtensions)
            .maxFramePayloadLength(maxFramePayloadLength)
            .allowMaskMismatch(allowMaskMismatch)
            .build());
    }

    /**
     * Constructor
     *
     * @param decoderConfig
     *            Frames decoder configuration.
     */

Frequently Asked Questions

What is the WebSocket08FrameDecoder class?
WebSocket08FrameDecoder is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java.
Where is WebSocket08FrameDecoder defined?
WebSocket08FrameDecoder is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java at line 75.

Analyze Your Own Codebase

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

Try Supermodel Free