package nbd

  1. Overview
  2. Docs
type transport

The transport mechanism used to send and receive messages

type id

Each request_hdr and response_hdr carries an id that is used to match responses to requests.

type request_hdr
type request_body
type response_hdr
type response_body
val recv_hdr : transport -> (id option * response_hdr) Lwt.t
val recv_body : transport -> request_hdr -> response_hdr -> response_body -> (unit, Protocol.Error.t) Stdlib.result Lwt.t

recv_body transport request_hdr response_hdr response_body returns Ok () and receives and writes the body of the response into response_body if the request has been successful, otherwise returns an Error. The request_hdr parameter is the output of a preceding recv_hdr call.

val send_one : transport -> request_hdr -> request_body -> unit Lwt.t

Send a single request. Invocations of this function will not be interleaved because they are protected by a mutex

val id_of_request : request_hdr -> id
val handle_unrequested_packet : transport -> response_hdr -> unit Lwt.t
OCaml

Innovation. Community. Security.