feat: Add `set_options` binding function to ConnectConfiguration (#43)

This commit is contained in:
0x676e67 2025-02-07 12:19:41 +08:00 committed by GitHub
parent c6e390a8b8
commit 32492cd4f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 0 deletions

View File

@ -314,6 +314,24 @@ impl ConnectConfiguration {
pub fn set_alps_use_new_codepoint(&mut self, use_new: bool) {
unsafe { ffi::SSL_set_alps_use_new_codepoint(self.as_ptr(), use_new as _) }
}
/// Sets the SSL options.
///
/// # Arguments
///
/// * `options` - An `SslOptions` bitmask representing the options to set.
///
/// # Returns
///
/// * `Result<(), ErrorStack>` - Returns `Ok(())` if the operation is successful, otherwise returns an `ErrorStack`.
///
/// # Safety
///
/// This function is unsafe because it calls an FFI function.
#[corresponds(SSL_set_options)]
pub fn set_options(&mut self, options: SslOptions) -> Result<(), ErrorStack> {
unsafe { cvt(ffi::SSL_set_options(self.as_ptr(), options.bits()) as _).map(|_| ()) }
}
}
impl Deref for ConnectConfiguration {