package vif

  1. Overview
  2. Docs

Source file vif_server.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
type t = {
    devices: Vif_device.Hmap.t
  ; cookie_key: Mirage_crypto.AES.GCM.key
  ; metrics: Vif_metrics.t
}

let metrics t = t.metrics

let device : type a. ('value, a) Vif_device.device -> t -> a =
 fun (Vif_device.Device (_, _, k)) { devices; _ } ->
  match Vif_device.Hmap.find k devices with
  | Some value -> value
  | None ->
      Fmt.failwith "Device %s not found"
        (Vif_device.Hmap.Key.info k).Vif_device.Device.name

let cookie_key { cookie_key; _ } = cookie_key