package ssl

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Runtime_lock is an equivalent, signature compatible, equivalent to the Ssl module, with one difference: the OCaml runtime lock isn't released before calling the underlying SSL primitives. Multiple systhreads cannot, therefore, run concurrently.

It works well with non blocking sockets where the usual semantics apply, i.e. handling of `EWOULDBLOCK`, `EGAIN`, etc. Additionally, the functions in this module don't perform a copy of application data buffers.

val connect : socket -> unit

Connect an SSL socket.

val accept : socket -> unit

Accept an SSL connection.

val open_connection : protocol -> Unix.sockaddr -> socket

Open an SSL connection.

val open_connection_with_context : context -> Unix.sockaddr -> socket

Open an SSL connection with the specified context.

val close_notify : socket -> bool

Send close notify to the peer. This is SSL_shutdown(3). * returns true if shutdown is finished, false in case close_notify * needs to be called a second time.

val shutdown_connection : socket -> unit

Close an SSL connection opened with open_connection.

val shutdown : socket -> unit

Close a SSL connection. * Send close notify to the peer and wait for close notify from peer.

val flush : socket -> unit

Flush an SSL connection.

val read : socket -> Stdlib.Bytes.t -> int -> int -> int

read sock buf off len receives data from a connected SSL socket.

val read_into_bigarray : socket -> bigarray -> int -> int -> int

read_into_bigarray sock ba off len receives data from a connected SSL socket. This function releases the runtime while the read takes place.

val write : socket -> Stdlib.Bytes.t -> int -> int -> int

write sock buf off len sends data over a connected SSL socket.

val write_substring : socket -> string -> int -> int -> int

write_substring sock str off len sends data over a connected SSL socket.

val write_bigarray : socket -> bigarray -> int -> int -> int

write_bigarray sock ba off len sends data over a connected SSL socket. This function releases the runtime while the read takes place.

High-level communication functions

val input_string : socket -> string

Input a string on an SSL socket.

val output_string : socket -> string -> unit

Write a string on an SSL socket.

val input_char : socket -> char

Input a character on an SSL socket.

val output_char : socket -> char -> unit

Write a char on an SSL socket.

val input_int : socket -> int

Input an integer on an SSL socket.

val output_int : socket -> int -> unit

Write an integer on an SSL socket.

OCaml

Innovation. Community. Security.