aboutsummaryrefslogtreecommitdiff
path: root/src/ssl/ffi.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2013-10-05 15:49:46 -0700
committerSteven Fackler <[email protected]>2013-10-05 15:49:46 -0700
commitd04c4ef435949622d6784d42c5b9ce1d4d5bc6d2 (patch)
treec5ce91aefa5ea2249532f79fda223c1c0dfd4661 /src/ssl/ffi.rs
parentSslStream sketch (diff)
downloadrust-openssl-d04c4ef435949622d6784d42c5b9ce1d4d5bc6d2.tar.xz
rust-openssl-d04c4ef435949622d6784d42c5b9ce1d4d5bc6d2.zip
Connect working
Diffstat (limited to 'src/ssl/ffi.rs')
-rw-r--r--src/ssl/ffi.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ssl/ffi.rs b/src/ssl/ffi.rs
index c3144545..07591b78 100644
--- a/src/ssl/ffi.rs
+++ b/src/ssl/ffi.rs
@@ -1,13 +1,24 @@
#[doc(hidden)];
-use std::libc::{c_int, c_void};
+use std::libc::{c_int, c_long, c_void};
+// openssl/ssl.h
pub type SSL_CTX = c_void;
pub type SSL_METHOD = c_void;
pub type SSL = c_void;
pub type BIO = c_void;
pub type BIO_METHOD = c_void;
+pub static SSL_ERROR_NONE: c_int = 0;
+pub static SSL_ERROR_SSL: c_int = 1;
+pub static SSL_ERROR_WANT_READ: c_int = 2;
+pub static SSL_ERROR_WANT_WRITE: c_int = 3;
+pub static SSL_ERROR_WANT_X509_LOOKUP: c_int = 4;
+pub static SSL_ERROR_SYSCALL: c_int = 5;
+pub static SSL_ERROR_ZERO_RETURN: c_int = 6;
+pub static SSL_ERROR_WANT_CONNECT: c_int = 7;
+pub static SSL_ERROR_WANT_ACCEPT: c_int = 8;
+
#[link_args = "-lssl"]
extern "C" { }
@@ -22,8 +33,11 @@ externfn!(fn SSL_new(ctx: *SSL_CTX) -> *SSL)
externfn!(fn SSL_free(ssl: *SSL))
externfn!(fn SSL_set_bio(ssl: *SSL, rbio: *BIO, wbio: *BIO))
externfn!(fn SSL_set_connect_state(ssl: *SSL))
-externfn!(fn SSL_do_handshake(ssl: *SSL))
+externfn!(fn SSL_connect(ssl: *SSL) -> c_int)
+externfn!(fn SSL_get_error(ssl: *SSL, ret: c_int) -> c_int)
externfn!(fn BIO_s_mem() -> *BIO_METHOD)
externfn!(fn BIO_new(type_: *BIO_METHOD) -> *BIO)
externfn!(fn BIO_free(a: *BIO) -> c_int)
+externfn!(fn BIO_read(b: *BIO, buf: *c_void, len: c_int) -> c_int)
+externfn!(fn BIO_write(b: *BIO, buf: *c_void, len: c_int) -> c_int)