Home / Type/ AddressFamily Type — netty Architecture

AddressFamily Type — netty Architecture

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyProxiedProtocol.java lines 121–180

    public enum AddressFamily {
        /**
         * The UNSPECIFIED address family represents a connection which was forwarded for an unknown protocol.
         */
        AF_UNSPEC(AF_UNSPEC_BYTE),
        /**
         * The IPV4 address family represents a connection which was forwarded for an IPV4 client.
         */
        AF_IPv4(AF_IPV4_BYTE),
        /**
         * The IPV6 address family represents a connection which was forwarded for an IPV6 client.
         */
        AF_IPv6(AF_IPV6_BYTE),
        /**
         * The UNIX address family represents a connection which was forwarded for a unix socket.
         */
        AF_UNIX(AF_UNIX_BYTE);

        /**
         * The highest 4 bits of the transport protocol and address family byte contain the address family
         */
        private static final byte FAMILY_MASK = (byte) 0xf0;

        private final byte byteValue;

        /**
         * Creates a new instance
         */
        AddressFamily(byte byteValue) {
            this.byteValue = byteValue;
        }

        /**
         * Returns the {@link AddressFamily} represented by the highest 4 bits of the specified byte.
         *
         * @param tpafByte transport protocol and address family byte
         */
        public static AddressFamily valueOf(byte tpafByte) {
            int addressFamily = tpafByte & FAMILY_MASK;
            switch((byte) addressFamily) {
                case AF_IPV4_BYTE:
                    return AF_IPv4;
                case AF_IPV6_BYTE:
                    return AF_IPv6;
                case AF_UNSPEC_BYTE:
                    return AF_UNSPEC;
                case AF_UNIX_BYTE:
                    return AF_UNIX;
                default:
                    throw new IllegalArgumentException("unknown address family: " + addressFamily);
            }
        }

        /**
         * Returns the byte value of this address family.
         */
        public byte byteValue() {
            return byteValue;
        }
    }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free