Home / Type/ TransportProtocol Type — netty Architecture

TransportProtocol Type — netty Architecture

Architecture documentation for the TransportProtocol type/interface in HAProxyProxiedProtocol.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6ea9777b_f4fb_90ee_e734_7f59e7bc5f35["TransportProtocol"]
  0efc4e1b_d36e_10e2_7949_06352f7fb11d["HAProxyProxiedProtocol.java"]
  6ea9777b_f4fb_90ee_e734_7f59e7bc5f35 -->|defined in| 0efc4e1b_d36e_10e2_7949_06352f7fb11d
  style 6ea9777b_f4fb_90ee_e734_7f59e7bc5f35 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyProxiedProtocol.java lines 185–238

    public enum TransportProtocol {
        /**
         * The UNSPEC transport protocol represents a connection which was forwarded for an unknown protocol.
         */
        UNSPEC(TRANSPORT_UNSPEC_BYTE),
        /**
         * The STREAM transport protocol represents a connection which was forwarded for a TCP connection.
         */
        STREAM(TRANSPORT_STREAM_BYTE),
        /**
         * The DGRAM transport protocol represents a connection which was forwarded for a UDP connection.
         */
        DGRAM(TRANSPORT_DGRAM_BYTE);

        /**
         * The transport protocol is specified in the lowest 4 bits of the transport protocol and address family byte
         */
        private static final byte TRANSPORT_MASK = 0x0f;

        private final byte transportByte;

        /**
         * Creates a new instance.
         */
        TransportProtocol(byte transportByte) {
            this.transportByte = transportByte;
        }

        /**
         * Returns the {@link TransportProtocol} represented by the lowest 4 bits of the specified byte.
         *
         * @param tpafByte transport protocol and address family byte
         */
        public static TransportProtocol valueOf(byte tpafByte) {
            int transportProtocol = tpafByte & TRANSPORT_MASK;
            switch ((byte) transportProtocol) {
                case TRANSPORT_STREAM_BYTE:
                    return STREAM;
                case TRANSPORT_UNSPEC_BYTE:
                    return UNSPEC;
                case TRANSPORT_DGRAM_BYTE:
                    return DGRAM;
                default:
                    throw new IllegalArgumentException("unknown transport protocol: " + transportProtocol);
            }
        }

        /**
         * Returns the byte value of this transport protocol.
         */
        public byte byteValue() {
            return transportByte;
        }
    }

Frequently Asked Questions

What is the TransportProtocol type?
TransportProtocol is a type/interface in the netty codebase, defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyProxiedProtocol.java.
Where is TransportProtocol defined?
TransportProtocol is defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyProxiedProtocol.java at line 185.

Analyze Your Own Codebase

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

Try Supermodel Free