CCSDS USLP (Unified Space Link Protocol) Transfer Frame- unified TM/TC/AOS
0
fork

Configure Feed

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

Port monorepo to latest ocaml-wire (opam pin)

Migrate all consumers to the new wire API:
- wire.c library → wire.3d (Wire_c → Wire_3d)
- Wire.struct_/module_ → Wire.Everparse.struct_/module_
- Wire.Codec: record/|+/seal → Codec.v with Field.v and $
- Wire.bf_uint* → Wire.U8/U16/U16be/U32/U32be
- Wire.UInt32 → Wire.Private.UInt32
- Wire.cases → Wire.lookup, Wire.map now uses labeled args
- Wire.Codec.decode now returns result
- Add wire pin to root.opam.template

+64 -50
+20 -14
c/UslpHeader.3d
··· 1 - /*++ CCSDS USLP Transfer Frame Primary Header (732.1-B-2) --*/ 1 + extern typedef struct _WireCtx WireCtx 2 + 3 + extern unit WireSetU32BE(mutable WireCtx *ctx, UINT32 idx, UINT32BE v) 4 + 5 + extern unit WireSetU16BE(mutable WireCtx *ctx, UINT32 idx, UINT16BE v) 6 + 7 + extern unit WireSetU8(mutable WireCtx *ctx, UINT32 idx, UINT8 v) 2 8 3 9 entrypoint 4 - typedef struct _UslpHeader 10 + typedef struct _UslpHeader(mutable WireCtx *ctx) 5 11 { 6 - UINT32BE tfvn : 4; 7 - UINT32BE scid : 16; 8 - UINT32BE src_or_dest : 1; 9 - UINT32BE vcid : 6; 10 - UINT32BE map_id : 4; 11 - UINT32BE eofph : 1; 12 - UINT16BE frame_len; 13 - UINT8 bypass_flag : 1; 14 - UINT8 prot_ctrl_cmd : 1; 15 - UINT8 reserved : 2; 16 - UINT8 ocf_flag : 1; 17 - UINT8 vcfc_len : 3; 12 + UINT32BE tfvn : 4 {:act WireSetU32BE(ctx, (UINT32) 0, tfvn); }; 13 + UINT32BE scid : 16 {:act WireSetU32BE(ctx, (UINT32) 1, scid); }; 14 + UINT32BE src_or_dest : 1 {:act WireSetU32BE(ctx, (UINT32) 2, src_or_dest); }; 15 + UINT32BE vcid : 6 {:act WireSetU32BE(ctx, (UINT32) 3, vcid); }; 16 + UINT32BE map_id : 4 {:act WireSetU32BE(ctx, (UINT32) 4, map_id); }; 17 + UINT32BE eofph : 1 {:act WireSetU32BE(ctx, (UINT32) 5, eofph); }; 18 + UINT16BE frame_len {:on-success WireSetU16BE(ctx, (UINT32) 6, frame_len); return true; }; 19 + UINT8 bypass_flag : 1 {:act WireSetU8(ctx, (UINT32) 7, bypass_flag); }; 20 + UINT8 prot_ctrl_cmd : 1 {:act WireSetU8(ctx, (UINT32) 8, prot_ctrl_cmd); }; 21 + UINT8 reserved : 2 {:act WireSetU8(ctx, (UINT32) 9, reserved); }; 22 + UINT8 ocf_flag : 1 {:act WireSetU8(ctx, (UINT32) 10, ocf_flag); }; 23 + UINT8 vcfc_len : 3 {:act WireSetU8(ctx, (UINT32) 11, vcfc_len); }; 18 24 } UslpHeader; 19 25 20 26
+1 -1
c/dune
··· 6 6 (executable 7 7 (name gen) 8 8 (modules gen) 9 - (libraries uslp wire.c)) 9 + (libraries uslp wire.3d)) 10 10 11 11 (rule 12 12 (mode promote)
+1 -6
c/gen.ml
··· 1 - let () = 2 - Wire_c.main ~package:"uslp" 3 - [ 4 - Wire_c.schema ~name:"UslpHeader" ~module_:Uslp.module_ 5 - ~wire_size:(Wire.Codec.wire_size Uslp.codec); 6 - ] 1 + let () = Wire_3d.main ~package:"uslp" [ Wire.Everparse.schema Uslp.codec ]
+1 -1
lib/dune
··· 1 1 (library 2 2 (name uslp) 3 3 (public_name uslp) 4 - (libraries clcw crc fmt wire)) 4 + (libraries clcw crc fmt wire wire.stubs))
+39 -26
lib/uslp.ml
··· 428 428 429 429 (* Wire Codec *) 430 430 let codec = 431 - let open Wire.Codec in 432 - let bits32 n = Wire.bits ~width:n Wire.bf_uint32be in 433 - let bits8 n = Wire.bits ~width:n Wire.bf_uint8 in 431 + let bits32 n = Wire.bits ~width:n Wire.U32be in 432 + let bits8 n = Wire.bits ~width:n Wire.U8 in 434 433 let bool32 = Wire.bool (bits32 1) in 435 434 let bool8 = Wire.bool (bits8 1) in 436 - let src_dest = Wire.cases [ Source; Dest ] (bits32 1) in 437 - record "UslpHeader" 435 + let src_dest = Wire.lookup [ Source; Dest ] (bits32 1) in 436 + let f_tfvn = Wire.Field.v "tfvn" (bits32 4) in 437 + let f_scid = Wire.Field.v "scid" (bits32 16) in 438 + let f_src_or_dest = Wire.Field.v "src_or_dest" src_dest in 439 + let f_vcid = Wire.Field.v "vcid" (bits32 6) in 440 + let f_map_id = Wire.Field.v "map_id" (bits32 4) in 441 + let f_eofph = Wire.Field.v "eofph" bool32 in 442 + let f_frame_len = Wire.Field.v "frame_len" Wire.uint16be in 443 + let f_bypass_flag = Wire.Field.v "bypass_flag" bool8 in 444 + let f_prot_ctrl_cmd = Wire.Field.v "prot_ctrl_cmd" bool8 in 445 + let f_reserved = Wire.Field.v "reserved" (bits8 2) in 446 + let f_ocf_flag = Wire.Field.v "ocf_flag" bool8 in 447 + let f_vcfc_len = Wire.Field.v "vcfc_len" (bits8 3) in 448 + Wire.Codec.v "UslpHeader" 438 449 (fun tfvn scid sd vcid map_id eofph flen bypass pcc _rsvd ocf vcfc_len -> 439 450 { 440 451 tfvn; ··· 449 460 ocf_flag = ocf; 450 461 vcfc_len; 451 462 }) 452 - |+ field "tfvn" (bits32 4) (fun t -> t.tfvn) 453 - |+ field "scid" (bits32 16) (fun t -> t.scid) 454 - |+ field "src_or_dest" src_dest (fun t -> t.src_or_dest) 455 - |+ field "vcid" (bits32 6) (fun t -> t.vcid) 456 - |+ field "map_id" (bits32 4) (fun t -> t.map_id) 457 - |+ field "eofph" bool32 (fun t -> t.eofph) 458 - |+ field "frame_len" Wire.uint16be (fun t -> t.frame_len) 459 - |+ field "bypass_flag" bool8 (fun t -> t.bypass_flag) 460 - |+ field "prot_ctrl_cmd" bool8 (fun t -> t.prot_ctrl_cmd) 461 - |+ field "reserved" (bits8 2) (fun _ -> 0) 462 - |+ field "ocf_flag" bool8 (fun t -> t.ocf_flag) 463 - |+ field "vcfc_len" (bits8 3) (fun t -> t.vcfc_len) 464 - |> seal 463 + Wire.Codec. 464 + [ 465 + (f_tfvn $ fun t -> t.tfvn); 466 + (f_scid $ fun t -> t.scid); 467 + (f_src_or_dest $ fun t -> t.src_or_dest); 468 + (f_vcid $ fun t -> t.vcid); 469 + (f_map_id $ fun t -> t.map_id); 470 + (f_eofph $ fun t -> t.eofph); 471 + (f_frame_len $ fun t -> t.frame_len); 472 + (f_bypass_flag $ fun t -> t.bypass_flag); 473 + (f_prot_ctrl_cmd $ fun t -> t.prot_ctrl_cmd); 474 + (f_reserved $ fun _ -> 0); 475 + (f_ocf_flag $ fun t -> t.ocf_flag); 476 + (f_vcfc_len $ fun t -> t.vcfc_len); 477 + ] 465 478 466 - let struct_ = Wire.Codec.to_struct codec 479 + let struct_ = Wire.Everparse.struct_of_codec codec 467 480 468 481 let module_ = 469 - Wire.module_ ~doc:"CCSDS USLP Transfer Frame Primary Header (732.1-B-2)" 470 - "UslpHeader" 471 - [ Wire.typedef ~entrypoint:true struct_ ] 482 + Wire.Everparse.Raw.module_ 483 + ~doc:"CCSDS USLP Transfer Frame Primary Header (732.1-B-2)" 484 + [ Wire.Everparse.Raw.typedef ~entrypoint:true struct_ ] 472 485 473 486 (* Wire Parse/Encode *) 474 487 let wire_size = Wire.Codec.wire_size codec ··· 476 489 let decode_bytes buf = 477 490 if Bytes.length buf < wire_size then 478 491 Error (Wire.Unexpected_eof { expected = wire_size; got = Bytes.length buf }) 479 - else Ok (Wire.Codec.decode codec buf 0) 492 + else Wire.Codec.decode codec buf 0 480 493 481 494 let decode_string s = 482 495 if String.length s < wire_size then 483 496 Error (Wire.Unexpected_eof { expected = wire_size; got = String.length s }) 484 - else Ok (Wire.Codec.decode codec (Bytes.of_string s) 0) 497 + else Wire.Codec.decode codec (Bytes.of_string s) 0 485 498 486 499 let encode_string t = 487 500 let buf = Bytes.create wire_size in ··· 536 549 })) 537 550 538 551 (* FFI Code Generation *) 539 - let c_stubs () = Wire.to_c_stubs [ struct_ ] 540 - let ml_stubs () = Wire.to_ml_stubs [ struct_ ] 552 + let c_stubs () = Wire_stubs.to_c_stubs [ struct_ ] 553 + let ml_stubs () = Wire_stubs.to_ml_stubs [ struct_ ] 541 554 542 555 (* {1 Constructors} *) 543 556
+2 -2
lib/uslp.mli
··· 245 245 246 246 val codec : packed_header Wire.Codec.t 247 247 248 - val struct_ : Wire.struct_ 248 + val struct_ : Wire.Everparse.struct_ 249 249 (** Wire struct definition for a USLP header. *) 250 250 251 - val module_ : Wire.module_ 251 + val module_ : Wire.Everparse.module_ 252 252 (** Wire module definition for USLP. *) 253 253 254 254 (** {1 Wire Parse/Encode} *)