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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
|
/* packet-m2ua.c
* Routines for MTP2 User Adaptation Layer dissection
* It is hopefully (needs testing) compliant to
* https://tools.ietf.org/html/rfc3331
* To do: - provide better handling of length parameters
*
* Copyright 2002, Michael Tuexen <tuexen [AT] fh-muenster.de>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* Copied from README.developer
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/sctpppids.h>
#include <wsutil/str_util.h>
#include <wsutil/ws_roundup.h>
void proto_register_m2ua(void);
void proto_reg_handoff_m2ua(void);
#define SCTP_PORT_M2UA 2904
/* Initialize the protocol and registered fields */
static int proto_m2ua;
static int hf_version;
static int hf_reserved;
static int hf_message_class;
static int hf_message_type;
static int hf_message_length;
static int hf_parameter_tag;
static int hf_parameter_length;
static int hf_parameter_value;
static int hf_parameter_padding;
static int hf_interface_id_int;
static int hf_interface_id_text;
static int hf_info_string;
static int hf_diagnostic_information;
static int hf_interface_id_start;
static int hf_interface_id_stop;
static int hf_heartbeat_data;
static int hf_traffic_mode_type;
static int hf_error_code;
static int hf_status_type;
static int hf_status_ident;
static int hf_asp_id;
static int hf_correlation_id;
static int hf_data_2_li;
static int hf_state;
static int hf_event;
static int hf_congestion_status;
static int hf_discard_status;
static int hf_action;
static int hf_sequence_number;
static int hf_retrieval_result;
static int hf_local_lk_id;
static int hf_sdt_reserved;
static int hf_sdt_id;
static int hf_sdl_reserved;
static int hf_sdl_id;
static int hf_registration_status;
static int hf_deregistration_status;
/* Initialize the subtree pointers */
static int ett_m2ua;
static int ett_m2ua_parameter;
static dissector_handle_t mtp3_handle;
static dissector_handle_t m2ua_handle;
static void
dissect_parameters(tvbuff_t *, packet_info *, proto_tree *, proto_tree *);
#define VERSION_LENGTH 1
#define RESERVED_LENGTH 1
#define MESSAGE_CLASS_LENGTH 1
#define MESSAGE_TYPE_LENGTH 1
#define MESSAGE_LENGTH_LENGTH 4
#define COMMON_HEADER_LENGTH (VERSION_LENGTH + RESERVED_LENGTH + MESSAGE_CLASS_LENGTH + \
MESSAGE_TYPE_LENGTH + MESSAGE_LENGTH_LENGTH)
#define VERSION_OFFSET 0
#define RESERVED_OFFSET (VERSION_OFFSET + VERSION_LENGTH)
#define MESSAGE_CLASS_OFFSET (RESERVED_OFFSET + RESERVED_LENGTH)
#define MESSAGE_TYPE_OFFSET (MESSAGE_CLASS_OFFSET + MESSAGE_CLASS_LENGTH)
#define MESSAGE_LENGTH_OFFSET (MESSAGE_TYPE_OFFSET + MESSAGE_TYPE_LENGTH)
#define PROTOCOL_VERSION_RELEASE_1 1
static const value_string protocol_version_values[] = {
{ PROTOCOL_VERSION_RELEASE_1, "Release 1" },
{ 0, NULL } };
#define MESSAGE_CLASS_MGMT_MESSAGE 0
#define MESSAGE_CLASS_ASPSM_MESSAGE 3
#define MESSAGE_CLASS_ASPTM_MESSAGE 4
#define MESSAGE_CLASS_MAUP_MESSAGE 6
#define MESSAGE_CLASS_IIM_MESSAGE 10
static const value_string message_class_values[] = {
{ MESSAGE_CLASS_MGMT_MESSAGE, "Management messages" },
{ MESSAGE_CLASS_ASPSM_MESSAGE, "ASP state maintenance messages" },
{ MESSAGE_CLASS_ASPTM_MESSAGE, "ASP traffic maintenance messages" },
{ MESSAGE_CLASS_MAUP_MESSAGE, "MTP2 user adaptation messages" },
{ MESSAGE_CLASS_IIM_MESSAGE, "Interface identifier management messages" },
{ 0, NULL } };
/* MGMT */
#define MESSAGE_TYPE_ERR 0
#define MESSAGE_TYPE_NTFY 1
/* ASPSM */
#define MESSAGE_TYPE_UP 1
#define MESSAGE_TYPE_DOWN 2
#define MESSAGE_TYPE_BEAT 3
#define MESSAGE_TYPE_UP_ACK 4
#define MESSAGE_TYPE_DOWN_ACK 5
#define MESSAGE_TYPE_BEAT_ACK 6
/* ASPTM */
#define MESSAGE_TYPE_ACTIVE 1
#define MESSAGE_TYPE_INACTIVE 2
#define MESSAGE_TYPE_ACTIVE_ACK 3
#define MESSAGE_TYPE_INACTIVE_ACK 4
/* MAUP */
#define MESSAGE_TYPE_DATA 1
#define MESSAGE_TYPE_ESTAB_REQ 2
#define MESSAGE_TYPE_ESTAB_CONF 3
#define MESSAGE_TYPE_REL_REQ 4
#define MESSAGE_TYPE_REL_CONF 5
#define MESSAGE_TYPE_REL_IND 6
#define MESSAGE_TYPE_STATE_REQ 7
#define MESSAGE_TYPE_STATE_CONF 8
#define MESSAGE_TYPE_STATE_IND 9
#define MESSAGE_TYPE_DATA_RETR_REQ 10
#define MESSAGE_TYPE_DATA_RETR_CONF 11
#define MESSAGE_TYPE_DATA_RETR_IND 12
#define MESSAGE_TYPE_DATA_RETR_COMP_IND 13
#define MESSAGE_TYPE_CONG_IND 14
#define MESSAGE_TYPE_DATA_ACK 15
/* IIM */
#define MESSAGE_TYPE_REG_REQ 1
#define MESSAGE_TYPE_REG_RSP 2
#define MESSAGE_TYPE_DEREG_REQ 3
#define MESSAGE_TYPE_DEREG_RSP 4
static const value_string message_class_type_values[] = {
{ MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "Error (ERR)" },
{ MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "Notify (NTFY)" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP up (UP)" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP down (DOWN)" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "Heartbeat (BEAT)" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP up ack (UP ACK)" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP down ack (DOWN ACK)" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "Heartbeat ack (BEAT ACK)" },
{ MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP active (ACTIVE)" },
{ MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP inactive (INACTIVE)" },
{ MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP active ack (ACTIVE ACK)" },
{ MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP inactive ack (INACTIVE ACK)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA (DATA)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_REQ, "Establish request (ESTAB_REQ)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_CONF, "Establish confirm (ESTAB_CONF)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_REQ, "Release request (REL_REQ)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_CONF, "Release confirm (REL_CONF)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_IND, "Release indication (REL_IND)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_REQ, "State request (STATE_REQ)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_CONF, "State confirm (STATE_CONF)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_IND, "State indication (STATE_IND)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_REQ, "Data retrieval request (DATA_RETR_REQ)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_CONF, "Data retrieval confirm (DATA_RETR_CONF)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_IND, "Data retrieval indication (DATA_RETR_IND)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_COMP_IND, "Data retrieval complete indication (DATA_RETR_COMP_IND)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_CONG_IND, "Congestion indication (CONG_IND)" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_ACK, "Data acknowledge (DATA_ACK)" },
{ MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "Registration request (REG_REQ)" },
{ MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "Registration response (REG_RSP)" },
{ MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "Deregistration request (DEREG_REQ)" },
{ MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "Deregistration response (DEREG_RSP)" },
{ 0, NULL } };
static const value_string message_class_type_acro_values[] = {
{ MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "ERR" },
{ MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "NTFY" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP_UP" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP_DOWN" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "BEAT" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP_UP_ACK" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP_DOWN_ACK" },
{ MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "BEAT_ACK" },
{ MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP_ACTIVE" },
{ MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP_INACTIVE" },
{ MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP_ACTIVE_ACK" },
{ MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP_INACTIVE_ACK" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_REQ, "ESTAB_REQ" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_CONF, "ESTAB_CONF" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_REQ, "REL_REQ" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_CONF, "REL_CONF" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_IND, "REL_IND" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_REQ, "STATE_REQ" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_CONF, "STATE_CONF" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_IND, "STATE_IND" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_REQ, "DATA_RETR_REQ" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_CONF, "DATA_RETR_CONF" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_IND, "DATA_RETR_IND" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_COMP_IND, "DATA_RETR_COMP_IND" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_CONG_IND, "CONG_IND" },
{ MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_ACK, "DATA_ACK" },
{ MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "REG_REQ" },
{ MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "REG_RSP" },
{ MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "DEREG_REQ" },
{ MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "DEREG_RSP" },
{ 0, NULL } };
static void
dissect_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tree *m2ua_tree)
{
uint8_t message_class, message_type;
/* Extract the common header */
message_class = tvb_get_uint8(common_header_tvb, MESSAGE_CLASS_OFFSET);
message_type = tvb_get_uint8(common_header_tvb, MESSAGE_TYPE_OFFSET);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, message_class_type_acro_values, "reserved"));
if (m2ua_tree) {
/* add the components of the common header to the protocol tree */
proto_tree_add_item(m2ua_tree, hf_version, common_header_tvb, VERSION_OFFSET, VERSION_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(m2ua_tree, hf_reserved, common_header_tvb, RESERVED_OFFSET, RESERVED_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(m2ua_tree, hf_message_class, common_header_tvb, MESSAGE_CLASS_OFFSET, MESSAGE_CLASS_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_uint_format_value(m2ua_tree, hf_message_type, common_header_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, message_type,
"%s (%u)",
val_to_str_const(message_class * 256 + message_type, message_class_type_values, "reserved"), message_type);
proto_tree_add_item(m2ua_tree, hf_message_length, common_header_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
}
}
#define PARAMETER_TAG_LENGTH 2
#define PARAMETER_LENGTH_LENGTH 2
#define PARAMETER_HEADER_LENGTH (PARAMETER_TAG_LENGTH + PARAMETER_LENGTH_LENGTH)
#define PARAMETER_TAG_OFFSET 0
#define PARAMETER_LENGTH_OFFSET (PARAMETER_TAG_OFFSET + PARAMETER_TAG_LENGTH)
#define PARAMETER_VALUE_OFFSET (PARAMETER_LENGTH_OFFSET + PARAMETER_LENGTH_LENGTH)
#define PARAMETER_HEADER_OFFSET PARAMETER_TAG_OFFSET
#define INT_INTERFACE_ID_OFFSET PARAMETER_VALUE_OFFSET
#define INT_INTERFACE_ID_LENGTH 4
static void
dissect_interface_identifier_int_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_interface_id_int, parameter_tvb, INT_INTERFACE_ID_OFFSET, INT_INTERFACE_ID_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%d)", tvb_get_ntohl(parameter_tvb, INT_INTERFACE_ID_OFFSET));
}
#define TEXT_INTERFACE_ID_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_interface_identifier_text_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
{
uint16_t interface_id_length;
interface_id_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
proto_tree_add_item(parameter_tree, hf_interface_id_text, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, ENC_ASCII);
proto_item_append_text(parameter_item, " (%s)",
tvb_format_text(pinfo->pool, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length));
}
#define INFO_STRING_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_info_string_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
{
uint16_t info_string_length;
info_string_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
proto_tree_add_item(parameter_tree, hf_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII);
proto_item_append_text(parameter_item, " (%s)",
tvb_format_text(pinfo->pool, parameter_tvb, INFO_STRING_OFFSET, info_string_length));
}
#define DIAGNOSTIC_INFO_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_diagnostic_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
uint16_t diag_info_length;
diag_info_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
proto_tree_add_item(parameter_tree, hf_diagnostic_information, parameter_tvb, DIAGNOSTIC_INFO_OFFSET, diag_info_length, ENC_NA);
proto_item_append_text(parameter_item, " (%u byte%s)", diag_info_length, plurality(diag_info_length, "", "s"));
}
#define START_LENGTH 4
#define END_LENGTH 4
#define INTERVAL_LENGTH (START_LENGTH + END_LENGTH)
#define START_OFFSET 0
#define END_OFFSET (START_OFFSET + START_LENGTH)
static void
dissect_interface_identifier_range_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
uint16_t number_of_ranges, range_number;
int offset;
number_of_ranges = (tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH) / INTERVAL_LENGTH;
offset = PARAMETER_VALUE_OFFSET;
for(range_number = 0; range_number < number_of_ranges; range_number++) {
proto_tree_add_item(parameter_tree, hf_interface_id_start, parameter_tvb, offset + START_OFFSET, START_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(parameter_tree, hf_interface_id_stop, parameter_tvb, offset + END_OFFSET, END_LENGTH, ENC_BIG_ENDIAN);
offset += INTERVAL_LENGTH;
};
proto_item_append_text(parameter_item, " (%u range%s)", number_of_ranges, plurality(number_of_ranges, "", "s"));
}
#define HEARTBEAT_DATA_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_heartbeat_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
uint16_t heartbeat_data_length;
heartbeat_data_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
proto_tree_add_item(parameter_tree, hf_heartbeat_data, parameter_tvb, HEARTBEAT_DATA_OFFSET, heartbeat_data_length, ENC_NA);
proto_item_append_text(parameter_item, " (%u byte%s)", heartbeat_data_length, plurality(heartbeat_data_length, "", "s"));
}
#define OVER_RIDE_TYPE 1
#define LOAD_SHARE_TYPE 2
#define BROADCAST_TYPE 3
static const value_string traffic_mode_type_values[] = {
{ OVER_RIDE_TYPE , "Override" },
{ LOAD_SHARE_TYPE, "Load-share" },
{ BROADCAST_TYPE, "Broadcast" },
{ 0, NULL } };
#define TRAFFIC_MODE_TYPE_LENGTH 4
#define TRAFFIC_MODE_TYPE_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_traffic_mode_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_traffic_mode_type, parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)",
val_to_str_const(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET), traffic_mode_type_values, "unknown"));
}
#define INVALID_VERSION_ERROR_CODE 0x01
#define INVALID_INTERFACE_IDENTIFIER_ERROR_CODE 0x02
#define UNSUPPORTED_MESSAGE_CLASS_ERROR_CODE 0x03
#define UNSUPPORTED_MESSAGE_TYPE_ERROR_CODE 0x04
#define UNSUPPORTED_TRAFFIC_HANDLING_MODE_ERROR_CODE 0x05
#define UNEXPECTED_MESSAGE_ERROR_CODE 0x06
#define PROTOCOL_ERROR_ERROR_CODE 0x07
#define UNSUPPORTED_INTERFACE_IDENTIFIER_TYPE_ERROR_CODE 0x08
#define INVALID_STREAM_IDENTIFIER_ERROR_CODE 0x09
#define REFUSED_ERROR_CODE 0x0d
#define ASP_IDENTIFIER_REQUIRED_ERROR_CODE 0x0e
#define INVALID_ASP_IDENTIFIER_ERROR_CODE 0x0f
#define ASP_ACTIVE_FOR_INTERFACE_IDENTIFIER_ERROR_CODE 0x10
#define INVALID_PARAMETER_VALUE_ERROR_CODE 0x11
#define PARAMETER_FIELD_ERROR_CODE 0x12
#define UNEXPECTED_PARAMETER_ERROR_CODE 0x13
#define MISSING_PARAMETER_ERROR_CODE 0x16
static const value_string error_code_values[] = {
{ INVALID_VERSION_ERROR_CODE, "Invalid version" },
{ INVALID_INTERFACE_IDENTIFIER_ERROR_CODE, "Invalid interface identifier" },
{ UNSUPPORTED_MESSAGE_CLASS_ERROR_CODE, "Unsupported message class" },
{ UNSUPPORTED_MESSAGE_TYPE_ERROR_CODE, "Unsupported message type" },
{ UNSUPPORTED_TRAFFIC_HANDLING_MODE_ERROR_CODE, "Unsupported traffic handling mode" },
{ UNEXPECTED_MESSAGE_ERROR_CODE, "Unexpected message" },
{ PROTOCOL_ERROR_ERROR_CODE, "Protocol error" },
{ UNSUPPORTED_INTERFACE_IDENTIFIER_TYPE_ERROR_CODE, "Unsupported interface identifier type" },
{ INVALID_STREAM_IDENTIFIER_ERROR_CODE, "Invalid stream identifier" },
{ REFUSED_ERROR_CODE, "Refused - management blocking" },
{ ASP_IDENTIFIER_REQUIRED_ERROR_CODE, "ASP identifier required" },
{ INVALID_ASP_IDENTIFIER_ERROR_CODE, "Invalid ASP identifier" },
{ ASP_ACTIVE_FOR_INTERFACE_IDENTIFIER_ERROR_CODE, "ASP active for interface identifier" },
{ INVALID_PARAMETER_VALUE_ERROR_CODE, "Invalid parameter value" },
{ PARAMETER_FIELD_ERROR_CODE, "Parameter field error" },
{ UNEXPECTED_PARAMETER_ERROR_CODE, "Unexpected parameter" },
{ MISSING_PARAMETER_ERROR_CODE, "Missing parameter" },
{ 0, NULL } };
#define ERROR_CODE_LENGTH 4
#define ERROR_CODE_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_error_code, parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)",
val_to_str_const(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET), error_code_values, "unknown"));
}
#define AS_STATE_CHANGE_TYPE 1
#define OTHER_TYPE 2
static const value_string status_type_values[] = {
{ AS_STATE_CHANGE_TYPE, "Application server state change" },
{ OTHER_TYPE, "Other" },
{ 0, NULL } };
#define RESERVED_INFO 1
#define AS_INACTIVE_INFO 2
#define AS_ACTIVE_INFO 3
#define AS_PENDING_INFO 4
#define INSUFFICIENT_ASP_RES_INFO 1
#define ALTERNATE_ASP_ACTIVE_INFO 2
#define ASP_FAILURE_INFO 3
static const value_string status_type_id_values[] = {
{ AS_STATE_CHANGE_TYPE * 256 * 256 + RESERVED_INFO, "Reserved" },
{ AS_STATE_CHANGE_TYPE * 256 * 256 + AS_INACTIVE_INFO, "Application server inactive" },
{ AS_STATE_CHANGE_TYPE * 256 * 256 + AS_ACTIVE_INFO, "Application server active" },
{ AS_STATE_CHANGE_TYPE * 256 * 256 + AS_PENDING_INFO, "Application server pending" },
{ OTHER_TYPE * 256 * 256 + INSUFFICIENT_ASP_RES_INFO, "Insufficient ASP resources active in AS" },
{ OTHER_TYPE * 256 * 256 + ALTERNATE_ASP_ACTIVE_INFO, "Alternate ASP active" },
{ OTHER_TYPE * 256 * 256 + ASP_FAILURE_INFO, "ASP Failure" },
{0, NULL } };
#define STATUS_TYPE_LENGTH 2
#define STATUS_IDENT_LENGTH 2
#define STATUS_TYPE_OFFSET PARAMETER_VALUE_OFFSET
#define STATUS_IDENT_OFFSET (STATUS_TYPE_OFFSET + STATUS_TYPE_LENGTH)
static void
dissect_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
uint16_t status_type, status_id;
status_type = tvb_get_ntohs(parameter_tvb, STATUS_TYPE_OFFSET);
status_id = tvb_get_ntohs(parameter_tvb, STATUS_IDENT_OFFSET);
proto_tree_add_item(parameter_tree, hf_status_type, parameter_tvb, STATUS_TYPE_OFFSET, STATUS_TYPE_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_uint_format(parameter_tree, hf_status_ident, parameter_tvb, STATUS_IDENT_OFFSET, STATUS_IDENT_LENGTH,
status_id, "Status identification: %u (%s)", status_id,
val_to_str_const(status_type * 256 * 256 + status_id, status_type_id_values, "unknown"));
proto_item_append_text(parameter_item, " (%s)",
val_to_str_const(status_type * 256 * 256 + status_id, status_type_id_values, "unknown status information"));
}
#define ASP_IDENTIFIER_OFFSET PARAMETER_VALUE_OFFSET
#define ASP_IDENTIFIER_LENGTH 4
static void
dissect_asp_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_asp_id, parameter_tvb, ASP_IDENTIFIER_OFFSET, ASP_IDENTIFIER_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, ASP_IDENTIFIER_OFFSET));
}
#define CORRELATION_ID_LENGTH 4
#define CORRELATION_ID_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_correlation_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_correlation_id, parameter_tvb, CORRELATION_ID_OFFSET, CORRELATION_ID_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, CORRELATION_ID_OFFSET));
}
#define DATA_1_MTP3_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_protocol_data_1_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_item *parameter_item)
{
tvbuff_t *payload_tvb;
uint32_t payload_length;
payload_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
payload_tvb = tvb_new_subset_length(parameter_tvb, DATA_1_MTP3_OFFSET, payload_length);
proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH);
call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
proto_item_set_text(parameter_item, "Data 1 parameter");
}
#define DATA_2_LI_LENGTH 1
#define DATA_2_LI_OFFSET PARAMETER_VALUE_OFFSET
#define DATA_2_MTP3_OFFSET (DATA_2_LI_OFFSET + DATA_2_LI_LENGTH)
static void
dissect_protocol_data_2_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree, proto_item *parameter_item)
{
tvbuff_t *payload_tvb;
uint32_t payload_length;
payload_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH - DATA_2_LI_LENGTH;
proto_tree_add_item(parameter_tree, hf_data_2_li, parameter_tvb, DATA_2_LI_OFFSET, DATA_2_LI_LENGTH, ENC_BIG_ENDIAN);
payload_tvb = tvb_new_subset_length(parameter_tvb, DATA_2_MTP3_OFFSET, payload_length);
proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH + DATA_2_LI_LENGTH);
call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
}
#define STATUS_LPO_SET 0x0
#define STATUS_LPO_CLEAR 0x1
#define STATUS_EMER_SET 0x2
#define STATUS_EMER_CLEAR 0x3
#define STATUS_FLUSH_BUFFERS 0x4
#define STATUS_CONTINUE 0x5
#define STATUS_CLEAR_RTB 0x6
#define STATUS_AUDIT 0x7
#define STATUS_CONG_CLEAR 0x8
#define STATUS_CONG_ACCEPT 0x9
#define STATUS_CONG_DISCARD 0xa
static const value_string state_values[] = {
{ STATUS_LPO_SET, "Request local processor outage" },
{ STATUS_LPO_CLEAR, "Request local processor outage recovered" },
{ STATUS_EMER_SET, "Request emergency alignment" },
{ STATUS_EMER_CLEAR, "Request normal alignment (cancel emergency)" },
{ STATUS_FLUSH_BUFFERS, "Flush or clear receive, transmit and retransmit queues" },
{ STATUS_CONTINUE, "Continue or Resume" },
{ STATUS_CLEAR_RTB, "Clear the retransmit queue" },
{ STATUS_AUDIT, "Audit state of link" },
{ STATUS_CONG_CLEAR, "Congestion cleared" },
{ STATUS_CONG_ACCEPT, "Congestion accept" },
{ STATUS_CONG_DISCARD, "Congestion discard" },
{0, NULL } };
#define STATE_LENGTH 4
#define STATE_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_state_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_state, parameter_tvb, STATE_OFFSET, STATE_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, STATE_OFFSET), state_values, "unknown"));
}
#define EVENT_RPO_ENTER 0x1
#define EVENT_RPO_EXIT 0x2
#define EVENT_LPO_ENTER 0x3
#define EVENT_LPO_EXIT 0x4
static const value_string event_values[] = {
{ EVENT_RPO_ENTER, "Remote entered processor outage" },
{ EVENT_RPO_EXIT, "Remote exited processor outage" },
{ EVENT_LPO_ENTER, "Link entered processor outage" },
{ EVENT_LPO_EXIT, "Link exited processor outage" },
{0, NULL } };
#define EVENT_LENGTH 4
#define EVENT_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_state_event_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_event, parameter_tvb, EVENT_OFFSET, EVENT_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, STATE_OFFSET), event_values, "unknown"));
}
#define LEVEL_NONE 0x0
#define LEVEL_1 0x1
#define LEVEL_2 0x2
#define LEVEL_3 0x3
static const value_string level_values[] = {
{ LEVEL_NONE, "No congestion" },
{ LEVEL_1, "Congestion Level 1" },
{ LEVEL_2, "Congestion Level 2" },
{ LEVEL_3, "Congestion Level 3" },
{0, NULL } };
#define CONGESTION_STATUS_LENGTH 4
#define CONGESTION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_congestion_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_congestion_status, parameter_tvb, CONGESTION_STATUS_OFFSET, CONGESTION_STATUS_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, CONGESTION_STATUS_OFFSET), level_values, "unknown"));
}
#define DISCARD_STATUS_LENGTH 4
#define DISCARD_STATUS_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_discard_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_discard_status, parameter_tvb, DISCARD_STATUS_OFFSET, DISCARD_STATUS_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, DISCARD_STATUS_OFFSET), level_values, "unknown"));
}
#define ACTION_RTRV_BSN 0x1
#define ACTION_RTRV_MSGS 0x2
static const value_string action_values[] = {
{ ACTION_RTRV_BSN, "Retrieve the backward sequence number" },
{ ACTION_RTRV_MSGS, "Retrieve the PDUs from the transmit and retransmit queues" },
{0, NULL } };
#define ACTION_LENGTH 4
#define ACTION_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_action_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_action, parameter_tvb, ACTION_OFFSET, ACTION_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, ACTION_OFFSET), action_values, "unknown"));
}
#define SEQUENCE_NUMBER_LENGTH 4
#define SEQUENCE_NUMBER_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_sequence_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_sequence_number, parameter_tvb, SEQUENCE_NUMBER_OFFSET, SEQUENCE_NUMBER_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, SEQUENCE_NUMBER_OFFSET));
}
#define RESULT_SUCCESS 0x0
#define RESULT_FAILURE 0x1
static const value_string retrieval_result_values[] = {
{ RESULT_SUCCESS, "Action successful" },
{ RESULT_FAILURE , "Action failed" },
{ 0, NULL } };
#define RETRIEVAL_RESULT_LENGTH 4
#define RETRIEVAL_RESULT_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_retrieval_result_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_retrieval_result, parameter_tvb, RETRIEVAL_RESULT_OFFSET, RETRIEVAL_RESULT_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, RETRIEVAL_RESULT_OFFSET), retrieval_result_values, "unknown"));
}
static void
// NOLINTNEXTLINE(misc-no-recursion)
dissect_link_key_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
uint16_t parameters_length;
parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
}
#define LOCAL_LK_ID_LENGTH 4
#define LOCAL_LK_ID_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_local_lk_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_local_lk_id, parameter_tvb, LOCAL_LK_ID_OFFSET, LOCAL_LK_ID_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, LOCAL_LK_ID_OFFSET));
}
#define SDT_RESERVED_LENGTH 2
#define SDT_ID_LENGTH 2
#define SDT_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
#define SDT_ID_OFFSET (SDT_RESERVED_OFFSET + SDT_RESERVED_LENGTH)
static void
dissect_sdt_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_sdt_reserved, parameter_tvb, SDT_RESERVED_OFFSET, SDT_RESERVED_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(parameter_tree, hf_sdt_id, parameter_tvb, SDT_ID_OFFSET, SDT_ID_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohs(parameter_tvb, SDT_ID_OFFSET));
}
#define SDL_RESERVED_LENGTH 2
#define SDL_ID_LENGTH 2
#define SDL_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
#define SDL_ID_OFFSET (SDL_RESERVED_OFFSET + SDL_RESERVED_LENGTH)
static void
dissect_sdl_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_sdl_reserved, parameter_tvb, SDL_RESERVED_OFFSET, SDL_RESERVED_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(parameter_tree, hf_sdl_id, parameter_tvb, SDL_ID_OFFSET, SDL_ID_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohs(parameter_tvb, SDL_ID_OFFSET));
}
static void
// NOLINTNEXTLINE(misc-no-recursion)
dissect_registration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
uint16_t parameters_length;
parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
}
#define SUCCESSFULL_REGISTRATION_STATUS 0
#define UNKNOWN_REGISTRATION_STATUS 1
#define INVALID_SDLI_REGISTRATION_STATUS 2
#define INVALID_SDTI_REGISTRATION_STATUS 3
#define INVALID_LINK_KEY_REGISTRATION_STATUS 4
#define PERMISSION_DENIED_REGISTRATION_STATUS 5
#define OVERLAPPING_LINK_KEY_REGISTRATION_STATUS 6
#define LINK_KEY_NOT_PROVISIONED_REGISTRATION_STATUS 7
#define INSUFFICIENT_RESOURCES_REGISTRATION_STATUS 8
static const value_string registration_status_values[] = {
{ SUCCESSFULL_REGISTRATION_STATUS, "Successfully registered" },
{ UNKNOWN_REGISTRATION_STATUS, "Error - Unknown" },
{ INVALID_SDLI_REGISTRATION_STATUS, "Error - Invalid SDLI" },
{ INVALID_SDTI_REGISTRATION_STATUS, "Error - Invalid SDTI" },
{ INVALID_LINK_KEY_REGISTRATION_STATUS, "Error - Invalid link key" },
{ PERMISSION_DENIED_REGISTRATION_STATUS, "Error - Permission denied" },
{ OVERLAPPING_LINK_KEY_REGISTRATION_STATUS, "Error - Overlapping (Non-unique) link key" },
{ LINK_KEY_NOT_PROVISIONED_REGISTRATION_STATUS, "Error - Link key not provisioned" },
{ INSUFFICIENT_RESOURCES_REGISTRATION_STATUS, "Error - Insufficient resources" },
{ 0, NULL } };
#define REGISTRATION_STATUS_LENGTH 4
#define REGISTRATION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_registration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_registration_status, parameter_tvb, REGISTRATION_STATUS_OFFSET, REGISTRATION_STATUS_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, REGISTRATION_STATUS_OFFSET), registration_status_values, "unknown"));
}
static void
// NOLINTNEXTLINE(misc-no-recursion)
dissect_deregistration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
uint16_t parameters_length;
parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
}
#define SUCCESSFULL_DEREGISTRATION_STATUS 0
#define UNKNOWN_DEREGISTRATION_STATUS 1
#define INVALID_INTERFACE_IDENTIFIER_DEREGISTRATION_STATUS 2
#define PERMISSION_DENIED_DEREGISTRATION_STATUS 3
#define NOT_REGISTRED_DEREGISTRATION_STATUS 4
static const value_string deregistration_status_values[] = {
{ SUCCESSFULL_DEREGISTRATION_STATUS, "Successfully deregistered" },
{ UNKNOWN_DEREGISTRATION_STATUS, "Error - Unknown" },
{ INVALID_INTERFACE_IDENTIFIER_DEREGISTRATION_STATUS, "Error - Invalid interface identifier" },
{ PERMISSION_DENIED_DEREGISTRATION_STATUS, "Error - Permission denied" },
{ NOT_REGISTRED_DEREGISTRATION_STATUS, "Error - Not registered" },
{ 0, NULL } };
#define DEREGISTRATION_STATUS_LENGTH 4
#define DEREGISTRATION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
static void
dissect_deregistration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_deregistration_status, parameter_tvb, DEREGISTRATION_STATUS_OFFSET, DEREGISTRATION_STATUS_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, DEREGISTRATION_STATUS_OFFSET), deregistration_status_values, "unknown"));
}
static void
dissect_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
uint16_t parameter_value_length;
parameter_value_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
if (parameter_value_length > 0)
proto_tree_add_item(parameter_tree, hf_parameter_value, parameter_tvb, PARAMETER_VALUE_OFFSET, parameter_value_length, ENC_NA);
proto_item_append_text(parameter_item, " with tag %u and %u byte%s value",
tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET), parameter_value_length, plurality(parameter_value_length, "", "s"));
}
/* Common parameter tags */
#define INTERFACE_IDENTIFIER_INT_PARAMETER_TAG 0x0001
#define INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG 0x0003
#define INFO_STRING_PARAMETER_TAG 0x0004
#define DIAGNOSTIC_INFORMATION_PARAMETER_TAG 0x0007
#define INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG 0x0008
#define HEARTBEAT_DATA_PARAMETER_TAG 0x0009
#define TRAFFIC_MODE_TYPE_PARAMETER_TAG 0x000b
#define ERROR_CODE_PARAMETER_TAG 0x000c
#define STATUS_PARAMETER_TAG 0x000d
#define ASP_IDENTIFIER_PARAMETER_TAG 0x0011
#define CORRELATION_IDENTIFIER_PARAMETER_TAG 0x0013
/* M2PA specific parameter tags */
#define PROTOCOL_DATA_1_PARAMETER_TAG 0x0300
#define PROTOCOL_DATA_2_PARAMETER_TAG 0x0301
#define STATE_REQUEST_PARAMETER_TAG 0x0302
#define STATE_EVENT_PARAMETER_TAG 0x0303
#define CONGESTION_STATUS_PARAMETER_TAG 0x0304
#define DISCARD_STATUS_PARAMETER_TAG 0x0305
#define ACTION_PARAMETER_TAG 0x0306
#define SEQUENCE_NUMBER_PARAMETER_TAG 0x0307
#define RETRIEVAL_RESULT_PARAMETER_TAG 0x0308
#define LINK_KEY_PARAMETER_TAG 0x0309
#define LOCAL_LK_IDENTIFIER_PARAMETER_TAG 0x030a
#define SDT_IDENTIFIER_PARAMETER_TAG 0x030b
#define SDL_IDENTIFIER_PARAMETER_TAG 0x030c
#define REG_RESULT_PARAMETER_TAG 0x030d
#define REG_STATUS_PARAMETER_TAG 0x030e
#define DEREG_RESULT_PARAMETER_TAG 0x030f
#define DEREG_STATUS_PARAMETER_TAG 0x0310
static const value_string parameter_tag_values[] = {
{ INTERFACE_IDENTIFIER_INT_PARAMETER_TAG, "Interface identifier (integer)" },
{ INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG, "Interface identifier (text)" },
{ INFO_STRING_PARAMETER_TAG, "Info string" },
{ DIAGNOSTIC_INFORMATION_PARAMETER_TAG, "Diagnostic information" },
{ INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG, "Interface identifier (integer range)" },
{ HEARTBEAT_DATA_PARAMETER_TAG, "Heartbeat data" },
{ TRAFFIC_MODE_TYPE_PARAMETER_TAG, "Traffic mode type" },
{ ERROR_CODE_PARAMETER_TAG, "Error code" },
{ STATUS_PARAMETER_TAG, "Status type / information" },
{ ASP_IDENTIFIER_PARAMETER_TAG, "ASP identifier" },
{ CORRELATION_IDENTIFIER_PARAMETER_TAG, "Correlation identifier" },
{ PROTOCOL_DATA_1_PARAMETER_TAG, "Protocol data 1" },
{ PROTOCOL_DATA_2_PARAMETER_TAG, "Protocol data 2" },
{ STATE_REQUEST_PARAMETER_TAG, "State request" },
{ STATE_EVENT_PARAMETER_TAG, "State event" },
{ CONGESTION_STATUS_PARAMETER_TAG, "Congestion state" },
{ DISCARD_STATUS_PARAMETER_TAG, "Discard state" },
{ ACTION_PARAMETER_TAG, "Action" },
{ SEQUENCE_NUMBER_PARAMETER_TAG, "Sequence number" },
{ RETRIEVAL_RESULT_PARAMETER_TAG, "Retrieval result" },
{ LINK_KEY_PARAMETER_TAG, "Link key" },
{ LOCAL_LK_IDENTIFIER_PARAMETER_TAG, "Local LK identifier" },
{ SDT_IDENTIFIER_PARAMETER_TAG, "SDT identifier" },
{ SDL_IDENTIFIER_PARAMETER_TAG, "SDL identifier" },
{ REG_RESULT_PARAMETER_TAG, "Registration result" },
{ REG_STATUS_PARAMETER_TAG, "Registration status" },
{ DEREG_RESULT_PARAMETER_TAG, "Deregistration result" },
{ DEREG_STATUS_PARAMETER_TAG, "Deregistration status" },
{ 0, NULL } };
/*
* Default preference for 'Protocol Data 1 Parameter Tag' is RFC3331 value
* defined above (PROTOCOL_DATA_1_PARAMETER_TAG)
*
* The other option is the old Draft 7 value defined below.
*/
#define PROTOCOL_DATA_1_DRAFT_7 0x000e
static int protocol_data_1_global = PROTOCOL_DATA_1_PARAMETER_TAG;
static void
// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
{
uint16_t tag, length, padding_length;
proto_item *parameter_item;
proto_tree *parameter_tree;
/* extract tag and length from the parameter */
tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET);
length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
/* calculate padding and total length */
padding_length = tvb_reported_length(parameter_tvb) - length;
/* create proto_tree stuff */
parameter_tree = proto_tree_add_subtree(m2ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1,
ett_m2ua_parameter, ¶meter_item, val_to_str_const(tag, parameter_tag_values, "Unknown parameter"));
if ((protocol_data_1_global == PROTOCOL_DATA_1_DRAFT_7) &&
(tag == PROTOCOL_DATA_1_DRAFT_7))
{
/* add tag and length to the m2ua tree */
proto_tree_add_uint_format_value(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH,
tag, "Protocol data 1 (0x000e)");
proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
tag = PROTOCOL_DATA_1_PARAMETER_TAG;
}
else
{
/* add tag and length to the m2ua tree */
proto_tree_add_item(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
}
switch(tag) {
case INTERFACE_IDENTIFIER_INT_PARAMETER_TAG:
dissect_interface_identifier_int_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG:
dissect_interface_identifier_text_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case INFO_STRING_PARAMETER_TAG:
dissect_info_string_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case DIAGNOSTIC_INFORMATION_PARAMETER_TAG:
dissect_diagnostic_information_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG:
dissect_interface_identifier_range_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case HEARTBEAT_DATA_PARAMETER_TAG:
dissect_heartbeat_data_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case TRAFFIC_MODE_TYPE_PARAMETER_TAG:
dissect_traffic_mode_type_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case ERROR_CODE_PARAMETER_TAG:
dissect_error_code_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case STATUS_PARAMETER_TAG:
dissect_status_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case ASP_IDENTIFIER_PARAMETER_TAG:
dissect_asp_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case CORRELATION_IDENTIFIER_PARAMETER_TAG:
dissect_correlation_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case PROTOCOL_DATA_1_PARAMETER_TAG:
dissect_protocol_data_1_parameter(parameter_tvb, pinfo, tree, parameter_item);
break;
case PROTOCOL_DATA_2_PARAMETER_TAG:
dissect_protocol_data_2_parameter(parameter_tvb, pinfo, tree, parameter_tree, parameter_item);
break;
case STATE_REQUEST_PARAMETER_TAG:
dissect_state_request_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case STATE_EVENT_PARAMETER_TAG:
dissect_state_event_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case CONGESTION_STATUS_PARAMETER_TAG:
dissect_congestion_status_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case DISCARD_STATUS_PARAMETER_TAG:
dissect_discard_status_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case ACTION_PARAMETER_TAG:
dissect_action_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case SEQUENCE_NUMBER_PARAMETER_TAG:
dissect_sequence_number_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case RETRIEVAL_RESULT_PARAMETER_TAG:
dissect_retrieval_result_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case LINK_KEY_PARAMETER_TAG:
dissect_link_key_parameter(parameter_tvb, pinfo, tree, parameter_tree);
break;
case LOCAL_LK_IDENTIFIER_PARAMETER_TAG:
dissect_local_lk_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case SDT_IDENTIFIER_PARAMETER_TAG:
dissect_sdt_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case SDL_IDENTIFIER_PARAMETER_TAG:
dissect_sdl_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case REG_RESULT_PARAMETER_TAG:
dissect_registration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
break;
case REG_STATUS_PARAMETER_TAG:
dissect_registration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case DEREG_RESULT_PARAMETER_TAG:
dissect_deregistration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
break;
case DEREG_STATUS_PARAMETER_TAG:
dissect_deregistration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
default:
dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
};
if (padding_length > 0)
proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
}
static void
// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
{
int offset, length, total_length, remaining_length;
tvbuff_t *parameter_tvb;
offset = 0;
while((remaining_length = tvb_reported_length_remaining(parameters_tvb, offset))) {
length = tvb_get_ntohs(parameters_tvb, offset + PARAMETER_LENGTH_OFFSET);
total_length = WS_ROUNDUP_4(length);
if (remaining_length >= length)
total_length = MIN(total_length, remaining_length);
/* create a tvb for the parameter including the padding bytes */
parameter_tvb = tvb_new_subset_length(parameters_tvb, offset, total_length);
increment_dissection_depth(pinfo);
dissect_parameter(parameter_tvb, pinfo, tree, m2ua_tree);
decrement_dissection_depth(pinfo);
/* get rid of the handled parameter */
offset += total_length;
}
}
static void
dissect_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
{
tvbuff_t *common_header_tvb, *parameters_tvb;
common_header_tvb = tvb_new_subset_length(message_tvb, 0, COMMON_HEADER_LENGTH);
parameters_tvb = tvb_new_subset_remaining(message_tvb, COMMON_HEADER_LENGTH);
dissect_common_header(common_header_tvb, pinfo, m2ua_tree);
dissect_parameters(parameters_tvb, pinfo, tree, m2ua_tree);
}
static int
dissect_m2ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *m2ua_item;
proto_tree *m2ua_tree;
/* make entry in the Protocol column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2UA");
/* create the m2ua protocol tree */
m2ua_item = proto_tree_add_item(tree, proto_m2ua, message_tvb, 0, -1, ENC_NA);
m2ua_tree = proto_item_add_subtree(m2ua_item, ett_m2ua);
/* dissect the message */
dissect_message(message_tvb, pinfo, tree, m2ua_tree);
return tvb_captured_length(message_tvb);
}
/* Register the protocol with Wireshark */
void
proto_register_m2ua(void)
{
/* Setup list of header fields */
static hf_register_info hf[] = {
{ &hf_version, { "Version", "m2ua.version", FT_UINT8, BASE_DEC, VALS(protocol_version_values), 0x0, NULL, HFILL } },
{ &hf_reserved, { "Reserved", "m2ua.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_message_class, { "Message class", "m2ua.message_class", FT_UINT8, BASE_DEC, VALS(message_class_values), 0x0, NULL, HFILL } },
{ &hf_message_type, { "Message Type", "m2ua.message_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_message_length, { "Message length", "m2ua.message_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_parameter_tag, { "Parameter Tag", "m2ua.parameter_tag", FT_UINT16, BASE_HEX, VALS(parameter_tag_values), 0x0, NULL, HFILL } },
{ &hf_parameter_length, { "Parameter length", "m2ua.parameter_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_parameter_value, { "Parameter value", "m2ua.parameter_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_parameter_padding, { "Padding", "m2ua.parameter_padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_interface_id_int, { "Interface Identifier (integer)", "m2ua.interface_identifier_int", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_interface_id_text, { "Interface identifier (text)", "m2ua.interface_identifier_text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_info_string, { "Info string", "m2ua.info_string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_diagnostic_information, { "Diagnostic information", "m2ua.diagnostic_information", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_interface_id_start, { "Interface Identifier (start)", "m2ua.interface_identifier_start", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_interface_id_stop, { "Interface Identifier (stop)", "m2ua.interface_identifier_stop", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_heartbeat_data, { "Heartbeat data", "m2ua.heartbeat_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_traffic_mode_type, { "Traffic mode Type", "m2ua.traffic_mode_type", FT_UINT32, BASE_DEC, VALS(traffic_mode_type_values), 0x0, NULL, HFILL } },
{ &hf_error_code, { "Error code", "m2ua.error_code", FT_UINT32, BASE_DEC, VALS(error_code_values), 0x0, NULL, HFILL } },
{ &hf_status_type, { "Status type", "m2ua.status_type", FT_UINT16, BASE_DEC, VALS(status_type_values), 0x0, NULL, HFILL } },
{ &hf_status_ident, { "Status info", "m2ua.status_info", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_asp_id, { "ASP identifier", "m2ua.asp_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_correlation_id, { "Correlation identifier", "m2ua.correlation_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_data_2_li, { "Length indicator", "m2ua.data_2_li", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_state, { "State", "m2ua.state", FT_UINT32, BASE_DEC, VALS(state_values), 0x0, NULL, HFILL } },
{ &hf_event, { "Event", "m2ua.event", FT_UINT32, BASE_DEC, VALS(event_values), 0x0, NULL, HFILL } },
{ &hf_congestion_status, { "Congestion status", "m2ua.congestion_status", FT_UINT32, BASE_DEC, VALS(level_values), 0x0, NULL, HFILL } },
{ &hf_discard_status, { "Discard status", "m2ua.discard_status", FT_UINT32, BASE_DEC, VALS(level_values), 0x0, NULL, HFILL } },
{ &hf_action, { "Actions", "m2ua.action", FT_UINT32, BASE_DEC, VALS(action_values), 0x0, NULL, HFILL } },
{ &hf_sequence_number, { "Sequence number", "m2ua.sequence_number", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_retrieval_result, { "Retrieval result", "m2ua.retrieval_result", FT_UINT32, BASE_DEC, VALS(retrieval_result_values), 0x0, NULL, HFILL } },
{ &hf_local_lk_id, { "Local LK identifier", "m2ua.local_lk_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_sdt_reserved, { "Reserved", "m2ua.sdt_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_sdt_id, { "SDT identifier", "m2ua.sdt_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_sdl_reserved, { "Reserved", "m2ua.sdl_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_sdl_id, { "SDL identifier", "m2ua.sdl_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_registration_status, { "Registration status", "m2ua.registration_status", FT_UINT32, BASE_DEC, VALS(registration_status_values), 0x0, NULL, HFILL } },
{ &hf_deregistration_status, { "Deregistration status", "m2ua.deregistration_status", FT_UINT32, BASE_DEC, VALS(deregistration_status_values), 0x0, NULL, HFILL } },
};
/* Setup protocol subtree array */
static int *ett[] = {
&ett_m2ua,
&ett_m2ua_parameter,
};
static const enum_val_t protocol_data_1_options[] = {
{ "draft-7", "0x000e (Draft 7)", PROTOCOL_DATA_1_DRAFT_7 },
{ "rfc3331", "0x0300 (RFC3331)", PROTOCOL_DATA_1_PARAMETER_TAG },
{ NULL, NULL, 0 }
};
module_t *m2ua_module;
/* Register the protocol name and description */
proto_m2ua = proto_register_protocol("MTP 2 User Adaptation Layer", "M2UA", "m2ua");
m2ua_handle = register_dissector("m2ua", dissect_m2ua, proto_m2ua);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_m2ua, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
m2ua_module = prefs_register_protocol(proto_m2ua, NULL);
prefs_register_enum_preference(m2ua_module,
"protocol_data_1_tag",
"Protocol Data 1 Parameter Tag",
"The value of the parameter tag for protocol data 1",
&protocol_data_1_global,
protocol_data_1_options,
false);
}
void
proto_reg_handoff_m2ua(void)
{
mtp3_handle = find_dissector_add_dependency("mtp3", proto_m2ua);
dissector_add_uint("sctp.ppi", M2UA_PAYLOAD_PROTOCOL_ID, m2ua_handle);
dissector_add_uint("sctp.port", SCTP_PORT_M2UA, m2ua_handle);
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
|