HAProxyTLV() — netty Function Reference
Architecture documentation for the HAProxyTLV() function in HAProxyMessage.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 4611fb06_1e41_b734_d613_ca7390c93910["HAProxyTLV()"] 086e8ebe_0b5c_c158_91d0_e3710503e584["HAProxyMessage"] 4611fb06_1e41_b734_d613_ca7390c93910 -->|defined in| 086e8ebe_0b5c_c158_91d0_e3710503e584 style 4611fb06_1e41_b734_d613_ca7390c93910 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java lines 263–309
private static HAProxyTLV readNextTLV(final ByteBuf header, int nestingLevel) {
if (nestingLevel > MAX_NESTING_LEVEL) {
throw new HAProxyProtocolException(
"Maximum TLV nesting level reached: " + nestingLevel + " (expected: < " + MAX_NESTING_LEVEL + ')');
}
// We need at least 4 bytes for a TLV
if (header.readableBytes() < 4) {
return null;
}
final byte typeAsByte = header.readByte();
final HAProxyTLV.Type type = HAProxyTLV.Type.typeForByteValue(typeAsByte);
final int length = header.readUnsignedShort();
switch (type) {
case PP2_TYPE_SSL:
final ByteBuf rawContent = header.retainedSlice(header.readerIndex(), length);
final ByteBuf byteBuf = header.readSlice(length);
final byte client = byteBuf.readByte();
final int verify = byteBuf.readInt();
if (byteBuf.readableBytes() >= 4) {
final List<HAProxyTLV> encapsulatedTlvs = new ArrayList<HAProxyTLV>(4);
do {
final HAProxyTLV haProxyTLV = readNextTLV(byteBuf, nestingLevel + 1);
if (haProxyTLV == null) {
break;
}
encapsulatedTlvs.add(haProxyTLV);
} while (byteBuf.readableBytes() >= 4);
return new HAProxySSLTLV(verify, client, encapsulatedTlvs, rawContent);
}
return new HAProxySSLTLV(verify, client, Collections.<HAProxyTLV>emptyList(), rawContent);
// If we're not dealing with an SSL Type, we can use the same mechanism
case PP2_TYPE_ALPN:
case PP2_TYPE_AUTHORITY:
case PP2_TYPE_SSL_VERSION:
case PP2_TYPE_SSL_CN:
case PP2_TYPE_NETNS:
case OTHER:
return new HAProxyTLV(type, typeAsByte, header.readRetainedSlice(length));
default:
return null;
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does HAProxyTLV() do?
HAProxyTLV() is a function in the netty codebase, defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java.
Where is HAProxyTLV() defined?
HAProxyTLV() is defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java at line 263.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free