diff options
| author | Steven Fackler <[email protected]> | 2013-10-20 22:24:01 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2013-10-20 22:24:01 -0700 |
| commit | a42d5261f95a081f8b530fd2c1827082b89f7807 (patch) | |
| tree | 427852b28240c29200aefcca6cd972a83b80228f /lib.rs | |
| parent | Move tests to in-binary and fix link args (diff) | |
| download | rust-openssl-a42d5261f95a081f8b530fd2c1827082b89f7807.tar.xz rust-openssl-a42d5261f95a081f8b530fd2c1827082b89f7807.zip | |
Fill out the context methods
Diffstat (limited to 'lib.rs')
| -rw-r--r-- | lib.rs | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,5 +1,3 @@ -#[link(name="ssl")]; - use std::rt::io::{Reader, Writer, Stream, Decorator}; use std::unstable::atomics::{AtomicBool, INIT_ATOMIC_BOOL, Acquire, Release}; use std::task; @@ -30,12 +28,18 @@ pub fn init() { } pub enum SslMethod { + Sslv2, + Sslv3, + Tlsv1, Sslv23 } impl SslMethod { - unsafe fn to_raw(&self) -> *ffi::SSL_METHOD { + unsafe fn to_fn(&self) -> *ffi::SSL_METHOD { match *self { + Sslv2 => ffi::SSLv2_method(), + Sslv3 => ffi::SSLv3_method(), + Tlsv1 => ffi::TLSv1_method(), Sslv23 => ffi::SSLv23_method() } } @@ -55,7 +59,7 @@ impl SslCtx { pub fn new(method: SslMethod) -> SslCtx { init(); - let ctx = unsafe { ffi::SSL_CTX_new(method.to_raw()) }; + let ctx = unsafe { ffi::SSL_CTX_new(method.to_fn()) }; assert!(ctx != ptr::null()); SslCtx { |