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.

ltp: extend ion-dtn SDNV interop (15→20 vectors, add length check)

Add boundary values (2^21-1, 2^28-1, 2^28, 6-byte value) covering
every SDNV byte-width from 1-9 bytes. Add length field to CSV and
verify String.length matches ion-dtn's sdnv.length.

60 tests (20 encode + 20 decode + 20 roundtrip) against ion-dtn's
encodeSdnv (NASA JPL, RFC 6256).

+50 -25
test/interop/ion/scripts/generate

This is a binary file and will not be displayed.

+17 -6
test/interop/ion/scripts/generate.c
··· 20 20 static void emit_sdnv(FILE *f, const char *name, uvast value) { 21 21 Sdnv sdnv; 22 22 encodeSdnv(&sdnv, value); 23 - fprintf(f, "%s,%llu,", name, (unsigned long long)value); 23 + fprintf(f, "%s,%llu,%d,", name, (unsigned long long)value, sdnv.length); 24 24 for (int i = 0; i < sdnv.length; i++) 25 25 fprintf(f, "%02x", sdnv.text[i]); 26 26 fprintf(f, "\n"); ··· 40 40 return 1; 41 41 } 42 42 43 - fprintf(f, "name,value,encoded_hex\n"); 43 + fprintf(f, "name,value,length,encoded_hex\n"); 44 44 45 - /* Single-byte boundary */ 45 + /* Single-byte boundary: 0..127 (7 bits) */ 46 46 emit_sdnv(f, "zero", 0); 47 47 emit_sdnv(f, "one", 1); 48 48 emit_sdnv(f, "v_127", 127); 49 49 50 - /* Two-byte boundary */ 50 + /* Two-byte boundary: 128..16383 (14 bits) */ 51 51 emit_sdnv(f, "v_128", 128); 52 52 emit_sdnv(f, "v_255", 255); 53 53 emit_sdnv(f, "v_256", 256); 54 + emit_sdnv(f, "v_16383", 16383); 54 55 55 - /* Three-byte boundary */ 56 - emit_sdnv(f, "v_16383", 16383); 56 + /* Three-byte boundary: 16384..2^21-1 (21 bits) */ 57 57 emit_sdnv(f, "v_16384", 16384); 58 + emit_sdnv(f, "v_2097151", (uvast)2097151ULL); /* 2^21-1 */ 59 + 60 + /* Four-byte boundary: 2^21..2^28-1 (28 bits) */ 61 + emit_sdnv(f, "v_2097152", (uvast)2097152ULL); /* 2^21 */ 62 + emit_sdnv(f, "v_268435455", (uvast)268435455ULL); /* 2^28-1 */ 63 + 64 + /* Five-byte boundary: 2^28..2^35-1 (35 bits) */ 65 + emit_sdnv(f, "v_268435456", (uvast)268435456ULL); /* 2^28 */ 58 66 59 67 /* RFC 6256 spec test vectors */ 60 68 emit_sdnv(f, "rfc_0x7f", 0x7F); ··· 67 75 68 76 /* 32-bit max */ 69 77 emit_sdnv(f, "v_0xffffffff", (uvast)0xFFFFFFFFULL); 78 + 79 + /* Large values */ 80 + emit_sdnv(f, "v_0x123456789a", (uvast)0x123456789aULL); 70 81 71 82 /* 63-bit max (largest positive int64) */ 72 83 emit_sdnv(f, "v_0x7fffffffffffffff", (uvast)0x7FFFFFFFFFFFFFFFULL);
+12 -3
test/interop/ion/test.ml
··· 23 23 24 24 (* --- CSV row type and codec --- *) 25 25 26 - type vector = { name : string; value : int64; encoded_hex : string } 26 + type vector = { 27 + name : string; 28 + value : int64; 29 + length : int; 30 + encoded_hex : string; 31 + } 27 32 28 33 let vector_codec = 29 34 Csvt.( 30 35 Row.( 31 - obj (fun name value encoded_hex -> { name; value; encoded_hex }) 36 + obj (fun name value length encoded_hex -> 37 + { name; value; length; encoded_hex }) 32 38 |> col "name" string ~enc:(fun v -> v.name) 33 39 |> col "value" int64 ~enc:(fun v -> v.value) 40 + |> col "length" int ~enc:(fun v -> v.length) 34 41 |> col "encoded_hex" string ~enc:(fun v -> v.encoded_hex) 35 42 |> finish)) 36 43 ··· 42 49 (* --- Test: encode matches ION --- *) 43 50 44 51 let test_encode vec () = 45 - let got_hex = hex_of_string (Ltp.encode_sdnv vec.value) in 52 + let encoded = Ltp.encode_sdnv vec.value in 53 + Alcotest.(check int) (vec.name ^ ": length") vec.length (String.length encoded); 54 + let got_hex = hex_of_string encoded in 46 55 if got_hex <> vec.encoded_hex then 47 56 Alcotest.failf "%s: encode mismatch\n expected: %s\n got: %s" 48 57 vec.name vec.encoded_hex got_hex
+21 -16
test/interop/ion/traces/sdnv.csv
··· 1 - name,value,encoded_hex 2 - zero,0,00 3 - one,1,01 4 - v_127,127,7f 5 - v_128,128,8100 6 - v_255,255,817f 7 - v_256,256,8200 8 - v_16383,16383,ff7f 9 - v_16384,16384,818000 10 - rfc_0x7f,127,7f 11 - rfc_0xabc,2748,953c 12 - rfc_0x1234,4660,a434 13 - rfc_0x4234,16948,818434 14 - v_0xffff,65535,83ff7f 15 - v_0xffffffff,4294967295,8fffffff7f 16 - v_0x7fffffffffffffff,9223372036854775807,ffffffffffffffff7f 1 + name,value,length,encoded_hex 2 + zero,0,1,00 3 + one,1,1,01 4 + v_127,127,1,7f 5 + v_128,128,2,8100 6 + v_255,255,2,817f 7 + v_256,256,2,8200 8 + v_16383,16383,2,ff7f 9 + v_16384,16384,3,818000 10 + v_2097151,2097151,3,ffff7f 11 + v_2097152,2097152,4,81808000 12 + v_268435455,268435455,4,ffffff7f 13 + v_268435456,268435456,5,8180808000 14 + rfc_0x7f,127,1,7f 15 + rfc_0xabc,2748,2,953c 16 + rfc_0x1234,4660,2,a434 17 + rfc_0x4234,16948,3,818434 18 + v_0xffff,65535,3,83ff7f 19 + v_0xffffffff,4294967295,5,8fffffff7f 20 + v_0x123456789a,78187493530,6,82a3a2d9f11a 21 + v_0x7fffffffffffffff,9223372036854775807,9,ffffffffffffffff7f