Skip to content

Commit 4830f5b

Browse files
committed
Expose SslMethod::{dtls_client,dtls_server}
1 parent bab03c4 commit 4830f5b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

openssl-sys/src/handwritten/ssl.rs

+4
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,10 @@ cfg_if! {
701701
pub fn TLS_server_method() -> *const SSL_METHOD;
702702

703703
pub fn TLS_client_method() -> *const SSL_METHOD;
704+
705+
pub fn DTLS_server_method() -> *const SSL_METHOD;
706+
707+
pub fn DTLS_client_method() -> *const SSL_METHOD;
704708
}
705709
} else {
706710
extern "C" {

openssl/src/ssl/mod.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,20 @@ impl SslMethod {
364364
unsafe { SslMethod(TLS_server_method()) }
365365
}
366366

367+
/// Support all versions of the DTLS protocol, explicitly as a client.
368+
#[corresponds(DTLS_client_method)]
369+
#[cfg(any(boringssl, ossl110, libressl291))]
370+
pub fn dtls_client() -> SslMethod {
371+
unsafe { SslMethod(DTLS_client_method()) }
372+
}
373+
374+
/// Support all versions of the DTLS protocol, explicitly as a server.
375+
#[corresponds(DTLS_method)]
376+
#[cfg(any(boringssl, ossl110, libressl291))]
377+
pub fn dtls_server() -> SslMethod {
378+
unsafe { SslMethod(DTLS_server_method()) }
379+
}
380+
367381
/// Constructs an `SslMethod` from a pointer to the underlying OpenSSL value.
368382
///
369383
/// # Safety
@@ -4288,7 +4302,7 @@ cfg_if! {
42884302
}
42894303
cfg_if! {
42904304
if #[cfg(any(boringssl, ossl110, libressl291))] {
4291-
use ffi::{TLS_method, DTLS_method, TLS_client_method, TLS_server_method};
4305+
use ffi::{TLS_method, DTLS_method, TLS_client_method, TLS_server_method, DTLS_server_method, DTLS_client_method};
42924306
} else {
42934307
use ffi::{
42944308
SSLv23_method as TLS_method, DTLSv1_method as DTLS_method, SSLv23_client_method as TLS_client_method,

0 commit comments

Comments
 (0)