SpaceOS wire protocol codecs for host-guest communication
at main 49 lines 1.1 kB view raw
1(** ERROR/NACK payload codec (8 bytes). 2 3 {v 4 0x00 uint8 error_code 5 0x01 uint8 offending_type 6 0x02 uint16 offending_apid 7 0x04 uint16 offending_pay_len 8 0x06 uint16 reserved 9 v} *) 10 11type error_code = 12 | Unknown_type 13 | Unknown_version 14 | Message_too_large 15 | Apid_not_allocated 16 | Host_busy 17 | Malformed 18 19val error_code_to_int : error_code -> int 20(** Convert an error code to its wire representation. *) 21 22val error_code_of_int : int -> error_code option 23(** Parse an error code from its wire representation. *) 24 25type t = { 26 error_code : int; 27 offending_type : int; 28 offending_apid : int; 29 offending_pay_len : int; 30 reserved : int; 31} 32 33val codec : t Wire.Codec.t 34(** Wire codec for the 8-byte error payload. *) 35 36val v : 37 error_code -> 38 offending_type:int -> 39 offending_apid:int -> 40 offending_pay_len:int -> 41 t 42(** [v code ~offending_type ~offending_apid ~offending_pay_len] builds an error 43 payload. *) 44 45val pp : t Fmt.t 46(** Pretty-print an error payload. *) 47 48val equal : t -> t -> bool 49(** Structural equality. *)