protocol-9p

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

subject has read access

*)
| `Write(*

subject has write access

*)
| `Execute(*

subject may execute the file as a program

*)
]
val permission_of_sexp : Sexplib.Sexp.t -> permission
val __permission_of_sexp__ : Sexplib.Sexp.t -> permission
val sexp_of_permission : permission -> Sexplib.Sexp.t
type t = {
owner : permission list;(*

file owner has these permissions

*)
group : permission list;(*

anyone in the same group has these permissions

*)
other : permission list;(*

all other users have these permissions

*)
is_directory : bool;(*

true if the file is a directory

*)
append_only : bool;(*

true if the file is append-only (and therefore offsets in writes are ignored)

*)
exclusive : bool;(*

true if only one client may have it open at a time

*)
is_mount : bool;(*

true if the file is a mountpoint

*)
is_auth : bool;(*

true if the file is a special authentication file

*)
temporary : bool;(*

true if the file is temporary and should be skipped from nightly backups

*)
is_device : bool;(*

9P2000.u: true if file is a char/block device

*)
is_namedpipe : bool;(*

9P2000.u: true if file is a nomed pipe

*)
is_socket : bool;(*

9P2000.u: true if file is a socket

*)
is_setuid : bool;(*

9P2000.u: true if file is setuid

*)
is_setgid : bool;(*

9P2000.u: true if file is setgid

*)
is_any : bool;(*

true if the mode is a wstat 'any' value

*)
}

A 'mode' returned from a call to "Stat"

val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val make : ?owner:permission list -> ?group:permission list -> ?other:permission list -> ?is_directory:bool -> ?append_only:bool -> ?exclusive:bool -> ?is_mount:bool -> ?is_auth:bool -> ?temporary:bool -> ?is_device:bool -> ?is_symlink:bool -> ?is_hardlink:bool -> ?is_namedpipe:bool -> ?is_socket:bool -> ?is_setuid:bool -> ?is_setgid:bool -> unit -> t
val any : t
val is_any : t -> bool
val nonet_of_permissions : t -> int32
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.