2018-10-23 22:13:47 +00:00
|
|
|
(* (c) 2018 Hannes Mehnert, all rights reserved *)
|
|
|
|
|
2018-10-23 22:03:36 +00:00
|
|
|
open Vmm_core
|
|
|
|
|
|
|
|
(** The type of versions of the grammar defined below. *)
|
2019-10-11 23:38:44 +00:00
|
|
|
type version = [ `AV2 | `AV3 | `AV4 ]
|
2018-10-23 22:03:36 +00:00
|
|
|
|
|
|
|
(** [version_eq a b] is true if [a] and [b] are equal. *)
|
|
|
|
val version_eq : version -> version -> bool
|
|
|
|
|
|
|
|
(** [pp_version ppf version] pretty prints [version] onto [ppf]. *)
|
|
|
|
val pp_version : version Fmt.t
|
|
|
|
|
|
|
|
type console_cmd = [
|
|
|
|
| `Console_add
|
2018-10-23 23:07:12 +00:00
|
|
|
| `Console_subscribe of Ptime.t option
|
2018-10-23 22:03:36 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
type stats_cmd = [
|
2019-01-14 23:25:59 +00:00
|
|
|
| `Stats_add of string * int * (string * string) list
|
2018-10-23 22:03:36 +00:00
|
|
|
| `Stats_remove
|
|
|
|
| `Stats_subscribe
|
|
|
|
]
|
|
|
|
|
|
|
|
type log_cmd = [
|
2018-10-23 23:07:12 +00:00
|
|
|
| `Log_subscribe of Ptime.t option
|
2018-10-23 22:03:36 +00:00
|
|
|
]
|
|
|
|
|
2018-11-13 00:02:05 +00:00
|
|
|
type unikernel_cmd = [
|
|
|
|
| `Unikernel_info
|
|
|
|
| `Unikernel_create of Unikernel.config
|
|
|
|
| `Unikernel_force_create of Unikernel.config
|
|
|
|
| `Unikernel_destroy
|
2018-10-23 22:03:36 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
type policy_cmd = [
|
|
|
|
| `Policy_info
|
2018-11-11 02:09:37 +00:00
|
|
|
| `Policy_add of Policy.t
|
2018-10-23 22:03:36 +00:00
|
|
|
| `Policy_remove
|
|
|
|
]
|
|
|
|
|
2018-11-10 00:02:07 +00:00
|
|
|
type block_cmd = [
|
|
|
|
| `Block_info
|
|
|
|
| `Block_add of int
|
|
|
|
| `Block_remove
|
|
|
|
]
|
|
|
|
|
2018-10-23 22:03:36 +00:00
|
|
|
type t = [
|
|
|
|
| `Console_cmd of console_cmd
|
|
|
|
| `Stats_cmd of stats_cmd
|
|
|
|
| `Log_cmd of log_cmd
|
2018-11-13 00:02:05 +00:00
|
|
|
| `Unikernel_cmd of unikernel_cmd
|
2018-11-10 00:02:07 +00:00
|
|
|
| `Policy_cmd of policy_cmd
|
|
|
|
| `Block_cmd of block_cmd
|
|
|
|
]
|
2018-10-23 22:03:36 +00:00
|
|
|
|
|
|
|
val pp : t Fmt.t
|
|
|
|
|
|
|
|
type data = [
|
|
|
|
| `Console_data of Ptime.t * string
|
|
|
|
| `Stats_data of Stats.t
|
|
|
|
| `Log_data of Log.t
|
|
|
|
]
|
|
|
|
|
|
|
|
val pp_data : data Fmt.t
|
|
|
|
|
|
|
|
type header = {
|
|
|
|
version : version ;
|
|
|
|
sequence : int64 ;
|
2018-11-11 00:21:12 +00:00
|
|
|
name : Name.t ;
|
2018-10-23 22:03:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type success = [
|
|
|
|
| `Empty
|
|
|
|
| `String of string
|
2018-11-11 02:09:37 +00:00
|
|
|
| `Policies of (Name.t * Policy.t) list
|
2018-11-13 00:02:05 +00:00
|
|
|
| `Unikernels of (Name.t * Unikernel.config) list
|
|
|
|
| `Block_devices of (Name.t * int * bool) list
|
2018-10-23 22:03:36 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
type wire = header * [
|
|
|
|
| `Command of t
|
|
|
|
| `Success of success
|
|
|
|
| `Failure of string
|
|
|
|
| `Data of data ]
|
|
|
|
|
|
|
|
val pp_wire : wire Fmt.t
|
|
|
|
|
|
|
|
val endpoint : t -> service * [ `End | `Read ]
|