aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2012-09-24 08:38:45 +0000
committerAnders Broman <anders.broman@ericsson.com>2012-09-24 08:38:45 +0000
commitef4ecaa38b9cf68de02b783c120a1fb5afc8bd96 (patch)
treee3f0b69329f348c0f535611e64764b27b6f7d7e8
parent8c174d2ae72932a2063af4973750e41f2b1680e4 (diff)
Use proto_tree_add_item() and value_strings in a couple of more places.
svn path=/trunk/; revision=45087
-rw-r--r--epan/dissectors/packet-gsm_a_bssmap.c95
1 files changed, 52 insertions, 43 deletions
diff --git a/epan/dissectors/packet-gsm_a_bssmap.c b/epan/dissectors/packet-gsm_a_bssmap.c
index e2b11395a2..27cccd83e9 100644
--- a/epan/dissectors/packet-gsm_a_bssmap.c
+++ b/epan/dissectors/packet-gsm_a_bssmap.c
@@ -592,6 +592,8 @@ static int hf_fe_cell_load_info_rt_load_value = -1;
static int hf_fe_cell_load_info_nrt_load_information_value = -1;
static int hf_fe_ps_indication = -1;
static int hf_fe_dtm_ho_command_ind_spare = -1;
+static int hf_gsm_a_bssmap_speech_data_ind = -1;
+static int hf_gsm_a_bssmap_channel_rate_and_type = -1;
static int hf_gsm_a_bssmap_perm_speech_v_ind = -1;
/* Initialize the subtree pointers */
@@ -1159,6 +1161,40 @@ be_enc_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 off
/*
* [2] 3.2.2.11 Channel Type
*/
+
+static const value_string gsm_a_bssap_speech_data_ind_vals[] = {
+ { 0x0, "Reserved"},
+ { 0x1, "Speech"},
+ { 0x2, "Data"},
+ { 0x3, "Signalling"},
+ { 0x4, "Speech + CTM Text Telephony"},
+ { 0x5, "Reserved"},
+ { 0x6, "Reserved"},
+ { 0x7, "Reserved"},
+ { 0x8, "Reserved"},
+ { 0x9, "Reserved"},
+ { 0xa, "Reserved"},
+ { 0xb, "Reserved"},
+ { 0xc, "Reserved"},
+ { 0xd, "Reserved"},
+ { 0xe, "Reserved"},
+ { 0xf, "Reserved"},
+ { 0, NULL }
+};
+
+/* Channel Rate and Type */
+static const value_string gsm_a_bssap_channel_rate_and_type_vals[] = {
+ { 0x08, "Full rate TCH channel Bm. Prefer full rate TCH"},
+ { 0x09, "Half rate TCH channel Lm. Prefer half rate TCH"},
+ { 0x0a, "Full or Half rate channel, Full rate preferred changes allowed after first allocation"},
+ { 0x0b, "Full or Half rate channel, Half rate preferred changes allowed after first allocation"},
+ { 0x0f, "Full or Half rate channel, changes allowed after first allocation"},
+ { 0x1a, "Full or Half rate channel, Full rate preferred changes between full and half rate not allowed after first allocation"},
+ { 0x1b, "Full or Half rate channel, Half rate preferred changes between full and half rate not allowed after first allocation"},
+ { 0x1f, "Full or Half rate channel, changes between full and half rate not allowed after first allocation"},
+ { 0, NULL }
+};
+
/* Bits 7-1 indicate the permitted speech version identifier; */
static const value_string gsm_a_bssap_perm_speech_v_ind_vals[] = {
{ 0x01, "GSM speech full rate version 1 (GSM FR)"},
@@ -1186,30 +1222,15 @@ be_chan_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 of
curr_offset = offset;
oct = tvb_get_guint8(tvb, curr_offset);
-
- proto_tree_add_bits_item(tree, hf_gsm_a_bssmap_spare_bits, tvb, curr_offset<<3, 4, ENC_BIG_ENDIAN);
-
sdi = oct & 0x0f;
- switch (sdi)
- {
- case 1: str = "Speech"; break;
- case 2: str = "Data"; break;
- case 3: str = "Signalling"; break;
- case 4: str = "Speech + CTM Text Telephony"; break;
- default:
- str = "Reserved";
- break;
- }
- other_decode_bitfield_value(a_bigbuf, oct, 0x0f, 8);
- proto_tree_add_text(tree,
- tvb, curr_offset, 1,
- "%s = Speech/Data Indicator: %s",
- a_bigbuf,
- str);
+ proto_tree_add_bits_item(tree, hf_gsm_a_bssmap_spare_bits, tvb, curr_offset<<3, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_gsm_a_bssmap_speech_data_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
if (add_string)
- g_snprintf(add_string, string_len, " - (%s)", str);
+ g_snprintf(add_string, string_len, " - (%s)", val_to_str_const(tvb_get_guint8(tvb, curr_offset) & 0x0f,
+ gsm_a_bssap_speech_data_ind_vals,
+ "Unknown"));
curr_offset++;
@@ -1220,29 +1241,8 @@ be_chan_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 of
if ((sdi == 0x01)||(sdi == 0x04))
{
/* speech */
-
- switch (oct)
- {
- case 0x08: str = "Full rate TCH channel Bm. Prefer full rate TCH"; break;
- case 0x09: str = "Half rate TCH channel Lm. Prefer half rate TCH"; break;
- case 0x0a: str = "Full or Half rate channel, Full rate preferred changes allowed after first allocation"; break;
- case 0x0b: str = "Full or Half rate channel, Half rate preferred changes allowed after first allocation"; break;
- case 0x1a: str = "Full or Half rate channel, Full rate preferred changes between full and half rate not allowed after first allocation"; break;
- case 0x1b: str = "Full or Half rate channel, Half rate preferred changes between full and half rate not allowed after first allocation"; break;
- case 0x0f: str = "Full or Half rate channel, changes allowed after first allocation"; break;
- case 0x1f: str = "Full or Half rate channel, changes between full and half rate not allowed after first allocation"; break;
- default:
- str = "Reserved";
- break;
- }
-
- proto_tree_add_text(tree,
- tvb, curr_offset, 1,
- "Channel Rate and Type: %s",
- str);
-
+ proto_tree_add_item(tree, hf_gsm_a_bssmap_channel_rate_and_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
curr_offset++;
-
NO_MORE_DATA_CHECK(len);
do
@@ -7599,12 +7599,21 @@ proto_register_gsm_a_bssmap(void)
FT_UINT8, BASE_HEX, NULL, 0,
NULL, HFILL }
},
+ { &hf_gsm_a_bssmap_speech_data_ind,
+ { "Speech/Data Indicator", "gsm_a.bssmap.speech_data_ind",
+ FT_UINT8, BASE_DEC, VALS(gsm_a_bssap_speech_data_ind_vals), 0x0f,
+ NULL, HFILL }
+ },
+ { &hf_gsm_a_bssmap_channel_rate_and_type,
+ { "Channel Rate and Type", "gsm_a.bssmap.perm_speech_v_ind",
+ FT_UINT8, BASE_DEC, VALS(gsm_a_bssap_channel_rate_and_type_vals), 0x0,
+ NULL, HFILL }
+ },
{ &hf_gsm_a_bssmap_perm_speech_v_ind,
{ "Permitted speech version indication", "gsm_a.bssmap.perm_speech_v_ind",
FT_UINT8, BASE_HEX, VALS(gsm_a_bssap_perm_speech_v_ind_vals), 0x7f,
NULL, HFILL }
},
-
};
/* Setup protocol subtree array */