Skip to content

Commit 32492cd

Browse files
authored
feat: Add set_options binding function to ConnectConfiguration (#43)
1 parent c6e390a commit 32492cd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

boring/src/ssl/connector.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,24 @@ impl ConnectConfiguration {
314314
pub fn set_alps_use_new_codepoint(&mut self, use_new: bool) {
315315
unsafe { ffi::SSL_set_alps_use_new_codepoint(self.as_ptr(), use_new as _) }
316316
}
317+
318+
/// Sets the SSL options.
319+
///
320+
/// # Arguments
321+
///
322+
/// * `options` - An `SslOptions` bitmask representing the options to set.
323+
///
324+
/// # Returns
325+
///
326+
/// * `Result<(), ErrorStack>` - Returns `Ok(())` if the operation is successful, otherwise returns an `ErrorStack`.
327+
///
328+
/// # Safety
329+
///
330+
/// This function is unsafe because it calls an FFI function.
331+
#[corresponds(SSL_set_options)]
332+
pub fn set_options(&mut self, options: SslOptions) -> Result<(), ErrorStack> {
333+
unsafe { cvt(ffi::SSL_set_options(self.as_ptr(), options.bits()) as _).map(|_| ()) }
334+
}
317335
}
318336

319337
impl Deref for ConnectConfiguration {

0 commit comments

Comments
 (0)