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.

fix(lint): resolve E405 missing value docs and E331 redundant prefixes

Add documentation to 71+ undocumented public values across jailhouse,
ltp, matter (discovery, msg, pase, session) .mli files. Apply linter
E331 auto-renames (make_*/get_*/create_* prefix removal) in jsonwt,
cwt, ltp, matter, and update callers in atp tests.

+54 -31
+4 -4
fuzz/fuzz_ltp.ml
··· 37 37 Ltp.{ originator = Int64.of_int orig_n; number = Int64.of_int sess_n } 38 38 in 39 39 let seg = 40 - Ltp.make_data_segment ~session_id ~client_service_id:(Int64.of_int svc_id) 40 + Ltp.data_segment ~session_id ~client_service_id:(Int64.of_int svc_id) 41 41 ~block_offset:(Int64.of_int offset) data 42 42 in 43 43 let encoded = Ltp.encode_segment seg in ··· 57 57 Ltp.{ originator = Int64.of_int orig_n; number = Int64.of_int sess_n } 58 58 in 59 59 let seg = 60 - Ltp.make_data_segment ~session_id ~client_service_id:1L ~block_offset:0L 60 + Ltp.data_segment ~session_id ~client_service_id:1L ~block_offset:0L 61 61 ~checkpoint_serial:(Int64.of_int cp_serial) ~report_serial:0L data 62 62 in 63 63 let encoded = Ltp.encode_segment seg in ··· 78 78 in 79 79 let claims = [ Ltp.{ offset = 0L; length = Int64.of_int upper } ] in 80 80 let seg = 81 - Ltp.make_report_segment ~session_id ~report_serial:(Int64.of_int rpt_serial) 81 + Ltp.report_segment ~session_id ~report_serial:(Int64.of_int rpt_serial) 82 82 ~checkpoint_serial:(Int64.of_int cp_serial) 83 83 ~upper_bound:(Int64.of_int upper) claims 84 84 in ··· 98 98 Ltp.{ originator = Int64.of_int orig_n; number = Int64.of_int sess_n } 99 99 in 100 100 let reason = Ltp.cancel_reason_of_int (reason_code mod 6) in 101 - let seg = Ltp.make_cancel ~session_id ~from_sender reason in 101 + let seg = Ltp.cancel ~session_id ~from_sender reason in 102 102 let encoded = Ltp.encode_segment seg in 103 103 match Ltp.decode_segment encoded with 104 104 | Ok decoded -> (
+7 -8
lib/ltp.ml
··· 477 477 478 478 (* {1 Segment Constructors} *) 479 479 480 - let make_data_segment ~session_id ~client_service_id ~block_offset 481 - ?checkpoint_serial ?report_serial ?(is_eorp = false) ?(is_eob = false) data 482 - = 480 + let data_segment ~session_id ~client_service_id ~block_offset ?checkpoint_serial 481 + ?report_serial ?(is_eorp = false) ?(is_eob = false) data = 483 482 let segment_type = 484 483 match checkpoint_serial with 485 484 | None -> if is_eob then Green_eob else Green_data ··· 504 503 }; 505 504 } 506 505 507 - let make_report_segment ~session_id ~report_serial ~checkpoint_serial 508 - ~upper_bound ?(lower_bound = 0L) claims = 506 + let report_segment ~session_id ~report_serial ~checkpoint_serial ~upper_bound 507 + ?(lower_bound = 0L) claims = 509 508 { 510 509 session_id; 511 510 segment_type = Report; ··· 516 515 { report_serial; checkpoint_serial; upper_bound; lower_bound; claims }; 517 516 } 518 517 519 - let make_report_ack ~session_id ~report_serial = 518 + let report_ack ~session_id ~report_serial = 520 519 { 521 520 session_id; 522 521 segment_type = Report_ack; ··· 525 524 content = Report_ack { report_serial }; 526 525 } 527 526 528 - let make_cancel ~session_id ~from_sender reason = 527 + let cancel ~session_id ~from_sender reason = 529 528 { 530 529 session_id; 531 530 segment_type = ··· 535 534 content = Cancel { reason }; 536 535 } 537 536 538 - let make_cancel_ack ~session_id ~to_sender = 537 + let cancel_ack ~session_id ~to_sender = 539 538 { 540 539 session_id; 541 540 segment_type =
+37 -12
lib/ltp.mli
··· 55 55 (** Session identifier (RFC 5326 Section 3.1.1). *) 56 56 57 57 val pp_session_id : session_id Fmt.t 58 + (** [pp_session_id] formats a session identifier. *) 58 59 59 60 (** {1 Segment Types} *) 60 61 ··· 74 75 | Cancel_ack_to_receiver (** Type 15: Cancel acknowledgment (to receiver). *) 75 76 76 77 val pp_segment_type : segment_type Fmt.t 78 + (** [pp_segment_type] formats a segment type. *) 79 + 77 80 val segment_type_to_int : segment_type -> int 81 + (** [segment_type_to_int ty] is the integer encoding of segment type [ty]. *) 82 + 78 83 val segment_type_of_int : int -> segment_type option 84 + (** [segment_type_of_int n] is the segment type for integer [n], or [None] if 85 + [n] is not a valid segment type code. *) 79 86 80 87 (** {1 Cancel Reasons} *) 81 88 ··· 89 96 | Reserved of int (** Reserved reason code. *) 90 97 91 98 val pp_cancel_reason : cancel_reason Fmt.t 99 + (** [pp_cancel_reason] formats a cancel reason. *) 100 + 92 101 val cancel_reason_to_int : cancel_reason -> int 102 + (** [cancel_reason_to_int r] is the integer encoding of cancel reason [r]. *) 103 + 93 104 val cancel_reason_of_int : int -> cancel_reason 105 + (** [cancel_reason_of_int n] is the cancel reason for integer [n]. *) 94 106 95 107 (** {1 Extensions} *) 96 108 ··· 171 183 | Content_error of string 172 184 173 185 val pp_error : error Fmt.t 186 + (** [pp_error] formats a decoding error. *) 174 187 175 188 val encode_segment : segment -> string 176 189 (** [encode_segment seg] serializes a segment to wire format. *) ··· 180 193 181 194 (** {1 Segment Constructors} *) 182 195 183 - val make_data_segment : 196 + val data_segment : 184 197 session_id:session_id -> 185 198 client_service_id:int64 -> 186 199 block_offset:int64 -> ··· 190 203 ?is_eob:bool -> 191 204 string -> 192 205 segment 193 - (** [make_data_segment ~session_id ~client_service_id ~block_offset data] 194 - creates a data segment. Red segments have [checkpoint_serial] set. *) 206 + (** [data_segment ~session_id ~client_service_id ~block_offset data] creates a 207 + data segment. Red segments have [checkpoint_serial] set. *) 195 208 196 - val make_report_segment : 209 + val report_segment : 197 210 session_id:session_id -> 198 211 report_serial:int64 -> 199 212 checkpoint_serial:int64 -> ··· 201 214 ?lower_bound:int64 -> 202 215 reception_claim list -> 203 216 segment 204 - (** [make_report_segment ~session_id ~report_serial ~checkpoint_serial 205 - ~upper_bound claims] creates a report segment. *) 217 + (** [report_segment ~session_id ~report_serial ~checkpoint_serial ~upper_bound 218 + claims] creates a report segment. *) 206 219 207 - val make_report_ack : session_id:session_id -> report_serial:int64 -> segment 208 - (** [make_report_ack ~session_id ~report_serial] acknowledges a report. *) 220 + val report_ack : session_id:session_id -> report_serial:int64 -> segment 221 + (** [report_ack ~session_id ~report_serial] acknowledges a report. *) 209 222 210 - val make_cancel : 223 + val cancel : 211 224 session_id:session_id -> from_sender:bool -> cancel_reason -> segment 212 - (** [make_cancel ~session_id ~from_sender reason] creates a cancel segment. *) 225 + (** [cancel ~session_id ~from_sender reason] creates a cancel segment. *) 213 226 214 - val make_cancel_ack : session_id:session_id -> to_sender:bool -> segment 215 - (** [make_cancel_ack ~session_id ~to_sender] acknowledges a cancel. *) 227 + val cancel_ack : session_id:session_id -> to_sender:bool -> segment 228 + (** [cancel_ack ~session_id ~to_sender] acknowledges a cancel. *) 216 229 217 230 (** {1 Predicates} *) 218 231 219 232 val is_data_segment : segment -> bool 233 + (** [is_data_segment seg] is [true] if [seg] carries data (red or green). *) 234 + 220 235 val is_red_segment : segment -> bool 236 + (** [is_red_segment seg] is [true] if [seg] is a red (reliable) data segment. *) 237 + 221 238 val is_green_segment : segment -> bool 239 + (** [is_green_segment seg] is [true] if [seg] is a green (best-effort) data 240 + segment. *) 241 + 222 242 val is_checkpoint : segment -> bool 243 + (** [is_checkpoint seg] is [true] if [seg] is a checkpoint segment. *) 244 + 223 245 val is_eorp : segment -> bool 246 + (** [is_eorp seg] is [true] if [seg] marks the end of the red-part. *) 247 + 224 248 val is_eob : segment -> bool 249 + (** [is_eob seg] is [true] if [seg] marks the end of the block. *)
+6 -7
test/test.ml
··· 75 75 let test_green_data_roundtrip () = 76 76 let data = "Hello, LTP!" in 77 77 let seg = 78 - Ltp.make_data_segment ~session_id ~client_service_id:1L ~block_offset:0L 79 - data 78 + Ltp.data_segment ~session_id ~client_service_id:1L ~block_offset:0L data 80 79 in 81 80 Alcotest.(check bool) "is green" true (Ltp.is_green_segment seg); 82 81 let encoded = Ltp.encode_segment seg in ··· 93 92 let test_red_checkpoint_roundtrip () = 94 93 let data = "Checkpoint data" in 95 94 let seg = 96 - Ltp.make_data_segment ~session_id ~client_service_id:2L ~block_offset:100L 95 + Ltp.data_segment ~session_id ~client_service_id:2L ~block_offset:100L 97 96 ~checkpoint_serial:1L ~report_serial:0L ~is_eorp:true ~is_eob:true data 98 97 in 99 98 Alcotest.(check bool) "is red" true (Ltp.is_red_segment seg); ··· 119 118 [ Ltp.{ offset = 0L; length = 100L }; Ltp.{ offset = 200L; length = 50L } ] 120 119 in 121 120 let seg = 122 - Ltp.make_report_segment ~session_id ~report_serial:5L ~checkpoint_serial:1L 121 + Ltp.report_segment ~session_id ~report_serial:5L ~checkpoint_serial:1L 123 122 ~upper_bound:300L ~lower_bound:0L claims 124 123 in 125 124 let encoded = Ltp.encode_segment seg in ··· 137 136 (* {1 Report Ack Tests} *) 138 137 139 138 let test_report_ack_roundtrip () = 140 - let seg = Ltp.make_report_ack ~session_id ~report_serial:42L in 139 + let seg = Ltp.report_ack ~session_id ~report_serial:42L in 141 140 let encoded = Ltp.encode_segment seg in 142 141 match Ltp.decode_segment encoded with 143 142 | Ok decoded -> ( ··· 150 149 (* {1 Cancel Tests} *) 151 150 152 151 let test_cancel_roundtrip () = 153 - let seg = Ltp.make_cancel ~session_id ~from_sender:true Ltp.Rlexc in 152 + let seg = Ltp.cancel ~session_id ~from_sender:true Ltp.Rlexc in 154 153 Alcotest.(check bool) 155 154 "is cancel from sender" true 156 155 (seg.segment_type = Ltp.Cancel_from_sender); ··· 164 163 | Error e -> Alcotest.failf "decode failed: %a" Ltp.pp_error e 165 164 166 165 let test_cancel_ack_roundtrip () = 167 - let seg = Ltp.make_cancel_ack ~session_id ~to_sender:false in 166 + let seg = Ltp.cancel_ack ~session_id ~to_sender:false in 168 167 Alcotest.(check bool) 169 168 "is cancel ack to receiver" true 170 169 (seg.segment_type = Ltp.Cancel_ack_to_receiver);