fsr#
CCSDS Frame Security Report (FSR) for OCaml.
The Frame Security Report is a 32-bit status word transmitted from the recipient to the initiator of a SDLS-secured space link. It reports per-frame acceptance status and security events: bad sequence number, bad MAC, bad security association. Specified in CCSDS 355.1-B-1 §4.2.
Installation#
Install with opam:
$ opam install fsr
If opam cannot find the package, it may not yet be released in the
public opam-repository. Add the overlay repository, then install
it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install fsr
Usage#
Encode a clean report, then round-trip through the 32-bit wire format:
# let fsr =
Fsr.v ~alarm:false ~bad_sn:false ~bad_mac:false ~bad_sa:false
~spi:0x0042 ~arsn_lsb:0x7b in
let word = Fsr.encode fsr in
Result.map (fun r -> (r.Fsr.spi, r.Fsr.arsn_lsb)) (Fsr.decode word)
- : (int * int, [ `Invalid_version of int | `Not_fsr ]) result = Ok (66, 123)
update drops in the per-frame flags and auto-raises the persistent
alarm if any of them is true:
# let fsr =
Fsr.initial
|> Fsr.update ~bad_mac:true ~spi:0x0042 ~arsn_lsb:0x01 in
(Fsr.has_error fsr, fsr.alarm)
- : bool * bool = (true, true)
decode rejects non-FSR words — a Control Word Type of 0 indicates
a CLCW, not an FSR:
# Fsr.decode 0l
- : (Fsr.t, [ `Invalid_version of int | `Not_fsr ]) result = Error `Not_fsr
Licence#
ISC