Up

module Engine

: sig

Core of pure library. This is the interface to effectful front-ends.

#
type alert = Packet.alert_type

type of alerts

#
type state

some abstract type a client gets

#
type ret = [
| `Ok of [
| `Ok of state
| `Eof
| `Alert of alert
] * [
| `Response of Cstruct.t option
] * [
| `Data of Cstruct.t option
]
| `Fail of alert * [
| `Response of Cstruct.t
]
]

return type of handle_tls

#
val handle_tls : state -> Cstruct.t -> ret

handle_tls tls in is ret, depending on incoming tls state and cstruct, return appropriate ret

#
val can_handle_appdata : state -> bool

can_handle_appdata tls is a predicate which indicates when the connection has already completed a handshake

#
val handshake_in_progress : state -> bool

handshake_in_progress tls is a predicate which indicates whether a handshake is in progress

#
val send_application_data : state -> Cstruct.t list -> (state * Cstruct.t) option

send_application_data tls outs is (tls' * out) option where tls' is the new tls state, and out the cstruct to send over the wire (encrypted and wrapped outs)

#
val send_close_notify : state -> state * Cstruct.t

send_close_notify tls is tls' * out where tls' is the new tls state, and out the (possible encrypted) close notify alert

#
val reneg : state -> (state * Cstruct.t) option

reneg tls is (tls' * out) option where tls' is the new tls state, and out either a client hello or hello request (depending on the communication endpoint we are)

#
val client : Config.client -> state * Cstruct.t

client client is tls * out where tls is the initial state, and out the initial client hello

#
val server : Config.server -> state

server server is tls where tls is the initial server state

#
type epoch_data = {
# protocol_version
: Core.tls_version;
# ciphersuite
: Ciphersuite.ciphersuite;
# peer_certificate
: Certificate.certificate list;
# peer_name
: string option;
# trust_anchor
: Certificate.certificate option;
# own_certificate
: Certificate.certificate list;
# own_private_key
: Nocrypto.Rsa.priv option;
# own_name
: string option;
# master_secret
: State.master_secret;
}
#
type epoch = [
| `InitialEpoch
| `Epoch of epoch_data
]
#
val epoch : state -> epoch
#
val epoch_data_of_sexp : Sexplib.Sexp.t -> epoch_data
#
val sexp_of_epoch_data : epoch_data -> Sexplib.Sexp.t
#
val epoch_of_sexp : Sexplib.Sexp.t -> epoch
#
val __epoch_of_sexp__ : Sexplib.Sexp.t -> epoch
#
val sexp_of_epoch : epoch -> Sexplib.Sexp.t
end