From acd6d3fb35234dfc5f905a6c4b6e25b571d24e3b Mon Sep 17 00:00:00 2001 From: Martin Mathieson Date: Wed, 4 Jun 2008 17:33:48 +0000 Subject: [PATCH] - Make FP radio division mode/speed explicit in struct for R7 - Various R7 fixes svn path=/trunk/; revision=25425 --- epan/dissectors/packet-catapult-dct2000.c | 9 ++- epan/dissectors/packet-k12.c | 6 ++ epan/dissectors/packet-umts_fp.c | 96 ++++++++++++++++++++--- epan/dissectors/packet-umts_fp.h | 13 ++- 4 files changed, 108 insertions(+), 16 deletions(-) diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c index 0cdbc08bbd..6f345ee76f 100644 --- a/epan/dissectors/packet-catapult-dct2000.c +++ b/epan/dissectors/packet-catapult-dct2000.c @@ -765,12 +765,17 @@ void attach_fp_info(packet_info *pinfo, gboolean received, const char *protocol_ /* Channel type */ p_fp_info->channel = outhdr_values[i++]; - /* Node type */ + /* Derive direction from node type/side */ node_type = outhdr_values[i++]; - p_fp_info->is_uplink = (( received && (node_type == 2)) || (!received && (node_type == 1))); + /* Division type introduced for R7 */ + if (p_fp_info->release == 7) + { + p_fp_info->division = outhdr_values[i++]; + } + /* HS-DSCH config */ if (p_fp_info->channel == CHANNEL_HSDSCH) { diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index 3eb23652ff..08ff1b5c02 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -98,6 +98,9 @@ fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint32 length) if (!p_fp_info || length < 22) return; + /* Store division type */ + p_fp_info->division = radio_mode; + /* Format used by K15, later fields are shifted by 8 bytes. */ if (pntohs(extra_info+2) == 5) adj = 8; @@ -165,9 +168,12 @@ fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint32 length) if (info_type == 0x30) { /* data frame */ p_fp_info->num_chans = extra_info[23 + adj]; + /* For each channel */ for (i = 0; i < (guint)p_fp_info->num_chans && (36+i*104+adj) <= length; ++i) { + /* Read TB size */ p_fp_info->chan_tf_size[i] = pntohl(extra_info+28+i*104+adj); if (p_fp_info->chan_tf_size[i]) + /* Work out number of TBs on this channel */ p_fp_info->chan_num_tbs[i] = pntohl(extra_info+32+i*104+adj) / p_fp_info->chan_tf_size[i]; } diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c index 7a06396a7d..caf8145f4a 100644 --- a/epan/dissectors/packet-umts_fp.c +++ b/epan/dissectors/packet-umts_fp.c @@ -45,6 +45,7 @@ int proto_fp = -1; static int hf_fp_channel_type = -1; +static int hf_fp_division = -1; static int hf_fp_direction = -1; static int hf_fp_header_crc = -1; static int hf_fp_ft = -1; @@ -192,6 +193,16 @@ static const value_string channel_type_vals[] = { 0, NULL } }; +static const value_string division_vals[] = +{ + { Division_FDD, "FDD"}, + { Division_TDD_384, "TDD-384"}, + { Division_TDD_128, "TDD-128"}, + { Division_TDD_768, "TDD-768"}, + { 0, NULL } +}; + + static const value_string data_control_vals[] = { { 0, "Data" }, { 1, "Control" }, @@ -1277,15 +1288,27 @@ void dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* Bit 0 indicates Cell Portion ID */ if (flags & 0x01) { - proto_tree_add_item(tree, hf_fp_cell_portion_id, tvb, offset, 1, FALSE); - offset++; + if (p_fp_info->division == Division_FDD) + { + proto_tree_add_item(tree, hf_fp_cell_portion_id, tvb, offset, 1, FALSE); + offset++; + } + else + { + /* Wrong mode - warn + expert item. */ + proto_item *ti = proto_tree_add_text(tree, tvb, 0, 0, "Error: Cell Portion ID indicated, but not in FDD mode"); + PROTO_ITEM_SET_GENERATED(ti); + expert_add_info_format(pinfo, ti, + PI_MALFORMED, PI_WARN, + "Cell Portion ID indicated, but not in FDD mode"); + } } /* Bit 1 indicates Ext propagation delay. TODO: add expert info item if flag set but a TDD channel... */ - if ((flags & 0x20) & (propagation_delay_ti != NULL)) { + if ((flags & 0x02) && (propagation_delay_ti != NULL)) { guint16 extra_bits = tvb_get_ntohs(tvb, offset) & 0x03ff; - proto_tree_add_item(tree, hf_fp_ext_propagation_delay, tvb, offset, 1, FALSE); + proto_tree_add_item(tree, hf_fp_ext_propagation_delay, tvb, offset, 2, FALSE); /* Adding 10 bits to original 8 */ proto_item_append_text(propagation_delay_ti, " (extended to %u)", @@ -1799,8 +1822,30 @@ int dissect_dch_rx_timing_deviation(packet_info *pinfo, proto_tree *tree, /* Optional E-RUCCH */ if (e_rucch_present) { - /* TODO: 6 for 3.84, 5 for 7.68 */ - int bit_offset = 6; + /* Value of bit_offset depends upon division type */ + int bit_offset; + + switch (p_fp_info->division) + { + case Division_TDD_384: + bit_offset = 6; + break; + case Division_TDD_768: + bit_offset = 5; + break; + default: + { + proto_item *ti = proto_tree_add_text(tree, tvb, 0, 0, + "Error: expecting TDD-384 or TDD-768"); + PROTO_ITEM_SET_GENERATED(ti); + expert_add_info_format(pinfo, ti, + PI_MALFORMED, PI_NOTE, + "Error: expecting TDD-384 or TDD-768"); + bit_offset = 6; + } + + } + proto_tree_add_item(tree, hf_fp_dch_e_rucch_flag, tvb, offset, 1, FALSE); proto_tree_add_bits_item(tree, hf_fp_dch_e_rucch_flag, tvb, offset*8 + bit_offset, 1, FALSE); @@ -1812,11 +1857,25 @@ int dissect_dch_rx_timing_deviation(packet_info *pinfo, proto_tree *tree, */ if (extended_bits_present) { - /* TODO: 1 for 3.84, 2 for 7.68, */ - guint bits_to_extend = 1; - guint8 extra_bits = tvb_get_guint8(tvb, offset) & - (bits_to_extend == 1) ? 0x01 : 0x3; - timing_deviation = (timing_deviation) | (extra_bits << 8); + guint8 extra_bits; + guint bits_to_extend; + switch (p_fp_info->division) + { + case Division_TDD_384: + bits_to_extend = 1; + break; + case Division_TDD_768: + bits_to_extend = 2; + break; + + default: + /* TODO: report unexpected division type */ + bits_to_extend = 1; + break; + } + extra_bits = tvb_get_guint8(tvb, offset) & + (bits_to_extend == 1) ? 0x01 : 0x3; + timing_deviation = (extra_bits << 8) | (timing_deviation); proto_item_append_text(timing_deviation_ti, " (extended to 0x%x)", timing_deviation); @@ -2756,6 +2815,13 @@ void dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_uint(fp_tree, hf_fp_channel_type, tvb, 0, 0, p_fp_info->channel); PROTO_ITEM_SET_GENERATED(ti); + /* Add division type as a generated field */ + if (p_fp_info->release == 7) + { + ti = proto_tree_add_uint(fp_tree, hf_fp_division, tvb, 0, 0, p_fp_info->division); + PROTO_ITEM_SET_GENERATED(ti); + } + /* Add link direction as a generated field */ ti = proto_tree_add_uint(fp_tree, hf_fp_direction, tvb, 0, 0, p_fp_info->is_uplink); PROTO_ITEM_SET_GENERATED(ti); @@ -2844,6 +2910,12 @@ void proto_register_fp(void) "Channel Type", HFILL } }, + { &hf_fp_division, + { "Division", + "fp.division", FT_UINT8, BASE_HEX, VALS(division_vals), 0x0, + "Radio division type", HFILL + } + }, { &hf_fp_direction, { "Direction", "fp.direction", FT_UINT8, BASE_HEX, VALS(direction_vals), 0x0, @@ -3506,7 +3578,7 @@ void proto_register_fp(void) }, { &hf_fp_ext_propagation_delay, { "Ext Propagation Delay", - "fp.ext-propagation-delay", FT_UINT8, BASE_DEC, NULL, 0x0, + "fp.ext-propagation-delay", FT_UINT16, BASE_DEC, NULL, 0x03ff, "Ext Propagation Delay", HFILL } }, diff --git a/epan/dissectors/packet-umts_fp.h b/epan/dissectors/packet-umts_fp.h index a10f75723a..e496229d7d 100644 --- a/epan/dissectors/packet-umts_fp.h +++ b/epan/dissectors/packet-umts_fp.h @@ -40,7 +40,7 @@ #define CHANNEL_IUR_FACH 15 #define CHANNEL_IUR_DSCH 16 #define CHANNEL_EDCH 17 -#define CHANNEL_RACH_TDD_128 65 +#define CHANNEL_RACH_TDD_128 66 enum fp_interface_type { @@ -48,6 +48,14 @@ enum fp_interface_type IuR_Interface }; +enum division_type +{ + Division_FDD=1, + Division_TDD_384=2, + Division_TDD_128=3, + Division_TDD_768=4 +}; + enum fp_hsdsch_entity { entity_not_specified=0, @@ -59,7 +67,8 @@ enum fp_hsdsch_entity typedef struct fp_info { enum fp_interface_type iface_type; - guint8 release; /* e.g. 99, 4, 5, 6 */ + enum division_type division; + guint8 release; /* e.g. 99, 4, 5, 6, 7 */ guint16 release_year; /* e.g. 2001 */ guint8 release_month; /* e.g. 12 for December */ gboolean is_uplink;