Commit b4cec57
committed
blockwise: stream single-record SenML-CBOR vd blobs over Block1 (Step L15)
ThingsBoard wraps every RPC write in SenML-CBOR for a ct="11542 112"
client — including multi-kilobyte blobs, which then ride Block1. The
Block1 lane was opaque-only (structured formats drew 4.13 by design), so
every TB blob write failed on the first block. This teaches the lane the
one SenML shape that can stream: a single-record CBOR pack whose only
value is a definite-length vd byte string, on a resource-level PUT.
parse_cbor_blob_prefix reads the record header off block 0 (all of it
must fit there, or 4.13); the blob bytes then flow into write_chunk
blob-relative, and max_block1_size bounds the blob, not the envelope.
The wire truth, pinned from a live capture against leshan-demo-server:
Leshan (and therefore ThingsBoard) emits the value FIRST and the name
AFTER the blob — [{vd, n}] — so the record's name is generally unknown
until the final block. Fields trailing the blob buffer (<= 512 B, more
is not a name) and parse_cbor_blob_trailing resolves the name at
transfer end; the finale — write_chunk(last) inside the transaction
bracket — runs only after the resolved name matches the request path.
A lying name aborts with 4.00 and nothing commits. Name-leading packs
(this library's own encoder order) validate on block 0 instead.
SenML-JSON, multi-record packs and non-vd values stay 4.13; envelopes
that lie about the blob length draw 4.00 mid-transfer.
Tests: 14 blockwise scenarios (both field orders, end-validation abort
with no transaction opened, trailing spanning blocks with the empty
finale, SZX downshift blob-offset math, cap-excludes-header, trailing
cap, unstreamable/malformed matrices), 7 parser vectors including the
live-captured Leshan prefix bytes, and a Leshan e2e writing a 4 KiB
opaque as SENML_CBOR through real Californium Block1 plus a small-write
dispatch-path leg (verified against a native Leshan before push). The
blockwise fuzz target gained a streaming write_chunk sink and a SenML
Block1 seed (2.3M-run smoke clean).
Version 0.1.6.1 parent d745f36 commit b4cec57
11 files changed
Lines changed: 1679 additions & 25 deletions
File tree
- crates
- lekki-testkit/tests
- lekki/src
- coap
- codec
- docs
- fuzz
- fuzz_targets
- seeds/blockwise
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
182 | 187 | | |
183 | 188 | | |
184 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
185 | 278 | | |
186 | 279 | | |
187 | 280 | | |
| |||
214 | 307 | | |
215 | 308 | | |
216 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
217 | 314 | | |
218 | 315 | | |
219 | 316 | | |
| |||
235 | 332 | | |
236 | 333 | | |
237 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
238 | 340 | | |
239 | 341 | | |
240 | 342 | | |
| |||
783 | 885 | | |
784 | 886 | | |
785 | 887 | | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
786 | 948 | | |
787 | 949 | | |
788 | 950 | | |
| |||
0 commit comments