1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
|
# This yaml describes packet headers and their fields
#######################################################################
# Root, reserved starting point
- class: 'root'
gui_representation:
help: 'Root'
next_headers: ['ethernet', 'llc', '_802-3']
#######################################################################
# Protocols
# L2
- class: 'ethernet'
gui_representation:
help: 'Ethernet-L2'
properties: ['external']
default: [0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00]
fields:
- name: 'Dst'
gui_representation:
help: 'Destination MAC'
type: 'c-mac-addr'
default: [0x77, 0x55, 0x01, 0x00, 0x00, 0x01]
- name: 'Src'
gui_representation:
help: 'Source MAC'
type: 'c-mac-addr'
- name: 'Ethertype'
gui_representation:
help: 'Ethertype'
type: 'uint16'
default: 0x0800
value_based_next_header:
0x0800: 'ipv4'
0x86DD: 'ipv6'
# not implemented
# 0x0806: 'arp'
# 0x8100: 'vlan' # field of 4 bytes added in this case, what to do?
# 0x8847: 'mpls unicast' # unicast or multicast? multicast is 0x8848
default: 'payload'
# L3
- class: 'ipv4'
gui_representation:
help: 'IPv4'
properties: ['external']
fields:
- name: 'ver'
gui_representation:
help: 'Version'
type: 'c-bit'
array_size: 4
default: [0, 1, 0, 0]
properties: ['const']
- name: 'ihl'
gui_representation:
help: 'IHL'
type: 'c-bit'
array_size: 4
default: [0, 1, 0, 1]
properties: ['ipv4_ihl']
- name: 'DSCP'
gui_representation:
help: 'Differentiated Services Code Point'
type: 'c-bit'
array_size: 6
default: [0, 0, 0, 0, 0, 0]
- name: 'ECN'
gui_representation:
help: 'Explicit Congestion Notification'
type: 'c-bit'
array_size: 2
default: [0, 0]
- name: 'total_len'
gui_representation:
help: 'Total Length'
type: 'uint8'
array_size: 2
default: [0, 57]
properties: ['total_length']
- name: 'Identification'
gui_representation:
help: 'Identification'
type: 'uint8'
array_size: 2
default: [0x00, 0x00]
- name: 'Flags'
gui_representation:
help: 'IPv4 Flags'
type: 'c-bit'
array_size: 3
default: [0, 0, 0]
fields:
- name: 'Reserved'
gui_representation:
help: 'Reserved'
type: 'bit'
default: 0
properties: ['const']
- name: 'DF'
gui_representation:
help: "Don't Fragment"
type: 'bit'
default: 0
- name: 'MF'
gui_representation:
help: 'More Fragments'
type: 'bit'
default: 0
- name: 'Fragment Offset'
gui_representation:
help: 'Fragment Offset'
type: 'c-bit'
array_size: 13
default: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- name: 'TTL'
gui_representation:
help: 'Time To Live'
type: 'uint8'
default: 0x80
- name: 'protocol'
type: 'uint8'
default: 0x06
value_based_next_header: &ipv4_next_header
0x06: 'tcp'
0x11: 'udp'
0x29: 'ipv6'
# not implemented
# 0x2F: 'gre'
default: 'payload'
gui_representation:
help: 'IPv4 next protocol field'
combobox_values:
<<: *ipv4_next_header
0x11: 'Next header is UDP' # overrides the description for combo-box
- name: 'ipv4_chksum'
gui_representation:
help: 'IPv4 Header Checksum'
type: 'uint16'
default: [0x0000]
properties: ['ipv4_checksum', 'const']
- name: 'Src'
gui_representation:
help: 'Source IPv4'
type: 'c-ipv4-addr'
- name: 'Dst'
gui_representation:
help: 'Destination IPv4'
type: 'c-ipv4-addr'
# not implemented
# - name: 'Opts' # presence of this field and it's size should be determined in python/java
# help: 'IPv4 options'
# type: 'c-ipv4-options'
- class: 'ipv6'
gui_representation:
help: 'IPv6'
properties: ['external']
fields:
- name: 'ver'
gui_representation:
help: 'Version'
type: 'c-bit'
array_size: 4
default: [0, 1, 1, 0]
properties: ['const']
- name: 'traff_class/diff_serv'
gui_representation:
help: 'Traffic Class/Diff Serv'
type: 'bit'
array_size: 8
default: [0, 0, 0, 0, 0, 0, 0, 0]
- name: 'flow_label'
gui_representation:
help: 'Flow Label'
type: 'bit'
array_size: 20
default: [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
- name: 'payload_length'
gui_representation:
help: 'Payload Length'
type: 'uint16'
default: 40
- name: 'ipv6_next_header'
gui_representation:
help: 'IPv6 Next Header field'
type: 'uint8'
value_based_next_header:
6: 'tcp'
17: 'udp'
41: 'ipv6'
default: 'tcp'
- name: 'hop_limit'
gui_representation:
help: 'IPv6 hop limit'
type: 'uint8'
default: 200
- name: 'Src'
gui_representation:
help: 'Source IPv6'
type: 'c-ipv6-addr'
- name: 'Dst'
gui_representation:
help: 'Destination IPv6'
type: 'c-ipv6-addr'
# L4
- class: 'tcp'
gui_representation:
help: 'TCP'
properties: ['external']
next_headers: ['ipv6', 'ipv4']
fields:
- name: 'src_port'
gui_representation:
help: 'Source Port'
type: 'c-port-16bit'
- name: 'dest_port'
gui_representation:
help: 'Destination Port'
type: 'c-port-16bit'
- name: 'Seq'
gui_representation:
help: 'Sequence number'
type: uint32
default: 0x30000000
- name: 'Ack'
gui_representation:
help: 'Acknowledgment number'
type: uint32
default: 0x30000000
- name: 'Data offset'
gui_representation:
help: 'Data offset'
type: 'c-bit'
array_size: 4
default: [0, 1, 0, 1]
- name: 'Reserved'
gui_representation:
help: 'TCP Reserved'
type: 'bit'
array_size: 3
default: [0, 0, 0]
properties: ['const']
- name: 'flags' # tree with leaf of bits
gui_representation:
help: 'TCP flags'
type: 'c-bit'
array_size: 9
default: [0, 0, 0, 0, 0, 0, 0, 0, 0]
fields:
- name: 'ns'
gui_representation:
help: 'NS flag'
type: 'bit'
default: 0
- name: 'cwr'
gui_representation:
help: 'CWR flag'
type: 'bit'
default: 0
- name: 'ece'
gui_representation:
help: 'ECE flag'
type: 'bit'
default: 0
- name: 'urg'
gui_representation:
help: 'URG flag'
type: 'bit'
default: 0
- name: 'ack'
gui_representation:
help: 'ACK flag'
type: 'bit'
default: 0
- name: 'psh'
gui_representation:
help: 'PSH flag'
type: 'bit'
default: 0
- name: 'rst'
gui_representation:
help: 'RST flag'
type: 'bit'
default: 0
- name: 'syn'
gui_representation:
help: 'SYN flag'
type: 'bit'
default: 0
- name: 'window_size'
gui_representation:
help: 'Window size'
type: uint16
default: 0x0080
- name: 'checksum'
gui_representation:
help: 'Checksum'
type: uint16
default: 0x0000
properties: ['tcp_checksum']
- name: 'urgent_pointer'
gui_representation:
help: 'Urgent pointer'
type: uint16
default: 0x0000
# not implemented
# - name: 'tcp options'
# type: 'c-tcp-options'
- class: 'udp'
gui_representation:
help: 'UDP'
properties: ['external']
next_headers: ['ipv6', 'ipv4']
fields:
- name: 'src_port'
gui_representation:
help: 'Source Port'
type: 'c-port-16bit'
- name: 'dest_port'
gui_representation:
help: 'Destination Port'
type: 'c-port-16bit'
- name: 'length'
gui_representation:
help: 'Length'
type: 'uint16'
default: 0x0020
properties: ['total_length']
- name: 'checksum'
gui_representation:
help: 'UDP Checksum'
type: uint16
default: 0x0000
properties: ['udp_checksum']
#######################################################################
# Fields
- class: 'c-mac-addr'
type: 'uint8'
array_size: 6
default: [0x00, 0x00, 0x01, 0x00, 0x00, 0x00]
gui_representation:
help: 'MAC address'
data_type: 'mac-addr_t' # format ([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}
form_type: 'combo_with_edit'
- class: 'c-ipv4-addr'
type: 'uint8'
array_size: 4
default: [1, 1, 1, 1]
gui_representation:
help: 'IPv4 address'
data_type: 'ipv4_t'
form_type: 'combo_with_edit'
- class: 'c-port-16bit'
type: 'uint16'
default: 0x1234
gui_representation:
help: 'ports of TCP/UDP etc.'
form_type: 'combo_with_edit'
- class: 'c-bit'
type: 'bit'
gui_representation:
help: 'bit with checkbox representation'
form_type: 'checkbox'
- class: 'c-ipv6-addr'
type: 'uint16'
array_size: 8
default: [7, 8, 7, 8, 7, 8, 7, 8]
gui_representation:
help: 'IPv6 address'
data_type: 'ipv6_t'
form_type: 'combo_with_edit'
######################
# incomplete
- class: 'c-ipv4-option'
type: 'vlen_t'
default: 0x01
fields:
- name: 'copied flag'
help: 'Copy the option to all fragments flag'
type: 'c-bit'
default: 0
- name: 'option class'
help: '0 = controls, 2 = debugging'
type: 'bit'
array_size: 2
default: 0
- name: 'option number'
help: 'Option Number'
type: 'bit'
array_size: 5
value_based_next_class:
0: 'end' # reserved name for ending options
1: 'ip_option' # back to itself
2: 'c-ipv4opt-security'
3: 'c-ipv4opt-loose-source-routing'
4: 'c-ipv4opt-internet-timestamp'
7: 'c-ipv4opt-record-route'
8: 'c-ipv4opt-stream-id'
9: 'c-ipv4opt-strict-source-routing'
default: 'end'
- class: 'c-ipv4opt-security'
help: 'ipv4 option security'
type: 'bit'
array_size: 11
default: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
fields:
value_based_next_class:
default: 'c-ipv4-option'
- class: 'c-ipv4opt-loose-source-routing'
help: 'ipv4 option loose source routing'
type: 'bit'
default: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
fields:
value_based_next_class:
default: 'c-ipv4-option'
|