CCSDS Frame Security Report (FSR)
0
fork

Configure Feed

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

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+77 -1
+69
README.md
··· 1 + # fsr 2 + 3 + CCSDS Frame Security Report (FSR) for OCaml. 4 + 5 + The Frame Security Report is a 32-bit status word transmitted from 6 + the recipient to the initiator of a [SDLS][sdls]-secured space link. 7 + It reports per-frame acceptance status and security events: bad 8 + sequence number, bad MAC, bad security association. Specified in 9 + CCSDS [355.1-B-1][fsr] §4.2. 10 + 11 + [sdls]: https://public.ccsds.org/Pubs/355x0b2.pdf 12 + [fsr]: https://public.ccsds.org/Pubs/355x1b1.pdf 13 + 14 + ## Installation 15 + 16 + Install with opam: 17 + 18 + <!-- $MDX skip --> 19 + ```sh 20 + $ opam install fsr 21 + ``` 22 + 23 + If opam cannot find the package, it may not yet be released in the 24 + public `opam-repository`. Add the overlay repository, then install 25 + it: 26 + 27 + <!-- $MDX skip --> 28 + ```sh 29 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 30 + $ opam update 31 + $ opam install fsr 32 + ``` 33 + 34 + ## Usage 35 + 36 + Encode a clean report, then round-trip through the 32-bit wire 37 + format: 38 + 39 + ```ocaml 40 + # let fsr = 41 + Fsr.v ~alarm:false ~bad_sn:false ~bad_mac:false ~bad_sa:false 42 + ~spi:0x0042 ~arsn_lsb:0x7b in 43 + let word = Fsr.encode fsr in 44 + Result.map (fun r -> (r.Fsr.spi, r.Fsr.arsn_lsb)) (Fsr.decode word) 45 + - : (int * int, [ `Invalid_version of int | `Not_fsr ]) result = Ok (66, 123) 46 + ``` 47 + 48 + `update` drops in the per-frame flags and auto-raises the persistent 49 + alarm if any of them is true: 50 + 51 + ```ocaml 52 + # let fsr = 53 + Fsr.initial 54 + |> Fsr.update ~bad_mac:true ~spi:0x0042 ~arsn_lsb:0x01 in 55 + (Fsr.has_error fsr, fsr.alarm) 56 + - : bool * bool = (true, true) 57 + ``` 58 + 59 + `decode` rejects non-FSR words — a Control Word Type of 0 indicates 60 + a CLCW, not an FSR: 61 + 62 + ```ocaml 63 + # Fsr.decode 0l 64 + - : (Fsr.t, [ `Invalid_version of int | `Not_fsr ]) result = Error `Not_fsr 65 + ``` 66 + 67 + ## Licence 68 + 69 + ISC
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries fsr))
+3 -1
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 (name fsr) 3 4 (generate_opam_files true) 4 5 (license ISC) ··· 13 14 (ocaml (>= 5.1)) 14 15 (wire (>= 0.9)) 15 16 (fmt (>= 0.9)) 16 - (alcotest :with-test))) 17 + (alcotest :with-test) 18 + (mdx :with-test)))
+1
fsr.opam
··· 13 13 "wire" {>= "0.9"} 14 14 "fmt" {>= "0.9"} 15 15 "alcotest" {with-test} 16 + "mdx" {with-test} 16 17 "odoc" {with-doc} 17 18 ] 18 19 build: [