Home / Function/ setEnabledProtocols0() — netty Function Reference

setEnabledProtocols0() — netty Function Reference

Architecture documentation for the setEnabledProtocols0() function in ReferenceCountedOpenSslEngine.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5b5b0a36_7b14_f201_640d_10be2c52c8e3["setEnabledProtocols0()"]
  df1ad81e_e5bf_85e6_4418_db301b4c3e66["ReferenceCountedOpenSslEngine"]
  5b5b0a36_7b14_f201_640d_10be2c52c8e3 -->|defined in| df1ad81e_e5bf_85e6_4418_db301b4c3e66
  6a44e3b1_de89_d0c1_af8e_b0ae68fa3b64["setEnabledCipherSuites()"]
  6a44e3b1_de89_d0c1_af8e_b0ae68fa3b64 -->|calls| 5b5b0a36_7b14_f201_640d_10be2c52c8e3
  2f49c5ea_7d60_da8f_2d32_72e4e8958e9e["setEnabledProtocols()"]
  2f49c5ea_7d60_da8f_2d32_72e4e8958e9e -->|calls| 5b5b0a36_7b14_f201_640d_10be2c52c8e3
  style 5b5b0a36_7b14_f201_640d_10be2c52c8e3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java lines 1802–1861

    private void setEnabledProtocols0(String[] protocols, boolean explicitDisableTLSv13) {
        assert Thread.holdsLock(this);
        // This is correct from the API docs
        int minProtocolIndex = OPENSSL_OP_NO_PROTOCOLS.length;
        int maxProtocolIndex = 0;
        for (String protocol : protocols) {
            if (!OpenSsl.isProtocolSupported(protocol)) {
                throw new IllegalArgumentException("Protocol " + protocol + " is not supported.");
            }

            int index;
            switch (protocol) {
                case SslProtocols.SSL_v2:
                    index = OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV2;
                    break;
                case SslProtocols.SSL_v3:
                    index = OPENSSL_OP_NO_PROTOCOL_INDEX_SSLV3;
                    break;
                case SslProtocols.TLS_v1:
                    index = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1;
                    break;
                case SslProtocols.TLS_v1_1:
                    index = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_1;
                    break;
                case SslProtocols.TLS_v1_2:
                    index = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_2;
                    break;
                case SslProtocols.TLS_v1_3:
                    if (explicitDisableTLSv13) {
                        continue;
                    }
                    index = OPENSSL_OP_NO_PROTOCOL_INDEX_TLSv1_3;
                    break;
                default:
                    continue; // Should not happen due to SUPPORTED_PROTOCOLS_SET check
            }

            minProtocolIndex = Math.min(minProtocolIndex, index);
            maxProtocolIndex = Math.max(maxProtocolIndex, index);
        }

        if (destroyed) {
            throw new IllegalStateException("failed to enable protocols: " + Arrays.asList(protocols));
        }

        SSL.clearOptions(ssl, SSL.SSL_OP_NO_SSLv2 | SSL.SSL_OP_NO_SSLv3 |
                SSL.SSL_OP_NO_TLSv1 | SSL.SSL_OP_NO_TLSv1_1 |
                SSL.SSL_OP_NO_TLSv1_2 | SSL.SSL_OP_NO_TLSv1_3);

        int opts = 0;
        for (int i = 0; i < minProtocolIndex; ++i) {
            opts |= OPENSSL_OP_NO_PROTOCOLS[i];
        }
        assert maxProtocolIndex != MAX_VALUE;
        for (int i = maxProtocolIndex + 1; i < OPENSSL_OP_NO_PROTOCOLS.length; ++i) {
            opts |= OPENSSL_OP_NO_PROTOCOLS[i];
        }

        SSL.setOptions(ssl, opts);
    }

Domain

Subdomains

Frequently Asked Questions

What does setEnabledProtocols0() do?
setEnabledProtocols0() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java.
Where is setEnabledProtocols0() defined?
setEnabledProtocols0() is defined in handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java at line 1802.
What calls setEnabledProtocols0()?
setEnabledProtocols0() is called by 2 function(s): setEnabledCipherSuites, setEnabledProtocols.

Analyze Your Own Codebase

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

Try Supermodel Free