GSMTAP: implement dissecting of PTCCH/D messages

According to 3GPP TS 45.002, section 3.3.4.2, PTCCH (Packet Timing
advance control channel) is a packet dedicated channel, that is
used for continuous Timing Advance control in (E)GPRS.

There are two sub-types of that logical channel:

  - PTCCH/U (Uplink): used to transmit random Access Bursts
    to allow estimation of the Timing Advance for one MS in
    packet transfer mode.

  - PTCCH/D (Downlink): used by the network to transmit
    Timing Advance updates for several MS.

As per 3GPP TS 45.003, section 5.2, the coding scheme used for
PTCCH/U is the same as for PRACH as specified in subclause 5.3,
while the coding scheme used for PTCCH/D is the same as for
CS-1 as specified in subclause 5.1.1.

The format of PTCCH/D messages can be described as follows:

  +--------------+--------------+-----+---------------+------------------+
  |    Octet 1   |    Octet 2   |     |    Octet 16   |  Octet 17 .. 23  |
  +---+----------+---+----------+-----+---+-----------+------------------+
  | 0 | TA TAI=0 | 0 | TA TAI=1 | ... | 0 | TA TAI=15 | Padding 00101011 |
  +---+----------+---+----------+-----+---+-----------+------------------+

what gives us 16 Timing Advance values (7 bit each) for 16 different
mobile stations identified by TAI (0..15). The remaining space is
padding and shall be filled with constant value 0x2B.

Bug: 16096
Change-Id: I0ce81d922a8a8c3981da2486baa3e1efcff46539
Reviewed-on: https://code.wireshark.org/review/34660
Reviewed-by: Pau Espin Pedrol <pespin@sysmocom.de>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Vadim Yanitskiy 2019-09-30 22:17:23 +07:00 committed by Anders Broman
parent 157dc2fb22
commit e78430f059
1 changed files with 62 additions and 0 deletions

View File

@ -65,6 +65,11 @@ static int hf_sacch_l1h_power_lev = -1;
static int hf_sacch_l1h_fpc = -1;
static int hf_sacch_l1h_ta = -1;
static int hf_ptcch_spare = -1;
static int hf_ptcch_ta_idx = -1;
static int hf_ptcch_ta_val = -1;
static int hf_ptcch_padding = -1;
static gint ett_gsmtap = -1;
enum {
@ -427,6 +432,42 @@ dissect_sacch_l1h(tvbuff_t *tvb, proto_tree *tree)
proto_tree_add_item(l1h_tree, hf_sacch_l1h_ta, tvb, 1, 1, ENC_BIG_ENDIAN);
}
/* Dissect a PTCCH/D (Packet Timing Advance Control Channel) message.
* See 3GPP TS 45.010, section 5.6.2 and 3GPP TS 45.002, section 3.3.4.2.
*
* +--------------+--------------+-----+---------------+------------------+
* | Octet 1 | Octet 2 | | Octet 16 | Octet 17 .. 23 |
* +---+----------+---+----------+-----+---+-----------+------------------+
* | 0 | TA TAI=0 | 0 | TA TAI=1 | ... | 0 | TA TAI=15 | Padding 00101011 |
* +---+----------+---+----------+-----+---+-----------+------------------+
*/
static void
dissect_ptcch_dl(tvbuff_t *tvb, proto_tree *tree)
{
proto_tree *sub_tree;
proto_item *ti, *gi;
int offset;
if (!tree)
return;
ti = proto_tree_add_protocol_format(tree, proto_gsmtap, tvb, 0, 23,
"PTCCH (Packet Timing Advance Control Channel) on Downlink");
sub_tree = proto_item_add_subtree(ti, ett_gsmtap);
for (offset = 0; offset < 16; offset++) {
/* Meta info: Timing Advance Index */
gi = proto_tree_add_uint(sub_tree, hf_ptcch_ta_idx, tvb, 0, 0, offset);
proto_item_set_generated(gi);
proto_tree_add_item(sub_tree, hf_ptcch_spare, tvb, offset, 1, ENC_NA);
proto_tree_add_item(sub_tree, hf_ptcch_ta_val, tvb, offset, 1, ENC_NA);
}
/* Spare padding */
proto_tree_add_item(sub_tree, hf_ptcch_padding, tvb, offset, -1, ENC_NA);
}
static void
handle_lapdm(guint8 sub_type, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
@ -640,6 +681,17 @@ dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
sub_handle = GSMTAP_SUB_UM_RLC_MAC_DL;
}
break;
/* See 3GPP TS 45.003, section 5.2 "Packet control channels" */
case GSMTAP_CHANNEL_PTCCH:
/* PTCCH/D carries Timing Advance updates encoded with CS-1 */
if (pinfo->p2p_dir == P2P_DIR_RECV) {
dissect_ptcch_dl(payload_tvb, tree);
return tvb_captured_length(tvb);
}
/* PTCCH/U carries Access Bursts for Timing Advance estimation */
sub_handle = GSMTAP_SUB_DATA;
break;
case GSMTAP_CHANNEL_CBCH51:
case GSMTAP_CHANNEL_CBCH52:
@ -789,6 +841,16 @@ proto_register_gsmtap(void)
NULL, HFILL } },
{ &hf_sacch_l1h_ta, { "Actual Timing Advance", "gsmtap.sacch_l1.ta",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
/* PTCCH (Packet Timing Advance Control Channel) on Downlink */
{ &hf_ptcch_spare, { "Spare Bit", "gsmtap.ptcch.spare",
FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL } },
{ &hf_ptcch_ta_idx, { "Timing Advance Index", "gsmtap.ptcch.ta_idx",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
{ &hf_ptcch_ta_val, { "Timing Advance Value", "gsmtap.ptcch.ta_val",
FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL } },
{ &hf_ptcch_padding, { "Spare Padding", "gsmtap.ptcch.padding",
FT_BYTES, SEP_SPACE, NULL, 0, NULL, HFILL } },
};
static gint *ett[] = {
&ett_gsmtap