Licklider Transmission Protocol (CCSDS 734.1-B) for reliable DTN links
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-ltp: enable MDX on eio/ltp_eio.mli

Run mdx on eio/ltp_eio.mli so the {[ ... ]} odoc block now type-checks
against the real Ltp / Ltp_eio APIs.

The example referenced free `session_id` and `process seg`, used the
`env#net` object-method shorthand, and silently swallowed an
unmatched send result. Wrapped in `let run () = ...`, gave session_id
a concrete `{ originator = 1L; number = 42L }` literal, switched to
`Eio.Stdenv.net env` with a `:> [`Generic] Eio.Net.ty Eio.Resource.t`
coercion (the sub-typing across closed/open polymorphic-variant tags
needs the explicit upcast), and printed the received segment via
`Fmt.pr "%a" Ltp.pp_segment` instead of calling an undefined
`process`.

+22 -11
+4
eio/dune
··· 2 2 (name ltp_eio) 3 3 (public_name ltp-eio) 4 4 (libraries ltp eio fmt logs)) 5 + 6 + (mdx 7 + (files ltp_eio.mli) 8 + (libraries ltp ltp-eio fmt eio eio.core eio.unix eio_main))
+18 -11
eio/ltp_eio.mli
··· 15 15 {2 Quick Start} 16 16 17 17 {[ 18 - Eio_main.run @@ fun env -> 19 - Eio.Switch.run @@ fun sw -> 20 - let conn = Ltp_eio.connect ~sw ~net:env#net ~host:"127.0.0.1" ~port:1113 in 21 - let seg = 22 - Ltp.data_segment ~session_id ~client_service_id:1L ~block_offset:0L 23 - "hello" 24 - in 25 - Ltp_eio.send conn seg; 26 - match Ltp_eio.recv conn with 27 - | Ok seg -> process seg 28 - | Error msg -> Fmt.epr "Error: %s@." msg 18 + let run () = 19 + Eio_main.run @@ fun env -> 20 + Eio.Switch.run @@ fun sw -> 21 + let net = 22 + (Eio.Stdenv.net env :> [ `Generic ] Eio.Net.ty Eio.Resource.t) 23 + in 24 + let conn = Ltp_eio.connect ~sw ~net ~host:"127.0.0.1" ~port:1113 in 25 + let session_id : Ltp.session_id = 26 + { originator = 1L; number = 42L } 27 + in 28 + let seg = 29 + Ltp.data_segment ~session_id ~client_service_id:1L 30 + ~block_offset:0L "hello" 31 + in 32 + Ltp_eio.send conn seg; 33 + match Ltp_eio.recv conn with 34 + | Ok seg -> Fmt.pr "got %a@." Ltp.pp_segment seg 35 + | Error msg -> Fmt.epr "Error: %s@." msg 29 36 ]} *) 30 37 31 38 (** {1 Connection} *)