Home / Function/ decode() — netty Function Reference

decode() — netty Function Reference

Architecture documentation for the decode() function in SocksAuthRequestDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f8c54faf_fc3a_e71a_60d8_bdb8a1847e93["decode()"]
  10830add_a048_4d89_ea74_df19b3a40e95["SocksAuthRequestDecoder"]
  f8c54faf_fc3a_e71a_60d8_bdb8a1847e93 -->|defined in| 10830add_a048_4d89_ea74_df19b3a40e95
  style f8c54faf_fc3a_e71a_60d8_bdb8a1847e93 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java lines 39–65

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf byteBuf, List<Object> out) throws Exception {
        switch (state()) {
            case CHECK_PROTOCOL_VERSION: {
                if (byteBuf.readByte() != SocksSubnegotiationVersion.AUTH_PASSWORD.byteValue()) {
                    out.add(SocksCommonUtils.UNKNOWN_SOCKS_REQUEST);
                    break;
                }
                checkpoint(State.READ_USERNAME);
            }
            case READ_USERNAME: {
                int fieldLength = byteBuf.readByte();
                username = byteBuf.readString(fieldLength, CharsetUtil.US_ASCII);
                checkpoint(State.READ_PASSWORD);
            }
            case READ_PASSWORD: {
                int fieldLength = byteBuf.readByte();
                String password = byteBuf.readString(fieldLength, CharsetUtil.US_ASCII);
                out.add(new SocksAuthRequest(username, password));
                break;
            }
            default: {
                throw new Error("Unexpected request decoder state: " + state());
            }
        }
        ctx.pipeline().remove(this);
    }

Domain

Subdomains

Frequently Asked Questions

What does decode() do?
decode() is a function in the netty codebase, defined in codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java.
Where is decode() defined?
decode() is defined in codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java at line 39.

Analyze Your Own Codebase

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

Try Supermodel Free