Home / Class/ Quiche Class — netty Architecture

Quiche Class — netty Architecture

Architecture documentation for the Quiche class in Quiche.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6971678f_642f_87e6_e277_8e03dc5756a8["Quiche"]
  2ecc49bf_4fb3_72e9_e6e8_3ed9b447ecbb["Quiche.java"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|defined in| 2ecc49bf_4fb3_72e9_e6e8_3ed9b447ecbb
  e609a2ba_993e_608c_ea8f_1db41d9bbce1["loadNativeLibrary()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| e609a2ba_993e_608c_ea8f_1db41d9bbce1
  4d82145c_cced_a1bc_cf21_d143f10e742f["String()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| 4d82145c_cced_a1bc_cf21_d143f10e742f
  67974e59_fcdf_6ed9_431f_95e24b38db7b["quiche_version_is_supported()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| 67974e59_fcdf_6ed9_431f_95e24b38db7b
  e4375f2b_ae4f_a7fd_b85e_7c1dd2d84177["quiche_negotiate_version()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| e4375f2b_ae4f_a7fd_b85e_7c1dd2d84177
  dc3c21fb_8901_df21_dc45_31c39629d1d4["quiche_retry()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| dc3c21fb_8901_df21_dc45_31c39629d1d4
  80715f0f_df9b_8d2b_78b7_575a939d7b86["quiche_conn_new_with_tls()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| 80715f0f_df9b_8d2b_78b7_575a939d7b86
  83b192a3_1c4d_3406_b580_43064f8865b4["quiche_conn_set_qlog_path()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| 83b192a3_1c4d_3406_b580_43064f8865b4
  e9d40f95_fd72_2938_a682_0af3d40aad37["quiche_conn_recv()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| e9d40f95_fd72_2938_a682_0af3d40aad37
  9c89d4a4_a173_125d_c581_f6a17b766e42["quiche_conn_send()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| 9c89d4a4_a173_125d_c581_f6a17b766e42
  44fbef82_2c8a_1a83_86eb_0d0dff0420b6["quiche_conn_free()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| 44fbef82_2c8a_1a83_86eb_0d0dff0420b6
  317a71bb_b3ba_508c_10f6_0e56030667a3["QuicConnectionCloseEvent()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| 317a71bb_b3ba_508c_10f6_0e56030667a3
  3fa9e6ec_f233_d191_aa2c_8fc53b2d0dde["quiche_conn_peer_error0()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| 3fa9e6ec_f233_d191_aa2c_8fc53b2d0dde
  528a367b_5f36_4da6_6765_821c1f0bb1bd["quiche_conn_peer_streams_left_bidi()"]
  6971678f_642f_87e6_e277_8e03dc5756a8 -->|method| 528a367b_5f36_4da6_6765_821c1f0bb1bd

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/Quiche.java lines 35–947

final class Quiche {
    private static final InternalLogger logger = InternalLoggerFactory.getInstance(Quiche.class);
    private static final boolean TRACE_LOGGING_ENABLED = logger.isTraceEnabled();
    private static final IntObjectHashMap<QuicTransportErrorHolder> ERROR_MAPPINGS = new IntObjectHashMap<>();

    static {
        // Preload all classes that will be used in the OnLoad(...) function of JNI to eliminate the possibility of a
        // class-loader deadlock. This is a workaround for https://github.com/netty/netty/issues/11209.

        // This needs to match all the classes that are loaded via NETTY_JNI_UTIL_LOAD_CLASS or looked up via
        // NETTY_JNI_UTIL_FIND_CLASS.
        ClassInitializerUtil.tryLoadClasses(Quiche.class,
                // netty_quic_boringssl
                byte[].class, String.class, BoringSSLCertificateCallback.class,
                BoringSSLCertificateVerifyCallback.class, BoringSSLHandshakeCompleteCallback.class,

                //netty_quic_quiche
                QuicheLogger.class
        );

        try {
            // First, try calling a side-effect free JNI method to see if the library was already
            // loaded by the application.
            quiche_version();
        } catch (UnsatisfiedLinkError ignore) {
            // The library was not previously loaded, load it now.
            loadNativeLibrary();
        }

        // Let's enable debug logging for quiche if the TRACE level is enabled in our logger.
        if (TRACE_LOGGING_ENABLED) {
            quiche_enable_debug_logging(new QuicheLogger(logger));
        }
    }

    private static void loadNativeLibrary() {
        // This needs to be kept in sync with what is defined in netty_quic_quiche.c
        // and pom.xml as jniLibPrefix.
        String libName = "netty_quiche42";
        ClassLoader cl = PlatformDependent.getClassLoader(Quiche.class);

        if (!PlatformDependent.isAndroid()) {
            libName += '_' + PlatformDependent.normalizedOs()
                    + '_' + PlatformDependent.normalizedArch();
        }

        try {
            NativeLibraryLoader.load(libName, cl);
        } catch (UnsatisfiedLinkError e) {
            logger.debug("Failed to load {}", libName, e);
            throw e;
        }
    }

    static final short AF_INET = (short) QuicheNativeStaticallyReferencedJniMethods.afInet();
    static final short AF_INET6 = (short) QuicheNativeStaticallyReferencedJniMethods.afInet6();
    static final int SIZEOF_SOCKADDR_STORAGE = QuicheNativeStaticallyReferencedJniMethods.sizeofSockaddrStorage();
    static final int SIZEOF_SOCKADDR_IN = QuicheNativeStaticallyReferencedJniMethods.sizeofSockaddrIn();
    static final int SIZEOF_SOCKADDR_IN6 = QuicheNativeStaticallyReferencedJniMethods.sizeofSockaddrIn6();
    static final int SOCKADDR_IN_OFFSETOF_SIN_FAMILY =
            QuicheNativeStaticallyReferencedJniMethods.sockaddrInOffsetofSinFamily();
    static final int SOCKADDR_IN_OFFSETOF_SIN_PORT =
            QuicheNativeStaticallyReferencedJniMethods.sockaddrInOffsetofSinPort();
    static final int SOCKADDR_IN_OFFSETOF_SIN_ADDR =
            QuicheNativeStaticallyReferencedJniMethods.sockaddrInOffsetofSinAddr();
    static final int IN_ADDRESS_OFFSETOF_S_ADDR = QuicheNativeStaticallyReferencedJniMethods.inAddressOffsetofSAddr();
    static final int SOCKADDR_IN6_OFFSETOF_SIN6_FAMILY =
            QuicheNativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6Family();
    static final int SOCKADDR_IN6_OFFSETOF_SIN6_PORT =
            QuicheNativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6Port();
    static final int SOCKADDR_IN6_OFFSETOF_SIN6_FLOWINFO =
            QuicheNativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6Flowinfo();
    static final int SOCKADDR_IN6_OFFSETOF_SIN6_ADDR =
            QuicheNativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6Addr();
    static final int SOCKADDR_IN6_OFFSETOF_SIN6_SCOPE_ID =
            QuicheNativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6ScopeId();
    static final int IN6_ADDRESS_OFFSETOF_S6_ADDR =
            QuicheNativeStaticallyReferencedJniMethods.in6AddressOffsetofS6Addr();
    static final int SIZEOF_SOCKLEN_T = QuicheNativeStaticallyReferencedJniMethods.sizeofSocklenT();
    static final int SIZEOF_SIZE_T = QuicheNativeStaticallyReferencedJniMethods.sizeofSizeT();

Frequently Asked Questions

What is the Quiche class?
Quiche is a class in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/Quiche.java.
Where is Quiche defined?
Quiche is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/Quiche.java at line 35.

Analyze Your Own Codebase

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

Try Supermodel Free