cddlc 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/data/rfc9171.cddl ADDED
@@ -0,0 +1,334 @@
1
+
2
+ bpv7_start = bundle / #6.55799(bundle)
3
+
4
+ ; Times before 2000 are invalid
5
+
6
+ dtn-time = uint
7
+
8
+ ; CRC enumerated type
9
+
10
+ crc-type = &(
11
+
12
+ crc-none: 0,
13
+
14
+ crc-16bit: 1,
15
+
16
+ crc-32bit: 2
17
+
18
+ )
19
+
20
+ ; Either 16-bit or 32-bit
21
+
22
+ crc-value = (bstr .size 2) / (bstr .size 4)
23
+
24
+ creation-timestamp = [
25
+
26
+ dtn-time, ; absolute time of creation
27
+
28
+ sequence: uint ; sequence within the time
29
+
30
+ ]
31
+
32
+ eid = $eid .within eid-structure
33
+
34
+ eid-structure = [
35
+
36
+ uri-code: uint,
37
+
38
+ SSP: any
39
+
40
+ ]
41
+
42
+ $eid /= [
43
+
44
+ uri-code: 1,
45
+
46
+ SSP: (tstr / 0)
47
+
48
+ ]
49
+
50
+ $eid /= [
51
+
52
+ uri-code: 2,
53
+
54
+ SSP: [
55
+
56
+ nodenum: uint,
57
+
58
+ servicenum: uint
59
+
60
+ ]
61
+
62
+ ]
63
+
64
+ ; The root bundle array
65
+
66
+ bundle = [primary-block, *extension-block, payload-block]
67
+
68
+ primary-block = [
69
+
70
+ version: 7,
71
+
72
+ bundle-control-flags,
73
+
74
+ crc-type,
75
+
76
+ destination: eid,
77
+
78
+ source-node: eid,
79
+
80
+ report-to: eid,
81
+
82
+ creation-timestamp,
83
+
84
+ lifetime: uint,
85
+
86
+ ? (
87
+
88
+ fragment-offset: uint,
89
+
90
+ total-application-data-length: uint
91
+
92
+ ),
93
+
94
+ ? crc-value,
95
+
96
+ ]
97
+
98
+ bundle-control-flags = uint .bits bundleflagbits
99
+
100
+ bundleflagbits = &(
101
+
102
+ reserved: 20,
103
+
104
+ reserved: 19,
105
+
106
+ bundle-deletion-status-reports-are-requested: 18,
107
+
108
+ bundle-delivery-status-reports-are-requested: 17,
109
+
110
+ bundle-forwarding-status-reports-are-requested: 16,
111
+
112
+ reserved: 15,
113
+
114
+ bundle-reception-status-reports-are-requested: 14,
115
+
116
+ reserved: 13,
117
+
118
+ reserved: 12,
119
+
120
+ reserved: 11,
121
+
122
+ reserved: 10,
123
+
124
+ reserved: 9,
125
+
126
+ reserved: 8,
127
+
128
+ reserved: 7,
129
+
130
+ status-time-is-requested-in-all-status-reports: 6,
131
+
132
+ user-application-acknowledgement-is-requested: 5,
133
+
134
+ reserved: 4,
135
+
136
+ reserved: 3,
137
+
138
+ bundle-must-not-be-fragmented: 2,
139
+
140
+ payload-is-an-administrative-record: 1,
141
+
142
+ bundle-is-a-fragment: 0
143
+
144
+ )
145
+
146
+ ; Abstract shared structure of all non-primary blocks
147
+
148
+ canonical-block-structure = [
149
+
150
+ block-type-code: uint,
151
+
152
+ block-number: uint,
153
+
154
+ block-control-flags,
155
+
156
+ crc-type,
157
+
158
+ ; Each block type defines the content within the byte string
159
+
160
+ block-type-specific-data,
161
+
162
+ ? crc-value
163
+
164
+ ]
165
+
166
+ block-control-flags = uint .bits blockflagbits
167
+
168
+ blockflagbits = &(
169
+
170
+ reserved: 7,
171
+
172
+ reserved: 6,
173
+
174
+ reserved: 5,
175
+
176
+ block-must-be-removed-from-bundle-if-it-cannot-be-processed: 4,
177
+
178
+ reserved: 3,
179
+
180
+ bundle-must-be-deleted-if-block-cannot-be-processed: 2,
181
+
182
+ status-report-must-be-transmitted-if-block-cannot-be-processed:
183
+ 1,
184
+
185
+ block-must-be-replicated-in-every-fragment: 0
186
+
187
+ )
188
+
189
+ block-type-specific-data = bstr / #6.24(bstr)
190
+
191
+ ; Actual CBOR data embedded in a byte string, with optional tag to
192
+ ; indicate so.
193
+
194
+ ; Additional plain bstr allows ciphertext data.
195
+
196
+ embedded-cbor<Item> = (bstr .cbor Item) / #6.24(bstr .cbor Item) /
197
+ bstr
198
+
199
+ ; Extension block type, which does not specialize other than the
200
+ ; code/number
201
+
202
+ extension-block =
203
+ $extension-block .within canonical-block-structure
204
+
205
+ ; Generic shared structure of all non-primary blocks
206
+
207
+ extension-block-use<CodeValue, BlockData> = [
208
+
209
+ block-type-code: CodeValue,
210
+
211
+ block-number: (uint .gt 1),
212
+
213
+ block-control-flags,
214
+
215
+ crc-type,
216
+
217
+ BlockData,
218
+
219
+ ? crc-value
220
+
221
+ ]
222
+
223
+ ; Payload block type
224
+
225
+ payload-block = payload-block-structure .within
226
+ canonical-block-structure
227
+
228
+ payload-block-structure = [
229
+
230
+ block-type-code: 1,
231
+
232
+ block-number: 1,
233
+
234
+ block-control-flags,
235
+
236
+ crc-type,
237
+
238
+ $payload-block-data,
239
+
240
+ ? crc-value
241
+
242
+ ]
243
+
244
+ ; Arbitrary payload data, including non-CBOR byte string
245
+
246
+ $payload-block-data /= block-type-specific-data
247
+
248
+ ; Administrative record as a payload data specialization
249
+
250
+ $payload-block-data /= embedded-cbor<admin-record>
251
+
252
+ admin-record = $admin-record .within admin-record-structure
253
+
254
+ admin-record-structure = [
255
+
256
+ record-type-code: uint,
257
+
258
+ record-content: any
259
+
260
+ ]
261
+
262
+ ; Only one defined record type
263
+
264
+ $admin-record /= [1, status-record-content]
265
+
266
+ status-record-content = [
267
+
268
+ bundle-status-information,
269
+
270
+ status-report-reason-code: uint,
271
+
272
+ source-node-eid: eid,
273
+
274
+ subject-creation-timestamp: creation-timestamp,
275
+
276
+ ? (
277
+
278
+ subject-payload-offset: uint,
279
+
280
+ subject-payload-length: uint
281
+
282
+ )
283
+
284
+ ]
285
+
286
+ bundle-status-information = [
287
+
288
+ reporting-node-received-bundle: status-info-content,
289
+
290
+ reporting-node-forwarded-bundle: status-info-content,
291
+
292
+ reporting-node-delivered-bundle: status-info-content,
293
+
294
+ reporting-node-deleted-bundle: status-info-content
295
+
296
+ ]
297
+
298
+ status-info-content = [
299
+
300
+ status-indicator: bool,
301
+
302
+ ? timestamp: dtn-time
303
+
304
+ ]
305
+
306
+ ; Previous Node extension block
307
+
308
+ $extension-block /=
309
+
310
+ extension-block-use<6, embedded-cbor<ext-data-previous-node>>
311
+
312
+ ext-data-previous-node = eid
313
+
314
+ ; Bundle Age extension block
315
+
316
+ $extension-block /=
317
+
318
+ extension-block-use<7, embedded-cbor<ext-data-bundle-age>>
319
+
320
+ ext-data-bundle-age = uint
321
+
322
+ ; Hop Count extension block
323
+
324
+ $extension-block /=
325
+
326
+ extension-block-use<10, embedded-cbor<ext-data-hop-count>>
327
+
328
+ ext-data-hop-count = [
329
+
330
+ hop-limit: uint,
331
+
332
+ hop-count: uint
333
+
334
+ ]
data/data/rfc9173.cddl ADDED
@@ -0,0 +1,36 @@
1
+
2
+ start = scope / AAD-list / IPPT-list ; satisfy CDDL decoders
3
+
4
+ scope = uint .bits scope-flags
5
+ scope-flags = &(
6
+ has-primary-ctx: 0,
7
+ has-target-ctx: 1,
8
+ has-security-ctx: 2,
9
+ )
10
+
11
+ ; Encoded as a CBOR sequence
12
+ AAD-list = [
13
+ AAD-structure
14
+ ]
15
+
16
+ ; Encoded as a CBOR sequence
17
+ IPPT-list = [
18
+ AAD-structure,
19
+ target-btsd: bstr ; block-type-specific data of the target block.
20
+ ]
21
+
22
+ AAD-structure = (
23
+ scope,
24
+ ? primary-block, ; present if has-primary-ctx flag set
25
+ ? block-metadata, ; present if has-target-ctx flag set
26
+ ? block-metadata, ; present if has-security-ctx flag set
27
+ )
28
+
29
+ ; Selected fields of a canonical block
30
+ block-metadata = (
31
+ block-type-code: uint,
32
+ block-number: uint,
33
+ block-control-flags,
34
+ )
35
+
36
+ ;# import rfc9171
data/data/rfc9177.cddl ADDED
@@ -0,0 +1,6 @@
1
+
2
+ ; This defines an array, the elements of which are to be used
3
+ ; in a CBOR Sequence:
4
+ payload = [+ missing-block-number]
5
+ ; A unique block number not received:
6
+ missing-block-number = uint
data/data/rfc9202.cddl ADDED
@@ -0,0 +1,6 @@
1
+
2
+ info = [
3
+ type : tstr,
4
+ L : uint,
5
+ access_token : bytes
6
+ ]
data/data/rfc9203.cddl ADDED
@@ -0,0 +1,11 @@
1
+
2
+ OSCORE_Input_Material = {
3
+ ? 0 => bstr, ; id
4
+ ? 1 => int, ; version
5
+ ? 2 => bstr, ; ms
6
+ ? 3 => tstr / int, ; hkdf
7
+ ? 4 => tstr / int, ; alg
8
+ ? 5 => bstr, ; salt
9
+ ? 6 => bstr, ; contextId
10
+ * (int / tstr) => any
11
+ }
data/data/rfc9237.cddl ADDED
@@ -0,0 +1,27 @@
1
+
2
+ AIF-Generic<Toid, Tperm> = [* [Toid, Tperm]]
3
+
4
+
5
+ AIF-Specific = AIF-Generic<tstr, uint>
6
+
7
+
8
+ AIF-REST = AIF-Generic<local-path, REST-method-set>
9
+ local-path = tstr ; URI relative to enforcement point
10
+ REST-method-set = uint .bits methods
11
+ methods = &(
12
+ GET: 0
13
+ POST: 1
14
+ PUT: 2
15
+ DELETE: 3
16
+ FETCH: 4
17
+ PATCH: 5
18
+ iPATCH: 6
19
+ Dynamic-GET: 32; 0 .plus Dynamic-Offset
20
+ Dynamic-POST: 33; 1 .plus Dynamic-Offset
21
+ Dynamic-PUT: 34; 2 .plus Dynamic-Offset
22
+ Dynamic-DELETE: 35; 3 .plus Dynamic-Offset
23
+ Dynamic-FETCH: 36; 4 .plus Dynamic-Offset
24
+ Dynamic-PATCH: 37; 5 .plus Dynamic-Offset
25
+ Dynamic-iPATCH: 38; 6 .plus Dynamic-Offset
26
+ )
27
+ Dynamic-Offset = 32
data/data/rfc9277.cddl ADDED
@@ -0,0 +1,11 @@
1
+
2
+ senml-cbor = #6.1668546929(bstr)
3
+
4
+
5
+ missing-blocks = #6.1668547090(bstr)
6
+
7
+
8
+ td-json-header = #6.55801(#6.1668547250('BOR'))
9
+
10
+
11
+ json-deflate-header = #6.55801(#6.1668557910('BOR'))
data/data/rfc9290.cddl ADDED
@@ -0,0 +1,37 @@
1
+
2
+ problem-details = non-empty<{
3
+ ? &(title: -1) => oltext
4
+ ? &(detail: -2) => oltext
5
+ ? &(instance: -3) => ~uri
6
+ ? &(response-code: -4) => uint .size 1
7
+ ? &(base-uri: -5) => ~uri
8
+ ? &(base-lang: -6) => tag38-ltag
9
+ ? &(base-rtl: -7) => tag38-direction
10
+ standard-problem-detail-entries
11
+ custom-problem-detail-entries
12
+ }>
13
+
14
+ standard-problem-detail-entries = (
15
+ * nint => any
16
+ )
17
+
18
+ custom-problem-detail-entries = (
19
+ * (uint/~uri) => { + any => any }
20
+ )
21
+
22
+ non-empty<M> = (M) .and ({ + any => any })
23
+
24
+ oltext = text / tag38
25
+
26
+
27
+
28
+ tag38 = #6.38([tag38-ltag, text, ?tag38-direction])
29
+ tag38-ltag = text .regexp "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
30
+ tag38-direction = &(ltr: false, rtl: true, auto: null)
31
+
32
+
33
+ tunnel-7807 = {
34
+ ? &(type: 0) => ~uri
35
+ ? &(status: 1) => 0..999
36
+ * text => any
37
+ }
data/data/rfc9321.cddl ADDED
@@ -0,0 +1,67 @@
1
+
2
+ svt = {
3
+ jti: text
4
+ iss: text
5
+ iat: uint
6
+ ? aud: text / [* text]
7
+ ? exp: uint
8
+ sig_val_claims: SigValClaims
9
+ }
10
+
11
+ SigValClaims = {
12
+ ver: text
13
+ profile: text
14
+ hash_algo: text
15
+ sig: [+ Signature]
16
+ ? ext: Extension
17
+ }
18
+
19
+ Signature = {
20
+ sig_ref: SigReference
21
+ sig_data_ref: [+ SignedDataReference]
22
+ signer_cert_ref: CertReference
23
+ sig_val: [+ PolicyValidation]
24
+ ? time_val: [* TimeValidation]
25
+ ? ext: Extension
26
+ }
27
+
28
+ SigReference = {
29
+ ? id: text / null
30
+ sig_hash: binary-value
31
+ sb_hash: binary-value
32
+ }
33
+
34
+ SignedDataReference = {
35
+ ref: text
36
+ hash: binary-value
37
+ }
38
+
39
+
40
+ CertReference = {
41
+ type: "chain" / "chain_hash"
42
+ ref: [+ text]
43
+ }
44
+
45
+ PolicyValidation = {
46
+ pol: text
47
+ res: "PASSED" / "FAILED" / "INDETERMINATE"
48
+ ? msg: text / null
49
+ ? ext: Extension
50
+ }
51
+
52
+ TimeValidation = {
53
+ "time": uint
54
+ type: text
55
+ iss: text
56
+ ? id: text / null
57
+ ? hash: binary-value / null
58
+ ? val: [* PolicyValidation]
59
+ ? ext: Extension
60
+ }
61
+
62
+
63
+ Extension = {
64
+ + text => text
65
+ } / null
66
+
67
+ binary-value = text ; base64 classic with padding
data/data/rfc9338.cddl ADDED
@@ -0,0 +1,34 @@
1
+
2
+ start = COSE_Countersignature_Tagged / Internal_Types
3
+
4
+ ; This is defined to make the tool quieter:
5
+ Internal_Types = Countersign_structure / COSE_Countersignature0
6
+
7
+
8
+ CountersignatureV2_header = (
9
+ ? 11 => COSE_Countersignature / [+ COSE_Countersignature]
10
+ )
11
+
12
+ Countersignature0V2_header = (
13
+ ? 12 => COSE_Countersignature0
14
+ )
15
+
16
+
17
+ COSE_Countersignature_Tagged = #6.19(COSE_Countersignature)
18
+ COSE_Countersignature = COSE_Signature
19
+
20
+
21
+ COSE_Countersignature0 = bstr
22
+
23
+
24
+ Countersign_structure = [
25
+ context : "CounterSignature" / "CounterSignature0" /
26
+ "CounterSignatureV2" / "CounterSignature0V2",
27
+ body_protected : empty_or_serialized_map,
28
+ ? sign_protected : empty_or_serialized_map,
29
+ external_aad : bstr,
30
+ payload : bstr,
31
+ ? other_fields : [+ bstr ]
32
+ ]
33
+
34
+ ;# import rfc9052