1(* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception *)
2
3module type Domain_getinfo_V1 = sig
4  exception Error of string
5
6  type domid = int
7  type handle
8
9  type domaininfo = {
10    domid : domid;
11    dying : bool;
12    shutdown : bool;
13    shutdown_code : int;
14  }
15
16  val interface_open : unit -> handle
17  val domain_getinfo : handle -> domid -> domaininfo
18  val domain_getinfolist : handle -> domaininfo array
19end
20
21let ignore_logging : string -> unit = ignore
22let logging_function = ref ignore_logging
23let register_logging_function func = logging_function := func
24let plugin_implementation_v1 : (module Domain_getinfo_V1) option ref = ref None
25let register_plugin_v1 m = plugin_implementation_v1 := Some m
26
27let get_plugin_v1 () : (module Domain_getinfo_V1) =
28  match !plugin_implementation_v1 with
29  | Some s -> s
30  | None -> failwith "No plugin loaded"
31