From 00e21988690863fd3396845c4421a8879982a43a Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 16 Oct 2016 14:08:42 +0200 Subject: [PATCH] gsm_abis_tfp: Detect + display AMR rate based on payload length Change-Id: I1af7e3be87da9416ded02b09c480ea69ec58afff Reviewed-on: https://code.wireshark.org/review/18459 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-gsm_abis_tfp.c | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/epan/dissectors/packet-gsm_abis_tfp.c b/epan/dissectors/packet-gsm_abis_tfp.c index 9c39e1ce38..afec11d551 100644 --- a/epan/dissectors/packet-gsm_abis_tfp.c +++ b/epan/dissectors/packet-gsm_abis_tfp.c @@ -55,6 +55,7 @@ static int hf_tfp_hdr_p = -1; static int hf_tfp_hdr_s = -1; static int hf_tfp_hdr_m = -1; static int hf_tfp_hdr_frame_type = -1; +static int hf_tfp_amr_rate = -1; /* initialize the subtree pointers */ static int ett_tfp = -1; @@ -90,6 +91,20 @@ static const value_string tfp_frame_type_vals[] = { { 0, NULL } }; +static const value_string tfp_amr_len_rate_vals[] = { + { 1, "SID_FIRST, ONSET, No speech/data" }, + { 5, "SID_UPDATE, SID_BAD" }, + { 12, "4.75k" }, + { 13, "5.15k" }, + { 15, "5.90k" }, + { 17, "6.70k" }, + { 19, "7.40k" }, + { 20, "7.95k" }, + { 26, "10.2k" }, + { 31, "12.2k" }, + { 0, NULL } +}; + static int dissect_abis_tfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { @@ -99,6 +114,7 @@ dissect_abis_tfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data guint32 slot_rate, frame_bits, atsr, seq_nr; guint8 ftype; tvbuff_t *next_tvb; + gint len_remain; col_set_str(pinfo->cinfo, COL_PROTOCOL, "TFP"); @@ -129,6 +145,21 @@ dissect_abis_tfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data offset++; offset++; + switch (ftype & 0x7F) { + case 0: /* TFP-AMR.ind */ + len_remain = tvb_captured_length_remaining(tvb, offset); + proto_tree_add_uint(tfp_tree, hf_tfp_amr_rate, tvb, offset, 0, len_remain); + break; + case 1: /* TFP-SCCE-AMR.ind */ + break; + case 2: /* TFP-HR.ind */ + break; + case 3: /* TFP-EFR.ind */ + break; + case 4: /* TFP-SCCE-EFR.ind */ + break; + } + /* FIXME: implement packed frame support */ if (slot_rate == 0) frame_bits = 320; @@ -184,6 +215,11 @@ proto_register_abis_tfp(void) FT_UINT8, BASE_DEC, VALS(tfp_frame_type_vals), 0x1e, NULL, HFILL } }, + { &hf_tfp_amr_rate, + { "AMR Rate", "gsm_abis_tfp.amr.rate", + FT_UINT8, BASE_DEC, VALS(tfp_amr_len_rate_vals), 0, + NULL, HFILL } + }, }; static gint *ett[] = { &ett_tfp,