···
2
+
maintainer: "Anil Madhavapeddy <anil@recoil.org>"
3
+
authors: ["Anil Madhavapeddy" "Mindy Preston" "Thomas Gazagnaire"]
6
+
homepage: "https://github.com/mirage/mirage-channel"
7
+
doc: "https://mirage.github.io/mirage-channel/"
8
+
bug-reports: "https://github.com/mirage/mirage-channel/issues"
10
+
"ocaml" {>= "4.07.0"}
12
+
"mirage-flow" {>= "2.0.0"}
14
+
"cstruct" {>= "6.0.0"}
16
+
"alcotest" {with-test}
17
+
"mirage-flow-combinators" {with-test & >= "2.0.0"}
23
+
["dune" "subst"] {dev}
24
+
["dune" "build" "-p" name "-j" jobs]
26
+
dev-repo: "git+https://github.com/mirage/mirage-channel.git"
27
+
synopsis: "Buffered channels for MirageOS FLOW types"
29
+
Channels are buffered reader/writers built on top of unbuffered `FLOW`
35
+
module Channel = Channel.Make(Flow)
37
+
Channel.read_exactly ~len:16 t
38
+
>>= fun bufs -> (* read header of message *)
39
+
let payload_length = Cstruct.(LE.get_uint16 (concat bufs) 0) in
40
+
Channel.read_exactly ~len:payload_length t
41
+
>>= fun bufs -> (* payload of message *)
43
+
(* process message *)
45
+
Channel.write_buffer t header;
46
+
Channel.write_buffer t payload;
51
+
mirage-channel is distributed under the ISC license.
55
+
"https://github.com/mirage/mirage-channel/releases/download/v4.1.0/mirage-channel-4.1.0.tbz"
57
+
"sha256=b0176851d4ddf5978d7072b420118178e6030ea50b33b1185fe3f3d9fda72100"
58
+
"sha512=d6e085cc7c61387fa651757704dd0c76d2fee728725e06174ea8a1c47e63b13217d3683094939a3862fe2f23f18f74dfcdbe4577ba0e9e45609c15d1539edd10"
61
+
x-commit-hash: "7e6729e3e06de402526f7a27be18279e5449257f"