All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.couchbase.client.core.deps.io.netty.internal.tcnative.SSLSession Maven / Gradle / Ivy

There is a newer version: 3.7.2
Show newest version
/*
 * Copyright 2020 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package com.couchbase.client.core.deps.io.netty.internal.tcnative;

/**
 * Methods to operate on a {@code SSL_SESSION}.
 */
public final class SSLSession {

    private SSLSession() { }
    
    /**
     * See SSL_SESSION_get_time.
     *
     * @param session the SSL_SESSION instance (SSL_SESSION *)
     * @return returns the time at which the session was established. The time is given in seconds since the Epoch
     */
    public static native long getTime(long session);

    /**
     * See SSL_SESSION_get_timeout.
     *
     * @param session the SSL_SESSION instance (SSL_SESSION *)
     * @return returns the timeout for the session. The time is given in seconds since the Epoch
     */
    public static native long getTimeout(long session);

    /**
     * See SSL_SESSION_set_timeout.
     * 
     * @param session the SSL_SESSION instance (SSL_SESSION *)
     * @param seconds timeout in seconds
     * @return returns the timeout for the session before this call. The time is given in seconds since the Epoch
     */
    public static native long setTimeout(long session, long seconds);

    /**
     * See SSL_SESSION_get_id.
     *
     * @param session the SSL_SESSION instance (SSL_SESSION *)
     * @return the session id as byte array representation obtained via SSL_SESSION_get_id.
     */
    public static native byte[] getSessionId(long session);

    /**
     * See SSL_SESSION_up_ref.
     *
     * @param session the SSL_SESSION instance (SSL_SESSION *)
     * @return {@code true} if successful, {@code false} otherwise. 
     */
    public static native boolean upRef(long session);

     /**
     * See SSL_SESSION_free.
     *
     * @param session the SSL_SESSION instance (SSL_SESSION *)
     */
    public static native void free(long session);

    /**
     * Will return {@code true} if the session should only re-used once.
     * See SSL_SESSION_should_be_single_use. 
     * @param session
     * @return {@code true} if the session should be re-used once only, {@code false} otherwise.
     */
    public static native boolean shouldBeSingleUse(long session);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy