Commit 4830f5bb authored by Alex Gaynor's avatar Alex Gaynor
Browse files

Expose `SslMethod::{dtls_client,dtls_server}`

parent bab03c40
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -701,6 +701,10 @@ cfg_if! {
            pub fn TLS_server_method() -> *const SSL_METHOD;

            pub fn TLS_client_method() -> *const SSL_METHOD;

            pub fn DTLS_server_method() -> *const SSL_METHOD;

            pub fn DTLS_client_method() -> *const SSL_METHOD;
        }
    } else {
        extern "C" {
+15 −1
Original line number Diff line number Diff line
@@ -364,6 +364,20 @@ impl SslMethod {
        unsafe { SslMethod(TLS_server_method()) }
    }

    /// Support all versions of the DTLS protocol, explicitly as a client.
    #[corresponds(DTLS_client_method)]
    #[cfg(any(boringssl, ossl110, libressl291))]
    pub fn dtls_client() -> SslMethod {
        unsafe { SslMethod(DTLS_client_method()) }
    }

    /// Support all versions of the DTLS protocol, explicitly as a server.
    #[corresponds(DTLS_method)]
    #[cfg(any(boringssl, ossl110, libressl291))]
    pub fn dtls_server() -> SslMethod {
        unsafe { SslMethod(DTLS_server_method()) }
    }

    /// Constructs an `SslMethod` from a pointer to the underlying OpenSSL value.
    ///
    /// # Safety
@@ -4288,7 +4302,7 @@ cfg_if! {
}
cfg_if! {
    if #[cfg(any(boringssl, ossl110, libressl291))] {
        use ffi::{TLS_method, DTLS_method, TLS_client_method, TLS_server_method};
        use ffi::{TLS_method, DTLS_method, TLS_client_method, TLS_server_method, DTLS_server_method, DTLS_client_method};
    } else {
        use ffi::{
            SSLv23_method as TLS_method, DTLSv1_method as DTLS_method, SSLv23_client_method as TLS_client_method,