epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-evrc.c
blob93fdd7bba3aae82ac087e64925660e204bdeebe3
1 /* packet-evrc.c
2 * Routines for:
3 * EVRC EVRC-B EVRC-WB EVRC-NW EVRC-NW2K
4 * RTP payload header dissection
6 * Copyright 2008, Michael Lum <michael.lum [AT] shaw.ca>
7 * In association with Star Solutions
9 * Title 3GPP2 Other
11 * Enhanced Variable Rate Codec, Speech Service Options 3, 68, 70, 73 and 77
12 * for Wideband Spread Spectrum Digital Systems
13 * 3GPP2 C.S0014-E v1.0 TIA-127-?
15 * RFC 3558 https://tools.ietf.org/html/rfc3558
16 * RFC 4788 https://tools.ietf.org/html/rfc4788
17 * RFC 5188 https://tools.ietf.org/html/rfc5188
18 * draft-agupta-payload-rtp-evrc-nw2k-00
20 * Wireshark - Network traffic analyzer
21 * By Gerald Combs <gerald@wireshark.org>
22 * Copyright 1998 Gerald Combs
24 * SPDX-License-Identifier: GPL-2.0-or-later
27 #include "config.h"
29 #include <epan/packet.h>
30 #include <epan/prefs.h>
31 #include <epan/expert.h>
32 #include <epan/tfs.h>
34 #include <wsutil/str_util.h>
36 /* PROTOTYPES/FORWARDS */
38 void proto_register_evrc(void);
39 void proto_reg_handoff_evrc(void);
41 static dissector_handle_t evrc_handle;
42 static dissector_handle_t evrcb_handle;
43 static dissector_handle_t evrcwb_handle;
44 static dissector_handle_t evrcnw_handle;
45 static dissector_handle_t evrcnw2k_handle;
46 static dissector_handle_t evrc_legacy_handle;
48 static const value_string evrc_frame_type_vals[] = {
49 { 0, "Blank (0 bits)" },
50 { 1, "1/8 Rate (16 bits)" },
51 { 2, "Not valid (1/4 Rate : 40 bits)" },
52 { 3, "1/2 Rate (80 bits)" },
53 { 4, "Full Rate (171 bits; + 5 bits padding)" },
54 { 5, "Erasure (0 bits)" },
55 { 0, NULL }
58 static const value_string evrc_b_frame_type_vals[] = {
59 { 0, "Blank (0 bits)" },
60 { 1, "1/8 Rate (16 bits)" },
61 { 2, "1/4 Rate (40 bits)" },
62 { 3, "1/2 Rate (80 bits)" },
63 { 4, "Full Rate (171 bits; + 5 bits padding)" },
64 { 5, "Erasure (0 bits)" },
65 { 0, NULL }
68 static const value_string evrc_legacy_frame_type_vals[] = {
69 { 0, "Blank (0 bits)" },
70 { 1, "1/8 Rate (16 bits)" },
71 { 3, "1/2 Rate (80 bits)" },
72 { 4, "Full Rate (171 bits; + 5 bits padding)" },
73 { 14, "Erasure (0 bits)" },
74 { 0, NULL }
77 static const value_string evrc_mode_request_vals[] = {
78 { 0, "Rate Reduction 0 (Full Rate)" },
79 { 1, "Rate Reduction 1" },
80 { 2, "Rate Reduction 2" },
81 { 3, "Rate Reduction 3" },
82 { 4, "Rate Reduction 4" },
83 { 0, NULL }
86 static const value_string evrc_b_mode_request_vals[] = {
87 { 0, "Encoder Operating Point 0 (Full Rate)" },
88 { 1, "Encoder Operating Point 1" },
89 { 2, "Encoder Operating Point 2" },
90 { 3, "Encoder Operating Point 3" },
91 { 4, "Encoder Operating Point 4" },
92 { 5, "Encoder Operating Point 5" },
93 { 6, "Encoder Operating Point 6" },
94 { 7, "Encoder Operating Point 7 (1/2 rate max)" },
95 { 0, NULL }
98 static const value_string evrc_wb_mode_request_vals[] = {
99 { 0, "Encoder Operating Point 0 (Full Rate)" },
100 { 1, "Reserved" },
101 { 2, "Reserved" },
102 { 3, "Reserved" },
103 { 4, "Encoder Operating Point 4" },
104 { 5, "Reserved" },
105 { 6, "Reserved" },
106 { 7, "Encoder Operating Point 7 (1/2 rate max)" },
107 { 0, NULL }
110 static const value_string evrc_nw_mode_request_vals[] = {
111 { 0, "Encoder Operating Point 0 (EVRC-WB COP0)" },
112 { 1, "Encoder Operating Point 1 (EVRC-B COP0/EVRC-WB COP4)" },
113 { 2, "Encoder Operating Point 2 (EVRC-B COP2)" },
114 { 3, "Encoder Operating Point 3 (EVRC-B COP3)" },
115 { 4, "Encoder Operating Point 4 (EVRC-B COP4)" },
116 { 5, "Encoder Operating Point 5 (EVRC-B COP5)" },
117 { 6, "Encoder Operating Point 6 (EVRC-B COP6)" },
118 { 7, "Encoder Operating Point 7 (EVRC-B COP7/EVRC-WB COP7)" },
119 { 0, NULL }
122 static const value_string evrc_nw2k_mode_request_vals[] = {
123 { 0, "Encoder Operating Point 0 (EVRC-WB COP0)" },
124 { 1, "Encoder Operating Point 1 (EVRC-B COP0/EVRC-WB COP4)" },
125 { 2, "Encoder Operating Point 2 (EVRC-B COP2)" },
126 { 3, "Encoder Operating Point 3 (EVRC-B COP3/EVRC-NW2k)" },
127 { 4, "Encoder Operating Point 4 (EVRC-B COP4)" },
128 { 5, "Encoder Operating Point 5 (EVRC-B COP5)" },
129 { 6, "Encoder Operating Point 6 (EVRC-B COP6)" },
130 { 7, "Encoder Operating Point 7 (EVRC-B COP7/EVRC-WB COP7)" },
131 { 0, NULL }
134 static const true_false_string toc_further_entries_bit_vals = {
135 "More ToC entries follow",
136 "End of ToC entries"
139 static const true_false_string evrc_nw2k_enc_capability_bit_vals = {
140 "Mode-0 wideband encoding capable",
141 "Mode-0 wideband encoding incapable (i.e. narrowband encoding only)"
144 typedef enum
146 EVRC_VARIANT_EVRC,
147 EVRC_VARIANT_EVRC_B,
148 EVRC_VARIANT_EVRC_WB,
149 EVRC_VARIANT_EVRC_NW,
150 EVRC_VARIANT_EVRC_NW2k,
151 EVRC_VARIANT_EVRC_LEGACY
153 evrc_variant_t;
156 /* Initialize the protocol and registered fields */
157 static int proto_evrc;
158 static int proto_evrcb;
159 static int proto_evrcwb;
160 static int proto_evrcnw;
161 static int proto_evrcnw2k;
162 static int proto_evrc_legacy;
164 static int hf_evrc_reserved;
165 static int hf_evrc_reserved_2k;
166 static int hf_evrc_enc_capability_2k;
167 static int hf_evrc_interleave_length;
168 static int hf_evrc_interleave_index;
169 static int hf_evrc_mode_request;
170 static int hf_evrc_b_mode_request;
171 static int hf_evrc_wb_mode_request;
172 static int hf_evrc_nw_mode_request;
173 static int hf_evrc_nw2k_mode_request;
174 static int hf_evrc_frame_count;
175 static int hf_evrc_toc_frame_type_high;
176 static int hf_evrc_toc_frame_type_low;
177 static int hf_evrc_b_toc_frame_type_high;
178 static int hf_evrc_b_toc_frame_type_low;
179 static int hf_evrc_padding;
180 static int hf_evrc_speech_data;
181 static int hf_evrc_legacy_toc_fe_ind;
182 static int hf_evrc_legacy_toc_reduc_rate;
183 static int hf_evrc_legacy_toc_frame_type;
185 /* Initialize the subtree pointers */
186 static int ett_evrc;
187 static int ett_toc;
189 static expert_field ei_evrc_unknown_variant;
192 * Variables to allow for proper deletion of dissector registration when
193 * the user changes values
195 static bool legacy_pt_60;
198 static uint8_t
199 evrc_frame_type_to_octs(uint8_t frame_type)
201 switch (frame_type)
203 default:
204 break;
206 case 1: /* 1/8 rate */
207 return 2;
209 case 2: /* 1/4 rate */
210 return 5;
212 case 3: /* 1/2 rate */
213 return 10;
215 case 4: /* full rate */
216 return 22;
219 return 0;
222 /* GENERIC EVRC DISSECTOR FUNCTIONS */
224 static void
225 dissect_evrc_aux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, evrc_variant_t evrc_variant)
227 uint8_t oct;
228 uint8_t frame_count;
229 uint8_t i;
230 uint32_t offset, saved_offset;
231 bool further_entries;
232 uint32_t len;
233 proto_item *item = NULL;
234 proto_tree *evrc_tree = NULL;
235 proto_tree *toc_tree = NULL;
236 int hf_mode_request;
237 int hf_toc_frame_type_high;
238 int hf_toc_frame_type_low;
241 * assumed max number of speech frames based on
242 * frame count being 5 bits + 1
244 uint8_t speech_data_len[0x20];
247 col_set_str(pinfo->cinfo, COL_PROTOCOL, "EVRC");
249 if (!tree) return;
251 offset = 0;
252 memset(speech_data_len, 0, sizeof(speech_data_len));
254 len = tvb_reported_length(tvb);
256 item = proto_tree_add_item(tree, proto_evrc, tvb, 0, len, ENC_NA);
258 evrc_tree = proto_item_add_subtree(item, ett_evrc);
260 if (evrc_variant == EVRC_VARIANT_EVRC_LEGACY)
262 /* legacy 'payload type 60' draft-ietf-avt-evrc-07.txt header format */
264 proto_tree_add_item(evrc_tree, hf_evrc_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
265 proto_tree_add_item(evrc_tree, hf_evrc_interleave_length, tvb, offset, 1, ENC_BIG_ENDIAN);
266 proto_tree_add_item(evrc_tree, hf_evrc_interleave_index, tvb, offset, 1, ENC_BIG_ENDIAN);
268 offset++;
270 frame_count = 0;
271 further_entries = true;
272 while (further_entries && (frame_count < sizeof(speech_data_len)) &&
273 ((len - offset) > 0))
275 toc_tree =
276 proto_tree_add_subtree_format(evrc_tree, tvb, offset, 1, ett_toc, NULL, "ToC [%u]", frame_count+1);
278 proto_tree_add_item(toc_tree, hf_evrc_legacy_toc_fe_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
279 proto_tree_add_item(toc_tree, hf_evrc_legacy_toc_reduc_rate, tvb, offset, 1, ENC_BIG_ENDIAN);
280 proto_tree_add_item(toc_tree, hf_evrc_legacy_toc_frame_type, tvb, offset, 1, ENC_BIG_ENDIAN);
282 oct = tvb_get_uint8(tvb, offset);
283 further_entries = (oct & 0x80) ? true : false;
285 speech_data_len[frame_count] = evrc_frame_type_to_octs((uint8_t)(oct & 0x7f));
287 frame_count++;
288 offset++;
291 else
293 /* RFC 3558 header format */
295 switch (evrc_variant)
297 default:
298 proto_tree_add_expert(evrc_tree, pinfo, &ei_evrc_unknown_variant, tvb, offset, len);
299 return;
301 case EVRC_VARIANT_EVRC:
302 hf_mode_request = hf_evrc_mode_request;
303 hf_toc_frame_type_high = hf_evrc_toc_frame_type_high;
304 hf_toc_frame_type_low = hf_evrc_toc_frame_type_low;
306 proto_tree_add_item(evrc_tree, hf_evrc_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
307 break;
309 case EVRC_VARIANT_EVRC_B:
310 hf_mode_request = hf_evrc_b_mode_request;
311 hf_toc_frame_type_high = hf_evrc_b_toc_frame_type_high;
312 hf_toc_frame_type_low = hf_evrc_b_toc_frame_type_low;
314 proto_tree_add_item(evrc_tree, hf_evrc_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
315 break;
317 case EVRC_VARIANT_EVRC_WB:
318 hf_mode_request = hf_evrc_wb_mode_request;
319 hf_toc_frame_type_high = hf_evrc_b_toc_frame_type_high;
320 hf_toc_frame_type_low = hf_evrc_b_toc_frame_type_low;
322 proto_tree_add_item(evrc_tree, hf_evrc_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
323 break;
325 case EVRC_VARIANT_EVRC_NW:
326 hf_mode_request = hf_evrc_nw_mode_request;
327 hf_toc_frame_type_high = hf_evrc_b_toc_frame_type_high;
328 hf_toc_frame_type_low = hf_evrc_b_toc_frame_type_low;
330 proto_tree_add_item(evrc_tree, hf_evrc_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
331 break;
333 case EVRC_VARIANT_EVRC_NW2k:
334 hf_mode_request = hf_evrc_nw2k_mode_request;
335 hf_toc_frame_type_high = hf_evrc_b_toc_frame_type_high;
336 hf_toc_frame_type_low = hf_evrc_b_toc_frame_type_low;
338 proto_tree_add_item(evrc_tree, hf_evrc_reserved_2k, tvb, offset, 1, ENC_BIG_ENDIAN);
339 proto_tree_add_item(evrc_tree, hf_evrc_enc_capability_2k, tvb, offset, 1, ENC_BIG_ENDIAN);
340 break;
343 proto_tree_add_item(evrc_tree, hf_evrc_interleave_length, tvb, offset, 1, ENC_BIG_ENDIAN);
344 proto_tree_add_item(evrc_tree, hf_evrc_interleave_index, tvb, offset, 1, ENC_BIG_ENDIAN);
346 offset++;
348 proto_tree_add_item(evrc_tree, hf_mode_request, tvb, offset, 1, ENC_BIG_ENDIAN);
349 proto_tree_add_item(evrc_tree, hf_evrc_frame_count, tvb, offset, 1, ENC_BIG_ENDIAN);
352 * number of frames in PACKET is frame_count + 1
354 frame_count = (tvb_get_uint8(tvb, offset) & 0x1f) + 1;
356 offset++;
357 saved_offset = offset;
359 toc_tree =
360 proto_tree_add_subtree_format(evrc_tree, tvb, offset, -1, ett_toc, &item, "ToC - %u frame%s",
361 frame_count, plurality(frame_count, "", "s"));
363 i = 0;
364 while ((i < frame_count) &&
365 ((len - offset) > 0))
367 oct = tvb_get_uint8(tvb, offset);
369 proto_tree_add_item(toc_tree, hf_toc_frame_type_high, tvb, offset, 1, ENC_BIG_ENDIAN);
371 speech_data_len[i] = evrc_frame_type_to_octs((uint8_t)((oct & 0xf0) >> 4));
373 i++;
375 if (i < frame_count)
377 /* even number of frames */
378 proto_tree_add_item(toc_tree, hf_toc_frame_type_low, tvb, offset, 1, ENC_BIG_ENDIAN);
380 speech_data_len[i] = evrc_frame_type_to_octs((uint8_t)(oct & 0x0f));
382 i++;
385 offset++;
388 if (frame_count & 0x01)
390 /* odd number of frames */
391 proto_tree_add_item(toc_tree, hf_evrc_padding, tvb, offset-1, 1, ENC_BIG_ENDIAN);
394 proto_item_set_len(item, offset - saved_offset);
397 i = 0;
398 while ((i < frame_count) &&
399 ((len - offset) >= speech_data_len[i]))
401 proto_tree_add_bytes_format(evrc_tree, hf_evrc_speech_data, tvb, offset, speech_data_len[i], NULL, "Speech Data [%u]", i+1);
403 offset += speech_data_len[i];
404 i++;
408 static int
409 dissect_evrc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
411 dissect_evrc_aux(tvb, pinfo, tree, EVRC_VARIANT_EVRC);
412 return tvb_captured_length(tvb);
415 static int
416 dissect_evrcb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
418 dissect_evrc_aux(tvb, pinfo, tree, EVRC_VARIANT_EVRC_B);
419 return tvb_captured_length(tvb);
422 static int
423 dissect_evrcwb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
425 dissect_evrc_aux(tvb, pinfo, tree, EVRC_VARIANT_EVRC_WB);
426 return tvb_captured_length(tvb);
429 static int
430 dissect_evrcnw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
432 dissect_evrc_aux(tvb, pinfo, tree, EVRC_VARIANT_EVRC_NW);
433 return tvb_captured_length(tvb);
436 static int
437 dissect_evrcnw2k(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
439 dissect_evrc_aux(tvb, pinfo, tree, EVRC_VARIANT_EVRC_NW2k);
440 return tvb_captured_length(tvb);
443 static int
444 dissect_evrc_legacy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
446 dissect_evrc_aux(tvb, pinfo, tree, EVRC_VARIANT_EVRC_LEGACY);
447 return tvb_captured_length(tvb);
451 /* Register the protocol with Wireshark */
452 void
453 proto_register_evrc(void)
455 module_t *evrc_module;
457 /* Setup list of header fields */
459 static hf_register_info hf[] =
461 { &hf_evrc_reserved,
462 { "Reserved", "evrc.reserved",
463 FT_UINT8, BASE_HEX, NULL, 0xc0,
464 "Reserved bits", HFILL }
466 { &hf_evrc_reserved_2k,
467 { "Reserved", "evrc.reserved",
468 FT_UINT8, BASE_HEX, NULL, 0x80,
469 "Reserved bits", HFILL }
471 { &hf_evrc_enc_capability_2k,
472 { "Encoding Capability", "evrc.enc_capability",
473 FT_BOOLEAN, 8, TFS(&evrc_nw2k_enc_capability_bit_vals), 0x40,
474 "Encoding Capability Identification", HFILL }
476 { &hf_evrc_interleave_length,
477 { "Interleave Length", "evrc.interleave_len",
478 FT_UINT8, BASE_DEC, NULL, 0x38,
479 "Interleave length bits", HFILL }
481 { &hf_evrc_interleave_index,
482 { "Interleave Index", "evrc.interleave_idx",
483 FT_UINT8, BASE_DEC, NULL, 0x07,
484 "Interleave index bits", HFILL }
486 { &hf_evrc_mode_request,
487 { "Mode Request", "evrc.mode_request",
488 FT_UINT8, BASE_DEC, VALS(evrc_mode_request_vals), 0xe0,
489 "Mode Request bits", HFILL }
491 { &hf_evrc_b_mode_request,
492 { "Mode Request", "evrc.b.mode_request",
493 FT_UINT8, BASE_DEC, VALS(evrc_b_mode_request_vals), 0xe0,
494 "Mode Request bits", HFILL }
496 { &hf_evrc_wb_mode_request,
497 { "Mode Request", "evrc.wb.mode_request",
498 FT_UINT8, BASE_DEC, VALS(evrc_wb_mode_request_vals), 0xe0,
499 "Mode Request bits", HFILL }
501 { &hf_evrc_nw_mode_request,
502 { "Mode Request", "evrc.nw.mode_request",
503 FT_UINT8, BASE_DEC, VALS(evrc_nw_mode_request_vals), 0xe0,
504 "Mode Request bits", HFILL }
506 { &hf_evrc_nw2k_mode_request,
507 { "Mode Request", "evrc.nw2k.mode_request",
508 FT_UINT8, BASE_DEC, VALS(evrc_nw2k_mode_request_vals), 0xe0,
509 "Mode Request bits", HFILL }
511 { &hf_evrc_frame_count,
512 { "Frame Count (0 means 1 frame)", "evrc.frame_count",
513 FT_UINT8, BASE_DEC, NULL, 0x1f,
514 "Frame Count bits, a value of 0 means 1 frame", HFILL }
516 { &hf_evrc_toc_frame_type_high,
517 { "ToC Frame Type", "evrc.toc.frame_type_hi",
518 FT_UINT8, BASE_DEC, VALS(evrc_frame_type_vals), 0xf0,
519 "ToC Frame Type bits", HFILL }
521 { &hf_evrc_toc_frame_type_low,
522 { "ToC Frame Type", "evrc.toc.frame_type_lo",
523 FT_UINT8, BASE_DEC, VALS(evrc_frame_type_vals), 0x0f,
524 "ToC Frame Type bits", HFILL }
526 { &hf_evrc_b_toc_frame_type_high,
527 { "ToC Frame Type", "evrc.b.toc.frame_type_hi",
528 FT_UINT8, BASE_DEC, VALS(evrc_b_frame_type_vals), 0xf0,
529 "ToC Frame Type bits", HFILL }
531 { &hf_evrc_b_toc_frame_type_low,
532 { "ToC Frame Type", "evrc.b.toc.frame_type_lo",
533 FT_UINT8, BASE_DEC, VALS(evrc_b_frame_type_vals), 0x0f,
534 "ToC Frame Type bits", HFILL }
536 { &hf_evrc_padding,
537 { "Padding", "evrc.padding",
538 FT_UINT8, BASE_DEC, NULL, 0x0f,
539 "Padding bits", HFILL }
541 { &hf_evrc_speech_data,
542 { "Speech data", "evrc.speech_data",
543 FT_BYTES, BASE_NONE, NULL, 0x0,
544 NULL, HFILL }
546 { &hf_evrc_legacy_toc_fe_ind,
547 { "ToC Further Entries Indicator", "evrc.legacy.toc.further_entries_ind",
548 FT_BOOLEAN, 8, TFS(&toc_further_entries_bit_vals), 0x80,
549 "ToC Further Entries Indicator bit", HFILL }
551 { &hf_evrc_legacy_toc_reduc_rate,
552 { "ToC Reduced Rate", "evrc.legacy.toc.reduced_rate",
553 FT_UINT8, BASE_DEC, NULL, 0x40,
554 "ToC Reduced Rate bits", HFILL }
556 { &hf_evrc_legacy_toc_frame_type,
557 { "ToC Frame Type", "evrc.legacy.toc.frame_type",
558 FT_UINT8, BASE_DEC, VALS(evrc_legacy_frame_type_vals), 0x3f,
559 "ToC Frame Type bits", HFILL }
563 static ei_register_info ei[] = {
564 { &ei_evrc_unknown_variant,
565 { "evrc.unknown_variant", PI_UNDECODED, PI_WARN,
566 "Variant Unknown/Unsupported - dissector bug/later version spec (report to wireshark.org)",
567 EXPFILL }
571 expert_module_t *expert_evrc;
573 /* Setup protocol subtree array */
575 static int *ett[] =
577 &ett_evrc,
578 &ett_toc
581 /* Register the protocol name and description */
583 proto_evrc =
584 proto_register_protocol("Enhanced Variable Rate Codec", "EVRC", "evrc");
586 proto_evrcb =
587 proto_register_protocol_in_name_only("Enhanced Variable Rate Codec B",
588 "EVRC-B", "evrcb", proto_evrc, FT_PROTOCOL);
589 proto_evrcwb =
590 proto_register_protocol_in_name_only("Enhanced Variable Rate Codec - Wideband",
591 "EVRC-WB", "evrcwb", proto_evrc, FT_PROTOCOL);
592 proto_evrcnw =
593 proto_register_protocol_in_name_only("Enhanced Variable Rate Codec - Narrowband-Wideband",
594 "EVRC-NW", "evrcnw", proto_evrc, FT_PROTOCOL);
595 proto_evrcnw2k =
596 proto_register_protocol_in_name_only("Enhanced Variable Rate Codec - Narrowband-Wideband plus 2kpbs",
597 "EVRC-NW2K", "evrcnw2k", proto_evrc, FT_PROTOCOL);
598 proto_evrc_legacy =
599 proto_register_protocol_in_name_only("Enhanced Variable Rate Codec (Legacy Encapsulation)",
600 "EVRC (Legacy)", "evrc_legacy", proto_evrc, FT_PROTOCOL);
601 proto_register_field_array(proto_evrc, hf, array_length(hf));
603 proto_register_subtree_array(ett, array_length(ett));
605 evrc_handle = register_dissector("evrc", dissect_evrc, proto_evrc);
606 evrcb_handle = register_dissector("evrcb", dissect_evrcb, proto_evrcb);
607 evrcwb_handle = register_dissector("evrcwb", dissect_evrcwb, proto_evrcwb);
608 evrcnw_handle = register_dissector("evrcnw", dissect_evrcnw, proto_evrcnw);
609 evrcnw2k_handle = register_dissector("evrcnw2k", dissect_evrcnw2k, proto_evrcnw2k);
610 evrc_legacy_handle = register_dissector("evrc_legacy", dissect_evrc_legacy, proto_evrc_legacy);
612 expert_evrc =
613 expert_register_protocol(proto_evrc);
614 expert_register_field_array(expert_evrc, ei, array_length(ei));
617 * setup for preferences
619 evrc_module = prefs_register_protocol(proto_evrc, proto_reg_handoff_evrc);
621 prefs_register_bool_preference(evrc_module,
622 "legacy_pt_60",
623 "Add dissector for static payload type 60 as legacy EVRC (non-RFC3558)",
624 "Whether the EVRC dissector should process payload type 60 as legacy EVRC packets",
625 &legacy_pt_60);
629 void
630 proto_reg_handoff_evrc(void)
632 static bool evrc_prefs_initialized = false;
634 if (!evrc_prefs_initialized)
636 /* header-full mime types */
637 dissector_add_string("rtp_dyn_payload_type", "EVRC", evrc_handle);
638 dissector_add_string("rtp_dyn_payload_type", "EVRCB", evrcb_handle);
639 dissector_add_string("rtp_dyn_payload_type", "EVRCWB", evrcwb_handle);
640 dissector_add_string("rtp_dyn_payload_type", "EVRCNW", evrcnw_handle);
641 dissector_add_string("rtp_dyn_payload_type", "EVRCNW2K", evrcnw2k_handle);
643 dissector_add_for_decode_as("rtp.pt", evrc_handle);
644 dissector_add_for_decode_as("rtp.pt", evrcb_handle);
645 dissector_add_for_decode_as("rtp.pt", evrcwb_handle);
646 dissector_add_for_decode_as("rtp.pt", evrcnw_handle);
647 dissector_add_for_decode_as("rtp.pt", evrcnw2k_handle);
648 /* Since the draft legacy encapsulation only appears on PT 60, not
649 * adding it to decode as */
650 /* dissector_add_for_decode_as("rtp.pt", evrc_legacy_handle); */
651 evrc_prefs_initialized = true;
653 else
655 dissector_delete_uint("rtp.pt", 60, evrc_legacy_handle);
658 if (legacy_pt_60)
660 dissector_add_uint("rtp.pt", 60, evrc_legacy_handle);
665 * Editor modelines - https://www.wireshark.org/tools/modelines.html
667 * Local variables:
668 * c-basic-offset: 4
669 * tab-width: 8
670 * indent-tabs-mode: nil
671 * End:
673 * vi: set shiftwidth=4 tabstop=8 expandtab:
674 * :indentSize=4:tabSize=8:noTabs=true: