protocol-9p

An implementation of the 9P protocol in pure OCaml
Library protocol_9p
type io =
| Read(*

read access

*)
| Write(*

write access

*)
| ReadWrite(*

read and write access

*)
| Exec(*

execute access

*)

The io types allowed in an open 'mode'

val io_of_sexp : Sexplib.Sexp.t -> io
val sexp_of_io : io -> Sexplib.Sexp.t
type t = {
io : io;
truncate : bool;(*

truncate file before opening

*)
rclose : bool;(*

remove file when closing

*)
append : bool;(*

meaningless flag

*)
}

A 'mode' passed as an argument to "Open" and "Create"

val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val read_only : t
val write_only : t
val read_write : t
val exec : t
val sizeof : t -> int

The size of a buffer needed to hold t

val read : Cstruct.t -> ( t * Cstruct.t, [ `Msg of string ] ) Result.result

Read a t from the given buffer and return it, along with the unused remainder of the buffer. If the buffer cannot be parsed then return an error.

val write : t -> Cstruct.t -> ( Cstruct.t, [ `Msg of string ] ) Result.result

Write a t into the given buffer. If the buffer is too small, then return an error. Return the unused remainder of the buffer.