Provide access to the session ID
This commit is contained in:
parent
88a7032f4b
commit
5d53405597
|
|
@ -1751,6 +1751,7 @@ extern {
|
||||||
pub fn SSL_get_session(s: *const SSL) -> *mut SSL_SESSION;
|
pub fn SSL_get_session(s: *const SSL) -> *mut SSL_SESSION;
|
||||||
|
|
||||||
pub fn SSL_SESSION_free(s: *mut SSL_SESSION);
|
pub fn SSL_SESSION_free(s: *mut SSL_SESSION);
|
||||||
|
pub fn SSL_SESSION_get_id(s: *const SSL_SESSION, len: *mut c_uint) -> *const c_uchar;
|
||||||
|
|
||||||
#[cfg(not(ossl101))]
|
#[cfg(not(ossl101))]
|
||||||
pub fn SSL_CTX_set_alpn_protos(s: *mut SSL_CTX, data: *const c_uchar, len: c_uint) -> c_int;
|
pub fn SSL_CTX_set_alpn_protos(s: *mut SSL_CTX, data: *const c_uchar, len: c_uint) -> c_int;
|
||||||
|
|
|
||||||
|
|
@ -1029,6 +1029,19 @@ impl SslCipherRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type_!(SslSession, SslSessionRef, ffi::SSL_SESSION, ffi::SSL_SESSION_free);
|
||||||
|
|
||||||
|
impl SslSessionRef {
|
||||||
|
/// Returns the SSL session ID.
|
||||||
|
pub fn id(&self) -> &[u8] {
|
||||||
|
unsafe {
|
||||||
|
let mut len = 0;
|
||||||
|
let p = ffi::SSL_SESSION_get_id(self.as_ptr(), &mut len);
|
||||||
|
slice::from_raw_parts(p as *const u8, len as usize)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type_!(Ssl, SslRef, ffi::SSL, ffi::SSL_free);
|
type_!(Ssl, SslRef, ffi::SSL, ffi::SSL_free);
|
||||||
|
|
||||||
impl fmt::Debug for SslRef {
|
impl fmt::Debug for SslRef {
|
||||||
|
|
@ -1350,8 +1363,6 @@ impl fmt::Debug for Ssl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type_!(SslSession, SslSessionRef, ffi::SSL_SESSION, ffi::SSL_SESSION_free);
|
|
||||||
|
|
||||||
impl Ssl {
|
impl Ssl {
|
||||||
pub fn new(ctx: &SslContext) -> Result<Ssl, ErrorStack> {
|
pub fn new(ctx: &SslContext) -> Result<Ssl, ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue