aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2015-06-28 00:21:41 -0700
committerSteven Fackler <[email protected]>2015-06-28 00:21:41 -0700
commit797488dd091ce74e9b36c1c131406b4a9e9962ad (patch)
tree978df79f0038a0216b9c90a736d1e75892fe30b2
parentRename new_client to connect and new_server to accept (diff)
downloadrust-openssl-797488dd091ce74e9b36c1c131406b4a9e9962ad.tar.xz
rust-openssl-797488dd091ce74e9b36c1c131406b4a9e9962ad.zip
Add docs for accept and connect
-rw-r--r--openssl/src/ssl/mod.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index 5d770c19..d0f1644b 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -1017,6 +1017,11 @@ impl<S> fmt::Debug for SslStream<S> where S: fmt::Debug {
#[cfg(unix)]
impl<S: ::std::os::unix::io::AsRawFd> SslStream<S> {
+ /// Creates an SSL/TLS client operating over the provided stream.
+ ///
+ /// `connect_direct` creates a more efficient `SslStream` than `connect`
+ /// does, but requires that the stream implement `AsRawFd` on Unix and
+ /// `AsRawSocket` on Windows.
pub fn connect_direct<T: IntoSsl>(ssl: T, stream: S) -> Result<SslStream<S>, SslError> {
let ssl = try!(ssl.into_ssl());
let fd = stream.as_raw_fd() as c_int;
@@ -1026,6 +1031,11 @@ impl<S: ::std::os::unix::io::AsRawFd> SslStream<S> {
})
}
+ /// Creates an SSL/TLS server operating over the provided stream.
+ ///
+ /// `accept_direct` creates a more efficient `SslStream` than `accept`
+ /// does, but requires that the stream implement `AsRawFd` on Unix and
+ /// `AsRawSocket` on Windows.
pub fn accept_direct<T: IntoSsl>(ssl: T, stream: S) -> Result<SslStream<S>, SslError> {
let ssl = try!(ssl.into_ssl());
let fd = stream.as_raw_fd() as c_int;
@@ -1038,6 +1048,11 @@ impl<S: ::std::os::unix::io::AsRawFd> SslStream<S> {
#[cfg(windows)]
impl<S: ::std::os::windows::io::AsRawSocket> SslStream<S> {
+ /// Creates an SSL/TLS client operating over the provided stream.
+ ///
+ /// `connect_direct` creates a more efficient `SslStream` than `connect`
+ /// does, but requires that the stream implement `AsRawFd` on Unix and
+ /// `AsRawSocket` on Windows.
pub fn new_client_direct<T: IntoSsl>(ssl: T, stream: S) -> Result<SslStream<S>, SslError> {
let fd = stream.as_raw_socket() as c_int;
let stream = try!(DirectStream::connect(ssl, stream, fd));
@@ -1046,6 +1061,11 @@ impl<S: ::std::os::windows::io::AsRawSocket> SslStream<S> {
})
}
+ /// Creates an SSL/TLS server operating over the provided stream.
+ ///
+ /// `accept_direct` creates a more efficient `SslStream` than `accept`
+ /// does, but requires that the stream implement `AsRawFd` on Unix and
+ /// `AsRawSocket` on Windows.
pub fn new_server_direct<T: IntoSsl>(ssl: T, stream: S) -> Result<SslStream<S>, SslError> {
let fd = stream.as_raw_socket() as c_int;
let stream = try!(DirectStream::accept(ssl, stream, fd));
@@ -1056,6 +1076,7 @@ impl<S: ::std::os::windows::io::AsRawSocket> SslStream<S> {
}
impl<S: Read+Write> SslStream<S> {
+ /// Creates an SSL/TLS client operating over the provided stream.
pub fn connect<T: IntoSsl>(ssl: T, stream: S) -> Result<SslStream<S>, SslError> {
let stream = try!(IndirectStream::connect(ssl, stream));
Ok(SslStream {
@@ -1063,6 +1084,7 @@ impl<S: Read+Write> SslStream<S> {
})
}
+ /// Creates an SSL/TLS server operating over the provided stream.
pub fn accept<T: IntoSsl>(ssl: T, stream: S) -> Result<SslStream<S>, SslError> {
let stream = try!(IndirectStream::accept(ssl, stream));
Ok(SslStream {