Top Description Inners Fields Constructors Methods
io.netty.contrib.handler.codec.socksx.v4

public Class Socks4ServerDecoder

extends ByteToMessageDecoder
Class Inheritance
Imports
io.netty5.buffer.Buffer, io.netty5.channel.ChannelHandlerContext, io.netty5.handler.codec.ByteToMessageDecoder, .DecoderException, .DecoderResult, io.netty.contrib.handler.codec.socksx.SocksVersion, java.nio.charset.StandardCharsets, io.netty5.util.NetUtil

Decodes a single Socks4CommandRequest from the inbound Buffers. On successful decode, this decoder will forward the received data to the next handler, so that other handler can remove this decoder later. On failed decode, this decoder will discard the received data, so that other handler closes the connection later.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private String
private int
private static final int
private Socks4ServerDecoder.State
private Socks4CommandType
private String
Inherited from io.netty5.handler.codec.ByteToMessageDecoder:
COMPOSITE_CUMULATORMERGE_CUMULATOR

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
decode(ChannelHandlerContext ctx, Buffer
the Buffer from which to read data
in
)

Implements abstract io.netty5.handler.codec.ByteToMessageDecoder.decode.

Decode the from one Buffer to another.
private void
private static String
readString(String fieldName, Buffer in)

Reads a variable-length NUL-terminated string as defined in SOCKS4.

Inherited from io.netty5.handler.codec.ByteToMessageDecoder:
actualReadableByteschannelInactivechannelReadchannelReadCompletechannelShutdowndecodeLastdiscardSomeReadByteshandlerAddedhandlerAdded0handlerRemovedhandlerRemoved0internalBufferisSharableisSingleDecodesetSingleDecode

Field Detail

dstAddrback to summary
private String dstAddr
dstPortback to summary
private int dstPort
MAX_FIELD_LENGTHback to summary
private static final int MAX_FIELD_LENGTH
stateback to summary
private Socks4ServerDecoder.State state
typeback to summary
private Socks4CommandType type
userIdback to summary
private String userId

Constructor Detail

Socks4ServerDecoderback to summary
public Socks4ServerDecoder()

Method Detail

decodeback to summary
protected void decode(ChannelHandlerContext ctx, Buffer in) throws Exception

Implements abstract io.netty5.handler.codec.ByteToMessageDecoder.decode.

Doc from io.netty5.handler.codec.ByteToMessageDecoder.decode.

Decode the from one Buffer to another. This method will be called till either the input Buffer has nothing to read when return from this method or till nothing was read from the input Buffer.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this ByteToMessageDecoder belongs to

in:Buffer

the Buffer from which to read data

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
failback to summary
private void fail(ChannelHandlerContext ctx, Exception cause)
readStringback to summary
private static String readString(String fieldName, Buffer in)

Reads a variable-length NUL-terminated string as defined in SOCKS4.

io.netty.contrib.handler.codec.socksx.v4 back to summary

private final Enum Socks4ServerDecoder.State

extends Enum<Socks4ServerDecoder.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Socks4ServerDecoder.State
public static final Socks4ServerDecoder.State
public static final Socks4ServerDecoder.State
public static final Socks4ServerDecoder.State
public static final Socks4ServerDecoder.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Socks4ServerDecoder.State
public static Socks4ServerDecoder.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

FAILUREback to summary
public static final Socks4ServerDecoder.State FAILURE
READ_DOMAINback to summary
public static final Socks4ServerDecoder.State READ_DOMAIN
READ_USERIDback to summary
public static final Socks4ServerDecoder.State READ_USERID
STARTback to summary
public static final Socks4ServerDecoder.State START
SUCCESSback to summary
public static final Socks4ServerDecoder.State SUCCESS

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static Socks4ServerDecoder.State valueOf(String name)
valuesback to summary
public static Socks4ServerDecoder.State[] values()