CCSDS AOS (Advanced Orbiting Systems) Transfer Frame for satellite downlinks
0
fork

Configure Feed

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

aos, uslp, gpt: drop unused FFI scaffolding and inline dead helpers

Same pattern as tc/tm/clcw: [struct_], [module_], [c_stubs],
[ml_stubs] are derived on the fly by the [c/gen.ml] generators via
[Wire.Everparse.schema codec], so the pre-materialized copies in
the main library are dead weight.

Also remove [decode_header] / [encode_header] in aos and uslp
(neither exposed in the .mli nor called internally; the full-frame
[decode] / [encode] path is the only public entry point) and the
unused [w_data_zone] field builder in aos, the dead variable-width
[be_uint] / [be_uint_map] / [fecf_to_string] helpers in uslp, and
the redundant [header_struct_] in gpt. The one exception is
[Gpt.signature]: move it up before the header codec and reuse it
in [f_signature] and [validate_signature] so the "EFI PART"
constant has exactly one definition.

Drive-by: the [Json.Error.to_string e] error-formatting pattern in
five interop tests never made sense (the error values are already
[string]); drop the wrapper. This was fallout from the in-progress
json restructure but is a trivial bug in the tests.

-35
-35
lib/aos.ml
··· 177 177 let w_vc_count_flag = Wire.Field.v "vc_count_flag" bool32 178 178 let w_spare = Wire.Field.v "spare" (bits32 2) 179 179 let w_vc_count_cycle = Wire.Field.v "vc_count_cycle" (bits32 4) 180 - let w_data_zone = Wire.Field.v "data_zone" Wire.all_bytes 181 180 182 181 (* {1 Header Wire Codec} *) 183 182 ··· 307 306 |> Wire.Param.bind p_expect_ocf (if expect_ocf then 1 else 0) 308 307 |> Wire.Param.bind p_expect_fecf (if expect_fecf then 1 else 0) 309 308 310 - let struct_ = Wire.Everparse.struct_of_codec codec 311 - 312 - let module_ = 313 - Wire.Everparse.Raw.module_ 314 - ~doc:"CCSDS AOS Transfer Frame Primary Header (732.0-B-4)" 315 - [ Wire.Everparse.Raw.typedef ~entrypoint:true struct_ ] 316 - 317 309 (* Wire Parse/Encode *) 318 310 let wire_size = Wire.Codec.wire_size codec 319 311 ··· 369 361 vc_count_cycle = p.vc_count_cycle; 370 362 }) 371 363 372 - (* FFI Code Generation *) 373 - let c_stubs () = Wire_stubs.to_c_stubs [ struct_ ] 374 - let ml_stubs () = Wire_stubs.to_ml_stubs [ struct_ ] 375 - 376 - (* {1 Header decoding via Wire codec} *) 377 - 378 - let decode_header buf = 379 - let len = String.length buf in 380 - if len < header_len then Error (Truncated { need = header_len; have = len }) 381 - else 382 - let bytes_buf = Bytes.unsafe_of_string buf in 383 - match Wire.Codec.decode codec bytes_buf 0 with 384 - | Error _ -> 385 - (* Wire codec should not fail on 6-byte input, but map for safety *) 386 - Error (Truncated { need = header_len; have = len }) 387 - | Ok packed -> ( 388 - if packed.version > 1 then Error (Invalid_version packed.version) 389 - else 390 - match of_packed_header packed with 391 - | Error `Invalid_scid -> Error (Invalid_scid packed.scid) 392 - | Error `Invalid_vcid -> Error (Invalid_vcid packed.vcid) 393 - | Ok header -> Ok header) 394 - 395 364 (* {1 Frame decode/encode via frame_codec} *) 396 365 397 366 let packed_to_header pf = ··· 465 434 let* () = check_fecf_value buf frame_len pf.pf_fecf in 466 435 Ok frame 467 436 else Ok frame 468 - 469 - let encode_header buf off hdr = 470 - let packed = to_packed_header hdr in 471 - Wire.Codec.encode codec packed buf off 472 437 473 438 let encode ?(insert_zone_len = 0) ?(with_ocf = true) ?(with_fecf = true) frame = 474 439 let iz_len = insert_zone_len in