-
Notifications
You must be signed in to change notification settings - Fork 192
/
customnetpdl.xml
2257 lines (1979 loc) · 100 KB
/
customnetpdl.xml
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
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
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
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<netpdl name="nbee.org NetPDL Database" version="0.9" creator="nbee.org" date="09-04-2007">
<protocol name="startproto" longname="Starting Protocol (used for beginning the parsing)" showsumtemplate="startproto">
<execute-code>
<init>
<!-- Alias list -->
<!-- Please do not change these values, since these are used inside the NetBee code -->
<alias name="%NOTFOUND" replacewith="0"/>
<alias name="%FOUND" replacewith="1"/>
<alias name="%CANDIDATE" replacewith="2"/>
<alias name="%DEFERRED" replacewith="3"/>
<!-- NetPDL default variables -->
<variable name="$linklayer" type="number" validity="static"/>
<variable name="$framelength" type="number" validity="thispacket"/>
<variable name="$packetlength" type="number" validity="thispacket"/>
<variable name="$currentoffset" type="number" validity="thispacket"/>
<variable name="$currentprotooffset" type="number" validity="thispacket"/>
<variable name="$timestamp_sec" type="number" validity="thispacket"/>
<variable name="$timestamp_usec" type="number" validity="thispacket"/>
<variable name="$packet" type="refbuffer" validity="thispacket"/>
<variable name="$prevproto" type="protocol" validity="thispacket"/>
<variable name="$nextproto" type="protocol" validity="thispacket"/>
<variable name="$protoverify_result" type="number" validity="thispacket"/>
<!-- Variables for tokenXXX fields; these are updated after each field (of the proper type), so we do not have to reset them at each packet -->
<variable name="$token_begintlen" type="number" validity="static"/>
<variable name="$token_fieldlen" type="number" validity="static"/>
<variable name="$token_endtlen" type="number" validity="static"/>
<!-- Required configuration variables (usually used for selecting some optional functions in the code) -->
<variable name="$show_networknames" type="number" validity="static"/>
<variable name="$enable_servertable" type="number" validity="static" value="0"/>
<!-- Variables required for L4-L7 processing -->
<variable name="$ipsrc" type="refbuffer" validity="thispacket"/>
<variable name="$ipdst" type="refbuffer" validity="thispacket"/>
<variable name="$L4proto" type="protocol" validity="thispacket"/>
<variable name="$portsrc" type="refbuffer" validity="thispacket"/>
<variable name="$portdst" type="refbuffer" validity="thispacket"/>
<variable name="$firstip" type="refbuffer" validity="thispacket"/>
<variable name="$secondip" type="refbuffer" validity="thispacket"/>
<variable name="$firstport" type="refbuffer" validity="thispacket"/>
<variable name="$secondport" type="refbuffer" validity="thispacket"/>
<variable name="$type" type="number" validity="thispacket"/>
<variable name="$proc" type="number" validity="thispacket"/>
<variable name="$payloadlength" type="number" validity="thispacket" value="0"/>
<variable name="$sess_table_hit" type="number" validity="thispacket" value="0"/>
<variable name="$ks_table_hit" type="number" validity="thispacket" value="0"/>
<variable name="$session_hit" type="number" validity="thispacket" value="0"/>
<!-- Lookup tables for L7 processing -->
<lookuptable name="$tcpsessiontable" exactentries="50000" maskentries="1000" validity="dynamic">
<key name="ipsource" type="buffer" size="16"/>
<key name="ipdest" type="buffer" size="16"/>
<key name="tcpsrcport" type="buffer" size="2"/>
<key name="tcpdstport" type="buffer" size="2"/>
<data name="nextproto" type="protocol"/>
<data name="flag" type="number"/>
</lookuptable>
<lookuptable name="$udpsessiontable" exactentries="10000" maskentries="1000" validity="dynamic">
<key name="ipsource" type="buffer" size="16"/>
<key name="ipdest" type="buffer" size="16"/>
<key name="tcpsrcport" type="buffer" size="2"/>
<key name="tcpdstport" type="buffer" size="2"/>
<data name="nextproto" type="protocol"/>
</lookuptable>
<lookuptable name="$rtptable" exactentries="1000" maskentries="0" validity="dynamic">
<key name="ipsource" type="buffer" size="16"/>
<key name="ipdest" type="buffer" size="16"/>
<key name="srcport" type="buffer" size="2"/>
<key name="dstport" type="buffer" size="2"/>
<data name="ssrc" type="buffer" size="4"/>
</lookuptable>
<lookuptable name="$KnownServerTable" exactentries="10000" maskentries="0" validity="dynamic">
<key name="ipaddr" type="buffer" size="16"/>
<key name="port" type="buffer" size="2"/>
<data name="nextproto" type="protocol"/>
</lookuptable>
<lookuptable name="$CandidateServersTable" exactentries="10000" maskentries="0" validity="dynamic">
<key name="ipaddr" type="buffer" size="16"/>
<key name="port" type="buffer" size="2"/>
</lookuptable>
<lookuptable name="$KnownUDPServerTable" exactentries="10000" maskentries="0" validity="dynamic">
<key name="ipaddr" type="buffer" size="16"/>
<key name="port" type="buffer" size="2"/>
<data name="nextproto" type="protocol"/>
</lookuptable>
<lookuptable name="$skypetempsessiontable" exactentries="10000" maskentries="0" validity="dynamic">
<key name="ipaddr" type="buffer" size="16"/>
<key name="port" type="buffer" size="2"/>
<data name="cnt" type="number" value="0"/>
<data name="id" type="buffer" size="2"/>
</lookuptable>
<lookuptable name="$SkypeClientTable" exactentries="10000" maskentries="0" validity="dynamic">
<key name="ipaddr" type="buffer" size="16"/>
<key name="port" type="buffer" size="2"/>
<data name="nextproto" type="protocol"/>
</lookuptable>
<lookuptable name="$unknownprotosessiontable" exactentries="50000" maskentries="0" validity="dynamic">
<key name="ipsource" type="buffer" size="16"/>
<key name="ipdest" type="buffer" size="16"/>
<key name="tcpsrcport" type="buffer" size="2"/>
<key name="tcpdstport" type="buffer" size="2"/>
</lookuptable>
<!-- this table contains information about rpc session -->
<lookuptable name="$rpctable" exactentries="1000" maskentries="0" validity="dynamic">
<key name="ipsource" type="buffer" size="16"/>
<key name="ipdest" type="buffer" size="16"/>
<key name="tcpsrcport" type="buffer" size="2"/>
<key name="tcpdstport" type="buffer" size="2"/>
<data name="prog" type="number"/>
<data name="proc" type="number"/>
<data name="type" type="number"/>
</lookuptable>
</init>
</execute-code>
<encapsulation>
<switch expr="$linklayer">
<!-- Bluetooth -->
<!--
<case value="1"> <nextproto proto="#hci_packet_type"/> </case>
<case value="13"> <nextproto proto="#hci"/> </case>
-->
<case value="1"> <nextproto proto="#ethernet"/> </case>
<!-- Some OSes use this for ATM/LLC encapsulation -->
<case value="11"> <nextproto proto="#llc"/> </case>
<!-- Encapsulation not supported. Let's use Ethernet, hoping that is correct -->
<default> <nextproto proto="#ethernet"/> </default>
</switch>
</encapsulation>
<visualization>
<showsumtemplate name="startproto">
<section name="NUMBER"/>
<packethdr value="num"/>
<section name="TIME"/>
<packethdr value="timestamp"/>
</showsumtemplate>
</visualization>
</protocol>
<protocol name="ethernet" longname="Ethernet 802.3" comment="Ethernet DIX has recently been included in 802.3" showsumtemplate="ethernet">
<format>
<fields>
<field type="fixed" name="dst" longname="{0x8000 3}" size="6" showtemplate="MACaddressEth"/>
<field type="fixed" name="src" longname="{0x8000 4}" size="6" showtemplate="MACaddressEth"/>
<field type="fixed" name="type" longname="{0x8000 5}" size="2" showtemplate="eth.typelength"/>
</fields>
</format>
<!--
<format>
<fields>
<field type="fixed" name="dst" longname="MAC Destination" size="6" showtemplate="MACaddressEth"/>
<field type="fixed" name="src" longname="MAC Source" size="6" showtemplate="MACaddressEth"/>
<field type="fixed" name="type" longname="Ethertype - Length" size="2" showtemplate="eth.typelength"/>
</fields>
</format>
-->
<encapsulation>
<switch expr="buf2int(type)">
<case value="0x806"> <nextproto proto="#arp"/> </case>
<case value="0x800"> <nextproto proto="#ip"/> </case>
<case value="0x86DD"> <nextproto proto="#ipv6"/> </case>
<case value="0x8100"> <nextproto proto="#vlan"/> </case>
<case value="0x88A8"> <nextproto proto="#vlan"/> </case>
<case value="0x8847" comment="mpls-unicast"> <nextproto proto="#mpls"/> </case>
<case value="0x8848" comment="mpls-multicast"> <nextproto proto="#mpls"/> </case>
<case value="0x88E7"> <nextproto proto="#pbb"/> </case>
</switch>
</encapsulation>
<visualization>
<showsumtemplate name="ethernet">
<section name="next"/>
<text value="Eth: "/>
<protofield name="src" showdata="showvalue"/>
<text value=" => "/>
<protofield name="dst" showdata="showvalue"/>
</showsumtemplate>
</visualization>
</protocol>
<protocol name="etherpadding" longname="Ethernet padding">
<format>
<fields>
<field type="variable" name="etherpad" longname="Ethernet Padding (frame less than 64 bytes)" expr="$framelength - $currentoffset" showtemplate="Field4BytesHex"/>
</fields>
</format>
</protocol>
<protocol name="vlan" longname="Virtual LAN (802.3ac)" showsumtemplate="vlan">
<format>
<fields>
<block name="vlan" size="2" longname="Tag Control Information">
<field type="bit" name="pri" longname="{0x8000 7}" mask="0xE000" size="2" showtemplate="FieldHex"/>
<field type="bit" name="cfi" longname="CFI" mask="0x1000" size="2" showtemplate="FieldDec"/>
<field type="bit" name="vlanid" longname="{0x8000 6}" mask="0x0FFF" size="2" showtemplate="FieldDec"/>
</block>
<field type="fixed" name="type" longname="{0x8000 5} Type" size="2" showtemplate="eth.typelength"/>
</fields>
</format>
<encapsulation>
<switch expr="buf2int(type)">
<case value="0" maxvalue="1500"> <nextproto proto="#llc"/> </case>
<case value="0x800"> <nextproto proto="#ip"/> </case>
<case value="0x806"> <nextproto proto="#arp"/> </case>
<case value="0x8100"> <nextproto proto="#vlan" comment="Standard 802.1Q in 802.1Q encapsulation"/> </case>
<case value="0x88A8"> <nextproto proto="#vlan" comment="Shortest path Bridge"/> </case>
<case value="0x86DD"> <nextproto proto="#ipv6"/> </case>
<case value="0x88E7"> <nextproto proto="#pbb" comment="802.1ad encapsulation"/> </case>
</switch>
</encapsulation>
<visualization>
<showsumtemplate name="vlan">
<text value=" (VLAN-ID "/>
<protofield name="vlanid" showdata="showvalue"/>
<text value=")"/>
</showsumtemplate>
</visualization>
</protocol>
<protocol name="mpls" longname="Multi Protocol Label Switching" showsumtemplate="mpls">
<format>
<fields>
<!--
The CoS field is identified as Exp (Experimental Use) inside RFC 3032
-->
<field type="bit" name="label" longname="{0x8000 34} Label" mask="0xFFFFF000" size="4" showtemplate="FieldDec"/>
<field type="bit" name="cos" longname="{0x8000 35} Class of Service" mask="0x00000E00" size="4" showtemplate="FieldDec"/>
<field type="bit" name="bos" longname="{0x8000 36} Bottom of Stack" mask="0x00000100" size="4" showtemplate="FieldDec"/>
<field type="bit" name="ttl" longname="{0x0002 80} Time To Live" mask="0x000000FF" size="4" showtemplate="FieldDec"/>
</fields>
</format>
<encapsulation>
<if expr="buf2int(s) == 1">
<if-true>
<switch expr="buf2int(label)">
<case value="0"> <nextproto proto="#ip"/> </case>
<case value="2"> <nextproto proto="#ipv6"/> </case>
<default>
<nextproto proto="#ip"/>
</default>
</switch>
</if-true>
<if-false>
<nextproto proto="#mpls"/>
</if-false>
</if>
</encapsulation>
<visualization>
<showsumtemplate name="mpls">
<section name="next"/>
<text value="LABEL: "/>
<protofield name="label" showdata="showvalue"/>
</showsumtemplate>
</visualization>
</protocol>
<protocol name="llc" longname="IEEE 802.2 Logical Link Control" showsumtemplate="llc">
<format>
<fields>
<field type="fixed" name="dsap" longname="DSAP" size="1" showtemplate="FieldHex"/>
<field type="fixed" name="ssap" longname="SSAP" size="1" showtemplate="FieldHex"/>
<if expr="(buf2int($packet[$currentoffset:1]) bitwand 0b00000011) == 0b00000011"> <!-- last two bits are '11' -->
<!-- LLC Unnumbered -->
<if-true>
<field type="fixed" name="ctrl" longname="Control (Unnumbered)" size="1" showtemplate="FieldHex">
<field type="bit" name="mod" longname="Modifier" mask="0xE0" size="1" showtemplate="FieldHex"/>
<field type="bit" name="pf" longname="Poll / Final" mask="0x10" size="1" showtemplate="FieldBin"/>
<field type="bit" name="type" longname="Type" mask="0x0C" size="1" showtemplate="FieldHex"/>
<field type="bit" name="flag" longname="Flag (Unnumbered frame)" mask="0x03" size="1" showtemplate="FieldBin"/>
</field>
</if-true>
<if-false>
<if expr="(buf2int($packet[$currentoffset:1]) bitwand 0b00000001) == 0b00000000"> <!-- last bit is '0' -->
<!-- LLC Information -->
<if-true>
<!-- Warning: the LLC information ctrl field can be also 16 bits -->
<field type="fixed" name="ctrl" longname="Control (Information)" size="1" showtemplate="FieldHex">
<field type="bit" name="nr" longname="Sequence Number (Receiver)" mask="0xE0" size="1" showtemplate="FieldHex"/>
<field type="bit" name="pf" longname="Poll / Final" mask="0x10" size="1" showtemplate="FieldBin"/>
<field type="bit" name="type" longname="Type" mask="0x0C" size="1" showtemplate="FieldHex"/>
<field type="bit" name="flag" longname="Flag (Information frame)" mask="0x03" size="1" showtemplate="FieldBin"/>
</field>
</if-true>
<if-false>
<if expr="(buf2int($packet[$currentoffset:1]) bitwand 0b00000001) == 0b00000001"> <!-- last two bits are '01' -->
<!-- LLC Supervisor -->
<if-true>
<!-- Warning: the LLC Supervisor ctrl field can be also 16 bits -->
<field type="fixed" name="ctrl" longname="Control (Supervisor)" size="1" showtemplate="FieldHex">
<field type="bit" name="nr" longname="Sequence Number (Receiver)" mask="0xE0" size="1" showtemplate="FieldDec"/>
<field type="bit" name="pf" longname="Poll / Final" mask="0x10" size="1" showtemplate="FieldBin"/>
<field type="bit" name="ns" longname="Sequence Number (Sender)" mask="0x0E" size="1" showtemplate="FieldDec"/>
<field type="bit" name="flag" longname="Flag (Supervisor frame)" mask="0x01" size="1" showtemplate="FieldBin"/>
</field>
</if-true>
</if>
</if-false>
</if>
</if-false>
</if>
</fields>
</format>
<encapsulation>
<if expr="(dsap == '\xE0') and (ssap == '\xE0') and (ctrl == '\x03') and ($packet[$currentoffset:2] == '\xFF\xFF')">
<if-true>
</if-true>
</if>
<switch expr="buf2int(dsap)">
<case value="0x06"> <nextproto proto="#ip"/> </case>
<case value="0xAA"> <nextproto proto="#snap"/> </case>
</switch>
</encapsulation>
<visualization>
<showsumtemplate name="llc">
<text value=" - "/>
<if expr="(buf2int(ctrl) bitwand 0b00000011) == 0b00000011">
<if-true>
<text value="LLC Unnumbered "/>
</if-true>
<if-false>
<if expr="(buf2int(ctrl) bitwand 0b00000001) == 0b00000000">
<!-- LLC Information -->
<if-true>
<text value="LLC Information "/>
</if-true>
<if-false>
<if expr="(buf2int(ctrl) bitwand 0b00000011) == 0b00000001">
<!-- LLC Supervisor -->
<if-true>
<text value="LLC Supervisor "/>
</if-true>
</if>
</if-false>
</if>
</if-false>
</if>
<text value=": DSAP "/>
<protofield name="dsap" showdata="showvalue"/>
<text value=", Ctrl "/>
<protofield name="ctrl" showdata="showvalue"/>
</showsumtemplate>
</visualization>
</protocol>
<protocol name="snap" longname="IEEE 802.2 Logical Link Control SNAP" showsumtemplate="snap">
<format>
<fields>
<field type="fixed" name="OUI" longname="Organization Unique Identifier" size="3" showtemplate="FieldHex"/>
<field type="fixed" name="type" longname="Protocol Type" size="2" showtemplate="snap.type"/>
</fields>
</format>
<encapsulation>
<if expr="buf2int(OUI) == 0">
<if-true>
<switch expr="buf2int(type)">
<case value="0x0800"> <nextproto proto="#ip"/> </case>
<case value="0x0806"> <nextproto proto="#arp"/> </case>
</switch>
</if-true>
</if>
<if expr="buf2int(OUI) == 0x00000C">
<if-true>
<switch expr="buf2int(type)">
</switch>
</if-true>
</if>
</encapsulation>
<visualization>
<showtemplate name="snap.type" showtype="hex">
<showmap>
<switch expr="buf2int(this)">
<case value="0x0800" show="IP"/>
<case value="0x0806" show="ARP"/>
<case value="0x8137" show="IPX"/>
<case value="0x2000" show="Cisco Discovery Protocol"/>
<case value="0x010B" show="Cisco Per-VLAN Spanning Tree"/>
<default show="Error in snap.type lookup"/>
</switch>
</showmap>
</showtemplate>
<showsumtemplate name="snap">
<text value=" - SNAP"/>
<if expr="buf2int(type) == 0x010B">
<if-true>
<section name="next"/>
<text value="Cisco Per-VLAN Spanning Tree"/>
</if-true>
</if>
</showsumtemplate>
</visualization>
</protocol>
<protocol name="arp" longname="ARP (Address Resolution Protocol)" comment="This protocol has been 'hardwired' to IP. In fact, we do not know any other network protocol that uses ARP." showsumtemplate="arp">
<execute-code>
<!-- If we're on Ethernet, update the packet length -->
<after when="$linklayer == 1">
<assign-variable name="$packetlength" value="$currentoffset"/>
</after>
</execute-code>
<format>
<fields>
<field type="fixed" name="hType" longname="Hardware type" size="2" showtemplate="FieldDec"/>
<field type="fixed" name="pType" longname="Protocol type" size="2" showtemplate="FieldHex"/>
<field type="fixed" name="hLen" longname="Hardware address length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="pLen" longname="Protocol address length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="op" longname="{0x8000 21} Operation code" size="2" showtemplate="arp.code"/>
<field type="fixed" name="sHwAddr" longname="{0x8000 24} Sender MAC address" size="6" showtemplate="MACaddressEth"/>
<field type="fixed" name="sIPAddr" longname="{0x8000 22} Sender IP address" size="4" showtemplate="ip4addr"/>
<field type="fixed" name="dHwAddr" longname="{0x8000 25} Destination MAC address" size="6" showtemplate="MACaddressEth"/>
<field type="fixed" name="dIPAddr" longname="{0x8000 23} Destination IP address" size="4" showtemplate="ip4addr"/>
</fields>
</format>
<visualization>
<showtemplate name="arp.code" showtype="dec">
<showmap>
<switch expr="buf2int(this)">
<case value="1" show="Request"/>
<case value="2" show="Reply"/>
<default show="Error in ARP code lookup"/>
</switch>
</showmap>
</showtemplate>
<showsumtemplate name="arp">
<section name="next"/>
<text value="ARP "/>
<protofield name="op" showdata="showmap"/>
<text value=": "/>
<if expr="buf2int(op) == 1">
<if-true>
<text value="who has "/>
<protofield name="dIPAddr" showdata="showvalue"/>
<text value=" tell "/>
<protofield name="sIPAddr" showdata="showvalue"/>
</if-true>
<if-false>
<protofield name="sIPAddr" showdata="showvalue"/>
<text value=" is at "/>
<protofield name="sHwAddr" showdata="showvalue"/>
</if-false>
</if>
</showsumtemplate>
</visualization>
</protocol>
<protocol name="ip" longname="IPv4 (Internet Protocol version 4)" showsumtemplate="ipv4">
<!-- We should check that 'version' is equal to '4' -->
<execute-code>
<!-- If we're on Ethernet, update the packet length -->
<after when="$linklayer == 1">
<assign-variable name="$packetlength" value="$currentoffset + buf2int(tlen) - buf2int(hlen) * 4"/>
</after>
</execute-code>
<format>
<fields>
<field type="bit" name="ver" longname="Version" mask="0xF0" size="1" showtemplate="FieldDec"/>
<field type="bit" name="hlen" longname="Header length" comment="The length is in multiple of 4 bytes" mask="0x0F" size="1" showtemplate="FieldMul4Dec"/>
<!-- <field type="fixed" name="tos" longname="{0x8000 8} Type of service" size="1" showtemplate="FieldHex"/> -->
<block name="tos" longname="Type of service">
<field type="bit" name="ip dscp" longname="{0x8000 8} DSCP" mask="0xFC" size="1" showtemplate="FieldDec"/>
<field type="bit" name="ip ecn" longname="{0x8000 9} ECN" mask="0x03" size="1" showtemplate="FieldDec"/>
</block>
<field type="fixed" name="tlen" longname="Total length" size="2" showtemplate="FieldDec"/>
<field type="fixed" name="identification" longname="Identification" size="2" showtemplate="FieldDec"/>
<block name="ffo" longname="Flags and Fragment offset">
<field type="bit" name="unused" longname="Unused" mask="0x8000" size="2" showtemplate="FieldBin"/>
<field type="bit" name="df" longname="Don't fragment" mask="0x4000" size="2" showtemplate="FieldBin"/>
<field type="bit" name="mf" longname="More fragments" mask="0x2000" size="2" showtemplate="FieldBin"/>
<field type="bit" name="foffset" longname="Fragment offset" comment="This is in multiple of 8 bytes" mask="0x1FFF" size="2" showtemplate="ShortMul8Dec"/>
</block>
<field type="fixed" name="ttl" longname="{0x0002 81} Time to live" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="nextp" longname="{0x8000 10} Next protocol" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="hchecksum" longname="Header Checksum" size="2" showtemplate="FieldHex"/>
<field type="fixed" name="src" longname="{0x8000 11}" size="4" showtemplate="ip4addr"/>
<field type="fixed" name="dst" longname="{0x8000 12}" size="4" showtemplate="ip4addr"/>
<!-- Options loop -->
<block name="option" longname="IP Options">
<loop type="size" expr="(buf2int(hlen) * 4) - 20">
<switch expr="buf2int($packet[$currentoffset:1]) bitwand 0x1F">
<case value="0"> <includeblk name="IP_OPT_EOL"/> </case>
<case value="1"> <includeblk name="IP_OPT_NOP"/> </case>
<case value="2"> <includeblk name="IP_OPT_SEC"/> </case>
<case value="3"> <includeblk name="IP_OPT_LSR"/> </case>
<case value="4"> <includeblk name="IP_OPT_TS"/> </case>
<case value="5"> <includeblk name="IP_OPT_EX_SEC"/> </case>
<case value="7"> <includeblk name="IP_OPT_RR"/> </case>
<case value="8"> <includeblk name="IP_OPT_SID"/> </case>
<case value="9"> <includeblk name="IP_OPT_SSR"/> </case>
<case value="18"> <includeblk name="IP_OPT_TR"/> </case>
<case value="20"> <includeblk name="IP_OPT_RA"/> </case>
<default> <includeblk name="IP_OPT_UNK"/> </default>
</switch>
</loop>
</block>
</fields>
<!-- IP options -->
<block name="IP_OPT_EOL" longname="End of Options List">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="padding" name="padding" longname="Padding" align="4" showtemplate="FieldHex"/>
</block>
<block name="IP_OPT_NOP" longname="No Operation Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
</block>
<block name="IP_OPT_SEC" longname="Security Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="length" longname="Length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="sec" longname="Security" size="2" showtemplate="ipv4.secsec"/>
<field type="fixed" name="comp" longname="Compartments" size="2" showtemplate="ipv4.seccomp"/>
<field type="fixed" name="hr" longname="Handling Restrictions" size="2" showtemplate="FieldDec"/>
<field type="fixed" name="tcc" longname="Transmission Control Code" size="3" showtemplate="FieldAscii"/>
</block>
<block name="IP_OPT_EX_SEC" longname="Extended Security Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="length" longname="Length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="asecfc" longname="Additional Security Info Format Code" size="1" showtemplate="FieldDec"/>
<field type="variable" name="asec" longname="Additional Security Info" expr="buf2int(length) - 3" showtemplate="Field4BytesHex"/>
<!-- This expression is wrong; we'll check it later -->
</block>
<block name="IP_OPT_LSR" longname="Loose Source Routing Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="length" longname="Length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="pointer" longname="Pointer" size="1" showtemplate="FieldDec"/>
<!-- Loop to print the addresses -->
<block name="LSR_alist" longname="Address list">
<loop type="size" expr="buf2int(length) - 3">
<field type="fixed" name="raddr" longname="Router Address" size="4" showtemplate="ip4addr-noplg"/>
</loop>
</block>
</block>
<block name="IP_OPT_SSR" longname="Strict Source Routing Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="length" longname="Length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="pointer" longname="Pointer" size="1" showtemplate="FieldDec"/>
<!-- Loop to print the addresses -->
<block name="SRR_alist" longname="Address list">
<loop type="size" expr="buf2int(length) - 3">
<field type="fixed" name="raddr" longname="Router Address" size="4" showtemplate="ip4addr-noplg"/>
</loop>
</block>
</block>
<block name="IP_OPT_RR" longname="Record Route Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="length" longname="Length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="pointer" longname="Pointer" size="1" showtemplate="FieldDec"/>
<!-- Loop to print the addresses -->
<block name="RR_alist" longname="Address list">
<loop type="size" expr="buf2int(length) - 3">
<field type="fixed" name="raddr" longname="Router Address" size="4" showtemplate="ip4addr-noplg"/>
</loop>
</block>
</block>
<block name="IP_OPT_SID" longname="Stream Identifier Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="length" longname="Length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="sid" longname="Stream ID" size="2" showtemplate="FieldDec"/>
</block>
<block name="IP_OPT_RA" longname="Router Alert Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="len" longname="Length" comment="The value of this field must be 4" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="value" longname="Value" size="2" showtemplate="ipv4.optralert"/>
</block>
<block name="IP_OPT_TR" longname="Trace Route Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="len" longname="Length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="id" longname="ID Number" size="2" showtemplate="FieldDec"/>
<field type="fixed" name="ohc" longname="Outbound Hop Count" size="2" showtemplate="FieldDec"/>
<field type="fixed" name="rhc" longname="Return Hop Count" size="2" showtemplate="FieldDec"/>
<field type="fixed" name="TR_addr" longname="Originator IP Address" size="4" showtemplate="ip4addr-noplg"/>
</block>
<block name="IP_OPT_TS" longname="Timestamp Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="length" longname="Length" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="pointer" longname="Pointer" size="1" showtemplate="FieldDec"/>
<block name="ovf_flags" longname="Overflow and flag">
<field type="bit" name="ts_ovf" longname="Overflow" mask="0xF0" size="1" showtemplate="FieldHex"/>
<field type="bit" name="ts_flag" longname="Flag" mask="0x0F" size="1" showtemplate="ipv4.opttimestamp"/>
</block>
<!-- Loop to print the timestamps and addresses -->
<block name="TS_list" longname="Timestamps">
<loop type="size" expr="buf2int(length) - 4">
<switch expr="buf2int(ts_flag)">
<case value="1">
<field type="fixed" name="TS_addr" longname="Address" size="4" showtemplate="ip4addr-noplg"/>
<field type="fixed" name="TS_tstamp" longname="Time Stamp" size="4" showtemplate="FieldDec"/>
</case>
<default>
<field type="fixed" name="TS_tstamp" longname="Time Stamp" size="4" showtemplate="FieldDec"/>
</default>
</switch>
</loop>
</block>
</block>
<!-- Unknown Option, shown if no other options match -->
<block name="IP_OPT_UNK" longname="Unknown or Unsupported Option">
<field type="fixed" name="type" longname="Option Type" size="1" showtemplate="ipv4.opttype">
<field type="bit" name="copy" longname="Copied flag" mask="0x80" size="1" showtemplate="ipv4.optcopytype"/>
<field type="bit" name="class" longname="Option Class" mask="0x60" size="1" showtemplate="ipv4.optclass"/>
<field type="bit" name="number" longname="Option Number" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<field type="fixed" name="length" longname="Length" size="1" showtemplate="FieldDec"/>
<field type="variable" name="OptionData" longname="Option Data" expr="buf2int(length)" showtemplate="Field4BytesHex"/>
</block>
</format>
<!--
</fields>
</format>
-->
<encapsulation>
<if expr="buf2int(foffset) == 0">
<if-true>
<switch expr="buf2int(nextp)">
<!--
<case value="4"> <nextproto proto="#ip"/> </case>
-->
<case value="1"> <nextproto proto="#icmp"/> </case>
<case value="6"> <nextproto proto="#tcp"/> </case>
<case value="17"> <nextproto proto="#udp"/> </case>
<case value="132"> <nextproto proto="#sctp"/> </case>
</switch>
</if-true>
</if>
</encapsulation>
<visualization>
<showtemplate name="ipv4.opttype" showtype="dec"> <!-- Option type -->
<showmap>
<switch expr="buf2int(this)">
<case value="0" show="End of Options List"/>
<case value="1" show="No Operation"/>
<case value="7" show="Record Route"/>
<case value="10" show="Experimental Measurement"/>
<case value="68" show="Time Stamp"/>
<case value="82" show="Traceroute"/>
<case value="130" show="Security"/>
<case value="131" show="Loose Source Routing"/>
<case value="133" show="Extended Security"/>
<case value="134" show="Commercial Security"/>
<case value="136" show="Stream ID"/>
<case value="137" show="Strict Source Routing"/>
<case value="142" show="Expermental Access Control"/>
<case value="144" show="IMI Traffic Descriptor"/>
<case value="145" show="Extended Internet Protocol"/>
<case value="147" show="Address Extension"/>
<case value="148" show="Router Alert"/>
<case value="149" show="Selective Directed Broadcast"/>
<case value="150" show="NSAP Addresses"/>
<case value="151" show="Dynamic Packet State"/>
<case value="152" show="Upstream Multicast Pkt."/>
<case value="205" show="Experimental Flow Control"/>
<default show="Unknown option"/>
</switch>
</showmap>
</showtemplate>
<showtemplate name="ipv4.optcopytype" showtype="bin"> <!-- Option Copy type -->
<showmap>
<switch expr="buf2int(this)">
<case value="0" show="not copied into all fragments"/>
<case value="1" show="copied into all fragments"/>
<default show="Unknown"/>
</switch>
</showmap>
</showtemplate>
<showtemplate name="ipv4.optclass" showtype="bin"> <!-- Option Class type -->
<showmap>
<switch expr="buf2int(this)">
<case value="0" show="control"/>
<case value="1" show="reserved for future use"/>
<case value="2" show="debugging and measurement"/>
<case value="3" show="reserved for future use"/>
<default show="Unknown"/>
</switch>
</showmap>
</showtemplate>
<showtemplate name="ipv4.secsec" showtype="dec"> <!-- Security level -->
<showmap>
<switch expr="buf2int(this)">
<case value="0" show="Unclassified"/>
<case value="61749" show="Confidential"/>
<case value="30874" show="EFTO"/>
<case value="48205" show="MMMM"/>
<case value="24102" show="PROG"/>
<case value="44819" show="Restricted"/>
<case value="55176" show="Secret"/>
<case value="27589" show="Top Secret"/>
<default show="Unknown"/>
</switch>
</showmap>
</showtemplate>
<showtemplate name="ipv4.seccomp" showtype="dec"> <!-- Security Compartment -->
<showmap>
<switch expr="buf2int(this)">
<case value="0" show="Not Compartmented"/>
<default show="Unknown Compartment" comment="Every compartment different from 0 is unknown"/>
</switch>
</showmap>
</showtemplate>
<showtemplate name="ipv4.optralert" showtype="dec"> <!-- Routing Alert Value -->
<showmap>
<switch expr="buf2int(this)">
<case value="0" show="Router shall examine packet"/>
<default show="reserved"/>
</switch>
</showmap>
</showtemplate>
<showtemplate name="ipv4.opttimestamp" showtype="bin"> <!-- Timestamp Flag -->
<showmap>
<switch expr="buf2int(this)">
<case value="0" show="Time stamps only"/>
<case value="1" show="Time stamps and addresses"/>
<case value="3" show="Time stamps for prespecified addresses"/>
</switch>
</showmap>
</showtemplate>
<showsumtemplate name="ipv4">
<section name="next"/>
<!-- <section name="L3"/> -->
<text value=" - " when="onlysectionhastext"/>
<text value="IP: "/>
<protofield name="src" showdata="showvalue"/>
<text value=" => "/>
<protofield name="dst" showdata="showvalue"/>
<text value=" (Len "/>
<protofield name="tlen" showdata="showvalue"/>
<text value=")"/>
<if expr="(buf2int(mf) == 1) or (buf2int(foffset) != 0)">
<if-true>
<text value=" Fragment " expr="buf2int(foffset)*8"/>
<!-- the packet ends at: fragment offset * 8 + (total length - header length * 4 - 1) -->
<text value=":" expr="buf2int(foffset) * 8 + buf2int(tlen) - 1 - buf2int(hlen) * 4"/>
</if-true>
</if>
</showsumtemplate>
</visualization>
</protocol>
<protocol name="ipv6" longname="IPv6 (Internet Protocol version 6)" showsumtemplate="ipv6">
<!-- We should check that 'version' is equal to '6' -->
<execute-code>
<after>
<!-- Store ipsrc and ipdst in a couple of variables for the sake of speed -->
<!-- This aims at hiding differences between IPv4 and IPv6 for session tracking -->
<assign-variable name="$ipsrc" value="src"/>
<assign-variable name="$ipdst" value="dst"/>
<if expr="$ipsrc lt $ipdst" >
<if-true>
<assign-variable name="$firstip" value="src"/>
<assign-variable name="$secondip" value="dst"/>
</if-true>
<if-false>
<assign-variable name="$firstip" value="dst"/>
<assign-variable name="$secondip" value="src"/>
</if-false>
</if>
</after>
<!-- If we're on Ethernet, update the packet length -->
<after when="$linklayer == 1">
<assign-variable name="$packetlength" value="$currentoffset + buf2int(plen)"/>
</after>
</execute-code>
<format>
<fields>
<block name="ipv6_ver_tc_fl" longname="Version, Traffic class and Flow label">
<field type="bit" name="ipv6 dscp" longname="{0x8000 8} DSCP" mask="F0000000" size="4" showtemplate="FieldDec"/>
<field type="bit" name="ipv6 ecn" longname="{0x8000 9} ECN" mask="0F000000" size="4" showtemplate="FieldDec"/>
<field type="bit" name="flabel" mask="00FFFFFF" size="4" showtemplate="FieldDec"/>
</block>
<!-- <field type="fixed" name="ipv6_ver_tc_fl" longname="Version Traffic Class and Flow Label" size="4" showtemplate="FieldHex"/> -->
<field type="fixed" name="plen" longname="Payload Length" size="2" showtemplate="FieldDec"/>
<field type="fixed" name="nexthdr" longname="{0x8000 10} Next Header" size="1" showtemplate="ipv6.nexthdr"/>
<field type="fixed" name="hop" longname="Hop limit" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="src" longname="{0x8000 26}" size="16" showtemplate="ip6addr" />
<field type="fixed" name="dst" longname="{0x8000 27}" size="16" showtemplate="ip6addr" />
<loop type="while" expr="1">
<!-- Loop until we find a 'break' -->
<switch expr="buf2int(nexthdr)">
<case value="0">
<includeblk name="HBH"/>
</case>
<case value="43">
<includeblk name="RH"/>
</case>
<case value="44">
<includeblk name="FH"/>
</case>
<case value="51">
<includeblk name="AH"/>
</case>
<case value="60">
<includeblk name="DOH"/>
</case>
<default>
<loopctrl type="break"/>
</default>
</switch>
</loop>
</fields>
<block name="HBH" longname="{0x8000 39 6 1}">
<field type="fixed" name="nexthdr" longname="{0x8000 10} Next Header" size="1" showtemplate="ipv6.nexthdr"/>
<field type="fixed" name="helen" longname="Length (multiple of 8 bytes, not including the first 8)" size="1" showtemplate="ipv6.hbhlen"/>
<loop type="size" expr="(buf2int(helen) * 8) + 6"> <!-- '6' because the first two bytes are nexthdr and helen -->
<includeblk name="HBHOption"/>
</loop>
</block>
<block name="FH" longname="{0x8000 39 4 4}">
<field type="fixed" name="nexthdr" longname="{0x8000 10} Next Header" size="1" showtemplate="ipv6.nexthdr"/>
<field type="fixed" name="reserved" longname="Reserved (multiple of 8 bytes)" comment="This is in multiple of 8 bytes" size="1" showtemplate="FieldDec"/>
<field type="bit" name="fragment offset" longname="Fragment Offset" mask="0xFFF0" size="2" showtemplate="FieldDec"/>
<field type="bit" name="res" longname="Res" mask="0x0004" size="2" showtemplate="FieldHex"/>
<field type="bit" name="m" longname="M" mask="0x0001" size="2" showtemplate="FieldBin"/>
<field type="fixed" name="identification" longname="Identification" size="4" showtemplate="FieldDec"/>
</block>
<block name="AH" longname="{0x8000 39 2 5}">
<field type="fixed" name="nexthdr" longname="{0x8000 10} Next Header" size="1" showtemplate="ipv6.nexthdr"/>
<field type="fixed" name="payload len" longname="Payload Len" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="reserved" longname="Reserved" size="2" showtemplate="FieldDec"/>
<field type="fixed" name="spi" longname="Security Parameters Index" size="4" showtemplate="FieldDec"/>
<field type="fixed" name="snf" longname="Sequence Number Field" size="4" showtemplate="FieldDec"/>
</block>
<block name="DOH" longname="{0x8000 39 3 2}">
<field type="fixed" name="nexthdr" longname="{0x8000 10} Next Header" size="1" showtemplate="ipv6.nexthdr"/>
<field type="fixed" name="helen" longname="Length (multiple of 8 bytes, not including the first 8)" size="1" showtemplate="ipv6.hbhlen"/>
<loop type="size" expr="(buf2int(helen) * 8)+6"> <!-- '6' because the first two bytes are nexthdr and helen -->
<includeblk name="DOHOption"/>
</loop>
</block>
<block name="RH" longname="{0x8000 39 5 3}">
<field type="fixed" name="nexthdr" longname="{0x8000 10} Next Header" size="1" showtemplate="ipv6.nexthdr"/>
<field type="fixed" name="hlen" longname="Length (multiple of 8 bytes)" comment="This is in multiple of 8 bytes" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="rtype" longname="Routing Type" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="segment left" longname="Segment Left" size="1" showtemplate="FieldDec"/>
<field type="fixed" name="res" longname="Reserved (must be zero)" size="4" showtemplate="FieldDec"/>
<switch expr="buf2int(rtype)">
<case value="0">
<loop type="times2repeat" expr="(buf2int(hlen) div 2)">
<field type="fixed" name="address" longname="{0x0002 25}" size="16" showtemplate="ip6addr"/>
</loop>
</case>
<default>
<field type="variable" name="tsd" longname="Type Specific Data" expr="(buf2int(hlen) * 8)" showtemplate="Field4BytesHex"/>
</default>
</switch>
</block>
<block name="DOHOption" longname="Destination Option Header Option">
<field type="fixed" name="opttype" longname="Option Type" size="1" showtemplate="ipv6.opttype">
<field type="bit" name="act" longname="Action (action if Option Type is unrecognized)" mask="0xC0" size="1" showtemplate="ipv6.optact"/>
<field type="bit" name="chg" longname="Change (whether or not option data can change while packet is en-route)" mask="0x20" size="1" showtemplate="ipv6.optchg"/>
<field type="bit" name="res" longname="{0x0002 17}" mask="0x1F" size="1" showtemplate="FieldDec"/>
</field>
<switch expr="buf2int(opttype)">
<case value="0">
<!-- No fields are present if the option is not 'Pad1'-->
</case>
<case value="5"> <!-- Router Alert -->
<field type="fixed" name="optlen" longname="Option Length" size="1" showtemplate="FieldDec"/>