summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-evs.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
commita86c5f7cae7ec9a3398300555a0b644689d946a1 (patch)
tree39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/packet-evs.c
parentReleasing progress-linux version 4.2.6-1~progress7.99u1. (diff)
downloadwireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz
wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-evs.c')
-rw-r--r--epan/dissectors/packet-evs.c178
1 files changed, 97 insertions, 81 deletions
diff --git a/epan/dissectors/packet-evs.c b/epan/dissectors/packet-evs.c
index 4c7f4735..9657a4f2 100644
--- a/epan/dissectors/packet-evs.c
+++ b/epan/dissectors/packet-evs.c
@@ -17,6 +17,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/proto_data.h>
+#include <epan/tfs.h>
#include <wsutil/str_util.h>
#include <wsutil/utf8_entities.h>
#include "packet-rtp.h"
@@ -26,50 +27,50 @@ void proto_reg_handoff_evs(void);
static dissector_handle_t evs_handle;
-static gboolean evs_hf_only = FALSE;
+static bool evs_hf_only;
/* Initialize the protocol and registered fields */
-static int proto_evs = -1;
-static int proto_rtp = -1;
-
-static int hf_evs_packet_length = -1;
-static int hf_evs_voice_data = -1;
-static int hf_evs_h_bit = -1;
-static int hf_evs_cmr_t = -1;
-static int hf_evs_cmr_t0_d = -1;
-static int hf_evs_cmr_t1_d = -1;
-static int hf_evs_cmr_t2_d = -1;
-static int hf_evs_cmr_t3_d = -1;
-static int hf_evs_cmr_t4_d = -1;
-static int hf_evs_cmr_t5_d = -1;
-static int hf_evs_cmr_t6_d = -1;
-static int hf_evs_cmr_t7_d = -1;
-static int hf_evs_f_bit = -1;
-static int hf_evs_mode_bit = -1;
-static int hf_evs_toc_spare = -1;
-static int hf_evs_amr_wb_q_bit = -1;
-static int hf_evs_bit_rate_mode_0 = -1;
-static int hf_evs_bit_rate_mode_1 = -1;
-static int hf_evs_cmr_amr_io = -1;
-static int hf_evs_bw = -1;
-static int hf_evs_reserved_1bit = -1;
-static int hf_evs_celp_switch_to_mdct_core = -1;
-static int hf_evs_celp_mdct_core = -1;
-static int hf_evs_tcx_or_hq_mdct_core = -1;
-static int hf_evs_sid_cng = -1;
-static int hf_evs_celp_sample_rate = -1;
-static int hf_evs_core_sample_rate = -1;
-static int hf_evs_132_bwctrf_idx = -1;
-static int hf_evs_28_frame_type = -1;
-static int hf_evs_28_bw_ppp_nelp = -1;
-static int hf_evs_72_80_bwct_idx = -1;
-static int hf_evs_320_bwct_idx = -1;
-static int hf_evs_640_bwct_idx = -1;
-
-static int ett_evs = -1;
-static int ett_evs_header = -1;
-static int ett_evs_speech = -1;
-static int ett_evs_voice_data = -1;
+static int proto_evs;
+static int proto_rtp;
+
+static int hf_evs_packet_length;
+static int hf_evs_voice_data;
+static int hf_evs_h_bit;
+static int hf_evs_cmr_t;
+static int hf_evs_cmr_t0_d;
+static int hf_evs_cmr_t1_d;
+static int hf_evs_cmr_t2_d;
+static int hf_evs_cmr_t3_d;
+static int hf_evs_cmr_t4_d;
+static int hf_evs_cmr_t5_d;
+static int hf_evs_cmr_t6_d;
+static int hf_evs_cmr_t7_d;
+static int hf_evs_f_bit;
+static int hf_evs_mode_bit;
+static int hf_evs_toc_spare;
+static int hf_evs_amr_wb_q_bit;
+static int hf_evs_bit_rate_mode_0;
+static int hf_evs_bit_rate_mode_1;
+static int hf_evs_cmr_amr_io;
+static int hf_evs_bw;
+static int hf_evs_reserved_1bit;
+static int hf_evs_celp_switch_to_mdct_core;
+static int hf_evs_celp_mdct_core;
+static int hf_evs_tcx_or_hq_mdct_core;
+static int hf_evs_sid_cng;
+static int hf_evs_celp_sample_rate;
+static int hf_evs_core_sample_rate;
+static int hf_evs_132_bwctrf_idx;
+static int hf_evs_28_frame_type;
+static int hf_evs_28_bw_ppp_nelp;
+static int hf_evs_72_80_bwct_idx;
+static int hf_evs_320_bwct_idx;
+static int hf_evs_640_bwct_idx;
+
+static int ett_evs;
+static int ett_evs_header;
+static int ett_evs_speech;
+static int ett_evs_voice_data;
static const value_string evs_protected_payload_sizes_value[] = {
{ 48, "EVS Primary SID 2.4" },
@@ -200,7 +201,7 @@ static const value_string evs_d_bits_t4_values[] = {
static const value_string evs_d_bits_t5_values[] = {
{ 0x0, "WB 13.2 kbps CA-L-O2" },
- { 0x1, "WB 13.2 kbps CA-L-O2" },
+ { 0x1, "WB 13.2 kbps CA-L-O3" },
{ 0x2, "WB 13.2 kbps CA-L-O5" },
{ 0x3, "WB 13.2 kbps CA-L-O7" },
{ 0x4, "WB 13.2 kbps CA-H-O2" },
@@ -220,7 +221,7 @@ static const value_string evs_d_bits_t5_values[] = {
static const value_string evs_d_bits_t6_values[] = {
{ 0x0, "SWB 13.2 kbps CA-L-O2" },
- { 0x1, "SWB 13.2 kbps CA-L-O2" },
+ { 0x1, "SWB 13.2 kbps CA-L-O3" },
{ 0x2, "SWB 13.2 kbps CA-L-O5" },
{ 0x3, "SWB 13.2 kbps CA-L-O7" },
{ 0x4, "SWB 13.2 kbps CA-H-O2" },
@@ -470,13 +471,13 @@ static const value_string evs_640_bwct_idx_vals[] = {
};
static void
-dissect_evs_cmr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *evs_tree, int offset, guint8 cmr_oct)
+dissect_evs_cmr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *evs_tree, int offset, uint8_t cmr_oct)
{
proto_tree *tree;
proto_item *item;
- const gchar *str;
- guint8 t_bits = (cmr_oct & 0x70) >> 4;
- guint8 d_bits = (cmr_oct & 0x0f);
+ const char *str;
+ uint8_t t_bits = (cmr_oct & 0x70) >> 4;
+ uint8_t d_bits = (cmr_oct & 0x0f);
/* CMR */
tree = proto_tree_add_subtree(evs_tree, tvb, offset, 1, ett_evs_header, &item, "CMR");
@@ -610,47 +611,62 @@ dissect_evs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
proto_tree *evs_tree, *sub_tree, *vd_tree;
int offset = 0 , bit_offset = 0;
int packet_len, idx, speech_data_len;
- guint32 num_bits;
- const gchar *str;
- guint8 oct, h_bit, toc_f_bit, evs_mode_b;
+ uint32_t num_bits;
+ const char *str;
+ uint8_t oct, h_bit, toc_f_bit, evs_mode_b;
int num_toc, num_data;
- guint64 value;
- gboolean is_compact = FALSE;
+ uint64_t value;
+ bool is_compact = false;
struct _rtp_pkt_info *rtp_pkt_info = p_get_proto_data(pinfo->pool, pinfo, proto_rtp, pinfo->curr_layer_num-1);
+ struct _rtp_info *rtp_info = NULL;
+ bool rtmp_enforce_hf_only = false;
/* Make entries in Protocol column and Info column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "EVS");
+ ti = proto_tree_add_item(tree, proto_evs, tvb, 0, -1, ENC_NA);
+ evs_tree = proto_item_add_subtree(ti, ett_evs);
+ packet_len = tvb_reported_length(tvb);
+
+ /* A.2.3.2 ignore sizes if hf-only=1 */
+ if (data) {
+ rtp_info = (struct _rtp_info*)data;
+ if (rtp_info->info_payload_fmtp_map) {
+ char *tmp = wmem_map_lookup(rtp_info->info_payload_fmtp_map, "hf-only");
+ if (g_strcmp0(tmp, "1") == 0) {
+ rtmp_enforce_hf_only = true;
+ }
+ }
+ }
/* Find out if we have one of the reserved packet sizes*/
- packet_len = tvb_reported_length(tvb);
- num_bits = packet_len * 8;
- if (rtp_pkt_info)
- num_bits += rtp_pkt_info->padding_len * 8; /* take into account RTP padding if any */
- if (num_bits == 56) {
- /* A.2.1.3 Special case for 56 bit payload size (EVS Primary or EVS AMR-WB IO SID) */
- /* The resulting ambiguity between EVS Primary 2.8 kbps and EVS AMR-WB IO SID frames is resolved through the
- most significant bit (MSB) of the first byte of the payload. By definition, the first data bit d(0) of the EVS Primary 2.8
- kbps is always set to '0'.
- */
- oct = tvb_get_bits8(tvb, bit_offset, 1);
- if (oct == 0) {
- /* EVS Primary 2.8 kbps */
- str = "EVS Primary 2.8 kbps";
- col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", str);
- is_compact = TRUE;
+ if (!(rtmp_enforce_hf_only || evs_hf_only)) {
+ num_bits = packet_len * 8;
+ if (rtp_pkt_info)
+ num_bits += rtp_pkt_info->padding_len * 8; /* take into account RTP padding if any */
+ if (num_bits == 56) {
+ /* A.2.1.3 Special case for 56 bit payload size (EVS Primary or EVS AMR-WB IO SID) */
+ /* The resulting ambiguity between EVS Primary 2.8 kbps and EVS AMR-WB IO SID frames is resolved through the
+ most significant bit (MSB) of the first byte of the payload. By definition, the first data bit d(0) of the EVS Primary 2.8
+ kbps is always set to '0'.
+ */
+ oct = tvb_get_bits8(tvb, bit_offset, 1);
+ if (oct == 0) {
+ /* EVS Primary 2.8 kbps */
+ str = "EVS Primary 2.8";
+ is_compact = true;
+ } else {
+ /* EVS AMR-WB IO SID */
+ str = "EVS AMR-WB IO SID";
+ }
} else {
- /* EVS AMR-WB IO SID */
- str = "EVS AMR-WB IO SID";
- }
- } else if (!evs_hf_only) {
- str = try_val_to_str_idx(num_bits, evs_protected_payload_sizes_value, &idx);
- if (str) {
- is_compact = TRUE;
+ str = try_val_to_str_idx(num_bits, evs_protected_payload_sizes_value, &idx);
+ if (str) {
+ is_compact = true;
+ }
}
}
- ti = proto_tree_add_item(tree, proto_evs, tvb, 0, -1, ENC_NA);
- evs_tree = proto_item_add_subtree(ti, ett_evs);
+
if (is_compact) {
/* A.2.1 EVS codec Compact Format */
proto_tree_add_subtree(evs_tree, tvb, offset, -1, ett_evs_header, &ti, "Framing Mode: Compact");
@@ -832,7 +848,7 @@ dissect_evs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
proto_item_set_generated(ti);
/*proto_tree_add_int_format(evs_tree, hf_evs_packet_length, tvb, offset, 1, packet_len * 8, "packet_len %i bits", packet_len * 8);*/
- oct = tvb_get_guint8(tvb, offset);
+ oct = tvb_get_uint8(tvb, offset);
h_bit = oct >> 7;
if (h_bit == 1) {
@@ -843,7 +859,7 @@ dissect_evs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
/* ToC */
num_toc = 0;
do {
- oct = tvb_get_guint8(tvb, offset);
+ oct = tvb_get_uint8(tvb, offset);
toc_f_bit = (oct & 0x40) >> 6;
evs_mode_b = (oct & 0x20) >> 5;
num_toc++;
@@ -1075,7 +1091,7 @@ proto_register_evs(void)
/* Setup protocol subtree array */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_evs,
&ett_evs_header,
&ett_evs_speech,