Home / Class/ QuicheQuicSslEngine Class — netty Architecture

QuicheQuicSslEngine Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  e2b1e99a_c7f5_6131_4f6e_9152328bf145["QuicheQuicSslEngine"]
  f643bd0e_3633_f692_fa7e_09b3d32c33f5["QuicheQuicSslEngine.java"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|defined in| f643bd0e_3633_f692_fa7e_09b3d32c33f5
  12ff3b74_602b_712b_82f7_b20a571e3af0["QuicheQuicSslEngine()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| 12ff3b74_602b_712b_82f7_b20a571e3af0
  52ab2fa2_5ac8_441f_8717_8ae55b8ff3b6["moveTo()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| 52ab2fa2_5ac8_441f_8717_8ae55b8ff3b6
  080af0a6_84c3_1a77_884f_be8fd977d55a["QuicheQuicConnection()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| 080af0a6_84c3_1a77_884f_be8fd977d55a
  8565e1d5_3e86_6c60_f1f4_e734ba831586["setLocalCertificateChain()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| 8565e1d5_3e86_6c60_f1f4_e734ba831586
  172b9a6c_71fe_e651_32c6_0a904ca8bcee["isValidHostNameForSNI()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| 172b9a6c_71fe_e651_32c6_0a904ca8bcee
  c3abd309_49c0_9ce3_9574_a9fb2919fe9d["SSLParameters()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| c3abd309_49c0_9ce3_9574_a9fb2919fe9d
  d7b06cb2_50a0_ab8e_2732_fc560e28b67a["String()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| d7b06cb2_50a0_ab8e_2732_fc560e28b67a
  797c2fff_5cd2_eb36_eaca_252d5a27484a["SSLEngineResult()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| 797c2fff_5cd2_eb36_eaca_252d5a27484a
  91a5e12c_dbc9_3121_62eb_90d643b5f7b6["Runnable()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| 91a5e12c_dbc9_3121_62eb_90d643b5f7b6
  870be861_de0e_e86f_264f_10af99283db9["closeInbound()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| 870be861_de0e_e86f_264f_10af99283db9
  fdd8358c_2774_fbe6_02e7_737ddf4207d2["isInboundDone()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| fdd8358c_2774_fbe6_02e7_737ddf4207d2
  c93c4f3a_27f2_3674_ff88_a96c365c8c93["closeOutbound()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| c93c4f3a_27f2_3674_ff88_a96c365c8c93
  cc280722_4463_8932_8435_9b042fee110f["isOutboundDone()"]
  e2b1e99a_c7f5_6131_4f6e_9152328bf145 -->|method| cc280722_4463_8932_8435_9b042fee110f

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicSslEngine.java lines 47–594

final class QuicheQuicSslEngine extends QuicSslEngine {
    QuicheQuicSslContext ctx;
    private final String peerHost;
    private final int peerPort;
    private final QuicheQuicSslSession session = new QuicheQuicSslSession();
    private volatile Certificate[] localCertificateChain;
    private List<SNIServerName> sniHostNames;
    private boolean handshakeFinished;
    private String applicationProtocol;
    private boolean sessionReused;
    final String tlsHostName;
    volatile QuicheQuicConnection connection;

    volatile Consumer<String> sniSelectedCallback;

    QuicheQuicSslEngine(QuicheQuicSslContext ctx, @Nullable String peerHost, int peerPort) {
        this.ctx = ctx;
        this.peerHost = peerHost;
        this.peerPort = peerPort;
        // Use SNI if peerHost was specified and a valid hostname
        // See https://github.com/netty/netty/issues/4746
        if (ctx.isClient() && isValidHostNameForSNI(peerHost)) {
            tlsHostName = peerHost;
            sniHostNames = Collections.singletonList(new SNIHostName(tlsHostName));
        } else {
            tlsHostName = null;
        }
    }

    long moveTo(String hostname, QuicheQuicSslContext ctx) {
        // First of remove the engine from its previous QuicheQuicSslContext.
        this.ctx.remove(this);
        this.ctx = ctx;
        long added = ctx.add(this);
        Consumer<String> sniSelectedCallback = this.sniSelectedCallback;
        if (sniSelectedCallback != null) {
            sniSelectedCallback.accept(hostname);
        }
        return added;
    }

    @Nullable
    QuicheQuicConnection createConnection(LongFunction<Long> connectionCreator) {
        return ctx.createConnection(connectionCreator, this);
    }

    void setLocalCertificateChain(Certificate[] localCertificateChain) {
        this.localCertificateChain = localCertificateChain;
    }

    /**
     * Validate that the given hostname can be used in SNI extension.
     */
    static boolean isValidHostNameForSNI(@Nullable String hostname) {
        return hostname != null &&
                hostname.indexOf('.') > 0 &&
                !hostname.endsWith(".") &&
                !NetUtil.isValidIpV4Address(hostname) &&
                !NetUtil.isValidIpV6Address(hostname);
    }

    @Override
    public SSLParameters getSSLParameters() {
        SSLParameters parameters = super.getSSLParameters();
        parameters.setServerNames(sniHostNames);
        return parameters;
    }

    // These method will override the method defined by Java 8u251 and later. As we may compile with an earlier
    // java8 version we don't use @Override annotations here.
    public synchronized String getApplicationProtocol() {
        return applicationProtocol;
    }

    // These method will override the method defined by Java 8u251 and later. As we may compile with an earlier
    // java8 version we don't use @Override annotations here.
    public synchronized String getHandshakeApplicationProtocol() {
        return applicationProtocol;
    }

    @Override

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free