2009-10-09 06:37:48 +00:00
|
|
|
/* Routines for UMTS FP Hint protocol disassembly
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2009-10-09 06:37:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2013-11-29 20:53:00 +00:00
|
|
|
#include <wiretap/wtap.h>
|
2012-05-07 17:38:26 +00:00
|
|
|
#include <epan/conversation.h>
|
2014-08-07 12:36:30 +00:00
|
|
|
#include <epan/expert.h>
|
2016-01-25 01:10:20 +00:00
|
|
|
#include <epan/proto_data.h>
|
2009-10-09 06:37:48 +00:00
|
|
|
#include "packet-umts_fp.h"
|
|
|
|
#include "packet-umts_mac.h"
|
2017-06-17 20:27:33 +00:00
|
|
|
#include "packet-umts_rlc.h"
|
2009-10-09 06:37:48 +00:00
|
|
|
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_fp_hint(void);
|
|
|
|
void proto_reg_handoff_fp_hint(void);
|
|
|
|
|
2009-10-09 06:37:48 +00:00
|
|
|
static int proto_fp_hint = -1;
|
|
|
|
extern int proto_fp;
|
|
|
|
extern int proto_umts_mac;
|
2017-06-18 02:03:11 +00:00
|
|
|
extern int proto_umts_rlc;
|
2009-10-09 06:37:48 +00:00
|
|
|
|
|
|
|
static int ett_fph = -1;
|
|
|
|
static int ett_fph_rb = -1;
|
|
|
|
static int ett_fph_ddi_entry = -1;
|
|
|
|
static int ett_fph_tf = -1;
|
|
|
|
|
|
|
|
static int hf_fph_frametype = -1;
|
|
|
|
static int hf_fph_channeltype = -1;
|
|
|
|
static int hf_fph_chcnt = -1;
|
|
|
|
static int hf_fph_dchid = -1;
|
|
|
|
static int hf_fph_urnti = -1;
|
|
|
|
static int hf_fph_rlcmode = -1;
|
|
|
|
static int hf_fph_content = -1;
|
|
|
|
static int hf_fph_rbid = -1;
|
|
|
|
static int hf_fph_ctmux = -1;
|
|
|
|
static int hf_fph_ciphered = -1;
|
|
|
|
static int hf_fph_deciphered = -1;
|
|
|
|
static int hf_fph_macdflowid = -1;
|
2010-10-08 11:03:08 +00:00
|
|
|
static int hf_fph_macehs = -1;
|
2009-10-09 06:37:48 +00:00
|
|
|
static int hf_fph_rb = -1;
|
|
|
|
static int hf_fph_ddi_entry = -1;
|
|
|
|
static int hf_fph_ddi_size = -1;
|
|
|
|
static int hf_fph_ddi_logical = -1;
|
|
|
|
static int hf_fph_ddi_value = -1;
|
|
|
|
static int hf_fph_tf = -1;
|
|
|
|
static int hf_fph_tf_n = -1;
|
|
|
|
static int hf_fph_tf_size = -1;
|
|
|
|
|
2014-08-07 12:36:30 +00:00
|
|
|
static expert_field ei_fph_radio_bearers = EI_INIT;
|
|
|
|
static expert_field ei_fph_mac_frames = EI_INIT;
|
|
|
|
static expert_field ei_fph_fp_channels = EI_INIT;
|
|
|
|
|
2009-10-09 06:37:48 +00:00
|
|
|
static dissector_handle_t data_handle;
|
|
|
|
static dissector_handle_t ethwithfcs_handle;
|
|
|
|
static dissector_handle_t atm_untrunc_handle;
|
|
|
|
|
|
|
|
enum fph_ctype {
|
2014-08-14 18:55:06 +00:00
|
|
|
FPH_CHANNEL_PCH,
|
|
|
|
FPH_CHANNEL_RACH,
|
|
|
|
FPH_CHANNEL_FACH,
|
|
|
|
FPH_CHANNEL_DCH,
|
|
|
|
FPH_CHANNEL_HSDSCH,
|
|
|
|
FPH_CHANNEL_EDCH
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum fph_frame {
|
2014-08-14 18:55:06 +00:00
|
|
|
FPH_FRAME_ATM_AAL2,
|
|
|
|
FPH_FRAME_ETHERNET
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum fph_pich {
|
2014-08-14 18:55:06 +00:00
|
|
|
FPH_PICH18,
|
|
|
|
FPH_PICH36,
|
|
|
|
FPH_PICH72,
|
|
|
|
FPH_PICH144
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum fph_content {
|
2014-08-14 18:55:06 +00:00
|
|
|
FPH_CONTENT_UNKNOWN,
|
|
|
|
FPH_CONTENT_DCCH,
|
|
|
|
FPH_CONTENT_PS_DTCH,
|
|
|
|
FPH_CONTENT_CS_DTCH
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string fph_frametype_vals[] = {
|
2014-08-14 18:55:06 +00:00
|
|
|
{ FPH_FRAME_ATM_AAL2, "ATM AAL2" },
|
|
|
|
{ FPH_FRAME_ETHERNET, "Ethernet" },
|
|
|
|
{ 0, NULL }
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string fph_channeltype_vals[] = {
|
2014-08-14 18:55:06 +00:00
|
|
|
{ FPH_CHANNEL_PCH, "PCH" },
|
|
|
|
{ FPH_CHANNEL_RACH, "RACH" },
|
|
|
|
{ FPH_CHANNEL_FACH, "FACH" },
|
|
|
|
{ FPH_CHANNEL_DCH, "DCH" },
|
|
|
|
{ FPH_CHANNEL_HSDSCH, "HSDSCH" },
|
|
|
|
{ FPH_CHANNEL_EDCH, "E-DCH" },
|
|
|
|
{ 0, NULL }
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string fph_rlcmode_vals[] = {
|
2014-08-14 18:55:06 +00:00
|
|
|
{ RLC_TM, "Transparent Mode" },
|
|
|
|
{ RLC_UM, "Unacknowledged Mode" },
|
|
|
|
{ RLC_AM, "Acknowledged Mode" },
|
|
|
|
{ 0, NULL }
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string fph_content_vals[] = {
|
2014-08-14 18:55:06 +00:00
|
|
|
{ FPH_CONTENT_UNKNOWN, "Unknown" },
|
|
|
|
{ FPH_CONTENT_DCCH, "DCCH" },
|
|
|
|
{ FPH_CONTENT_PS_DTCH, "PS DTCH" },
|
|
|
|
{ FPH_CONTENT_CS_DTCH, "PS DTCH" },
|
|
|
|
{ 0, NULL }
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string fph_ctmux_vals = {
|
2014-08-14 18:55:06 +00:00
|
|
|
"C/T Mux field present", "C/T Mux field not present"
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string fph_ciphered_vals = {
|
2014-08-14 18:55:06 +00:00
|
|
|
"Ciphered", "Not ciphered"
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string fph_deciphered_vals = {
|
2014-08-14 18:55:06 +00:00
|
|
|
"Deciphered", "Not deciphered"
|
2009-10-09 06:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static guint16 assign_rb_info(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, guint8 rbcnt, proto_tree *tree)
|
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
guint8 i = 0, next_byte;
|
|
|
|
guint8 rlc_mode, content, rb_id, ctmux, ciphered, deciphered;
|
|
|
|
guint32 urnti;
|
|
|
|
struct umts_mac_info *macinf;
|
|
|
|
struct rlc_info *rlcinf;
|
|
|
|
|
|
|
|
macinf = (umts_mac_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0);
|
2017-06-18 02:03:11 +00:00
|
|
|
rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_umts_rlc, 0);
|
2014-08-14 18:55:06 +00:00
|
|
|
if (!macinf) {
|
|
|
|
macinf = wmem_new0(wmem_file_scope(), struct umts_mac_info);
|
|
|
|
p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, macinf);
|
|
|
|
}
|
|
|
|
if (!rlcinf) {
|
|
|
|
rlcinf = wmem_new0(wmem_file_scope(), struct rlc_info);
|
2017-06-18 02:03:11 +00:00
|
|
|
p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_rlc, 0, rlcinf);
|
2014-08-14 18:55:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while (i < rbcnt) {
|
|
|
|
urnti = tvb_get_letohl(tvb, offset);
|
|
|
|
next_byte = tvb_get_guint8(tvb, offset + 4);
|
|
|
|
rlc_mode = next_byte & 0x3;
|
|
|
|
content = (next_byte >> 2) & 0x3;
|
|
|
|
rb_id = next_byte >> 4;
|
|
|
|
next_byte = tvb_get_guint8(tvb, offset + 5);
|
|
|
|
rb_id |= (next_byte & 0x01) << 4;
|
|
|
|
ctmux = (next_byte >> 1) & 0x1;
|
|
|
|
ciphered = (next_byte >> 2) & 0x1;
|
|
|
|
deciphered = (next_byte >> 3) & 0x1;
|
|
|
|
|
|
|
|
if (i >= MAX_RLC_CHANS) {
|
|
|
|
proto_tree_add_expert_format(tree, pinfo, &ei_fph_radio_bearers, tvb, offset, -1,
|
|
|
|
"Frame contains more Radio Bearers than currently supported (%u present, %u supported)",
|
|
|
|
rbcnt, MAX_RLC_CHANS);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (i >= MAX_MAC_FRAMES) {
|
|
|
|
proto_tree_add_expert_format(tree, pinfo, &ei_fph_mac_frames, tvb, offset, -1,
|
|
|
|
"Frame contains more MAC Frames than currently supported (%u present, %u supported)",
|
|
|
|
rbcnt, MAX_MAC_FRAMES);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
rlcinf->mode[i] = rlc_mode;
|
|
|
|
rlcinf->rbid[i] = rb_id;
|
2017-06-19 05:54:55 +00:00
|
|
|
rlcinf->ueid[i] = urnti;
|
2014-08-14 18:55:06 +00:00
|
|
|
rlcinf->ciphered[i] = ciphered;
|
|
|
|
rlcinf->deciphered[i] = deciphered;
|
|
|
|
rlcinf->li_size[i] = RLC_LI_VARIABLE;
|
|
|
|
|
|
|
|
macinf->ctmux[i] = ctmux ? TRUE : FALSE;
|
|
|
|
switch (content) {
|
|
|
|
case FPH_CONTENT_DCCH:
|
|
|
|
macinf->content[i] = MAC_CONTENT_DCCH;
|
|
|
|
break;
|
|
|
|
case FPH_CONTENT_PS_DTCH:
|
|
|
|
macinf->content[i] = MAC_CONTENT_PS_DTCH;
|
|
|
|
break;
|
|
|
|
case FPH_CONTENT_CS_DTCH:
|
|
|
|
macinf->content[i] = MAC_CONTENT_CS_DTCH;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
macinf->content[i] = MAC_CONTENT_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
proto_tree *subtree;
|
|
|
|
proto_item *pi;
|
|
|
|
|
|
|
|
pi = proto_tree_add_item(tree, hf_fph_rb, tvb, offset, 8, ENC_NA);
|
|
|
|
subtree = proto_item_add_subtree(pi, ett_fph_rb);
|
|
|
|
|
|
|
|
if (urnti)
|
|
|
|
proto_tree_add_uint(subtree, hf_fph_urnti, tvb, offset, 4, urnti);
|
|
|
|
proto_tree_add_bits_item(subtree, hf_fph_content, tvb, (offset+4)*8+4, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_bits_item(subtree, hf_fph_rlcmode, tvb, (offset+4)*8+6, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_item(subtree, hf_fph_rbid, tvb, (offset+4), 2, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_boolean(subtree, hf_fph_ctmux, tvb, offset+5, 1, ctmux);
|
|
|
|
proto_tree_add_boolean(subtree, hf_fph_ciphered, tvb, offset+5, 1, ciphered);
|
|
|
|
proto_tree_add_boolean(subtree, hf_fph_deciphered, tvb, offset+5, 1, deciphered);
|
|
|
|
}
|
|
|
|
offset += 8;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return offset;
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void assign_fph_pch(tvbuff_t *tvb, packet_info *pinfo _U_, guint16 offset, fp_info *fpi, proto_tree *tree _U_)
|
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
guint8 pich;
|
|
|
|
guint16 blkcnt, blksz;
|
|
|
|
const guint8 *hdr;
|
|
|
|
|
|
|
|
fpi->channel = CHANNEL_PCH;
|
|
|
|
|
|
|
|
hdr = tvb_get_ptr(tvb, offset, 4);
|
|
|
|
blkcnt = hdr[0] | ((hdr[1] & 0x01) << 8);
|
|
|
|
blksz = (hdr[1] >> 1) | ((hdr[2] & 0x3f) << 7);
|
|
|
|
pich = (hdr[2] >> 6) | ((hdr[3] & 0x01) << 2);
|
|
|
|
|
|
|
|
switch (pich) {
|
|
|
|
case FPH_PICH18:
|
|
|
|
fpi->paging_indications = 18;
|
|
|
|
break;
|
|
|
|
case FPH_PICH36:
|
|
|
|
fpi->paging_indications = 36;
|
|
|
|
break;
|
|
|
|
case FPH_PICH72:
|
|
|
|
fpi->paging_indications = 72;
|
|
|
|
break;
|
|
|
|
case FPH_PICH144:
|
|
|
|
fpi->paging_indications = 144;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fpi->paging_indications = 0;
|
|
|
|
}
|
|
|
|
fpi->num_chans = 1;
|
|
|
|
fpi->chan_tf_size[0] = blksz;
|
|
|
|
fpi->chan_num_tbs[0] = blkcnt;
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
2016-04-19 10:22:15 +00:00
|
|
|
static void assign_fph_rach(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, fp_info *fpi, proto_tree *tree)
|
2009-10-09 06:37:48 +00:00
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
const guint8 *hdr;
|
|
|
|
guint8 rbcnt;
|
|
|
|
guint16 blkcnt, blksz;
|
2009-10-09 06:37:48 +00:00
|
|
|
|
2014-08-14 18:55:06 +00:00
|
|
|
fpi->channel = CHANNEL_RACH_FDD;
|
2009-10-09 06:37:48 +00:00
|
|
|
|
2014-08-14 18:55:06 +00:00
|
|
|
hdr = tvb_get_ptr(tvb, offset, 4);
|
|
|
|
blkcnt = hdr[0] | ((hdr[1] & 0x01) << 8);
|
|
|
|
blksz = (hdr[1] >> 1) | ((hdr[2] & 0x3f) << 7);
|
2009-10-09 06:37:48 +00:00
|
|
|
|
2014-08-14 18:55:06 +00:00
|
|
|
fpi->num_chans = 1;
|
|
|
|
fpi->chan_tf_size[0] = blksz;
|
|
|
|
fpi->chan_num_tbs[0] = blkcnt;
|
2009-10-09 06:37:48 +00:00
|
|
|
|
2014-08-14 18:55:06 +00:00
|
|
|
offset += 4;
|
|
|
|
rbcnt = tvb_get_guint8(tvb, offset); offset++;
|
|
|
|
if (rbcnt > 0)
|
|
|
|
/*offset =*/ assign_rb_info(tvb, pinfo, offset, rbcnt, tree);
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void assign_fph_dch(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, fp_info *fpi, proto_tree *tree)
|
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
guint8 dch_id, rbcnt;
|
|
|
|
guint16 N, size;
|
|
|
|
guint32 cnt, i = 0;
|
|
|
|
const guint8 *hdr;
|
|
|
|
proto_tree *subtree;
|
|
|
|
proto_item *pi;
|
|
|
|
|
|
|
|
fpi->channel = CHANNEL_DCH;
|
|
|
|
cnt = tvb_get_guint8(tvb, offset); offset++;
|
|
|
|
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(tree, hf_fph_chcnt, tvb, offset-1, 1, cnt);
|
|
|
|
|
|
|
|
fpi->num_chans = cnt;
|
|
|
|
fpi->dch_crc_present = 1;
|
|
|
|
while (i < cnt) {
|
|
|
|
pi = proto_tree_add_item(tree, hf_fph_tf, tvb, offset, 4, ENC_NA);
|
|
|
|
subtree = proto_item_add_subtree(pi, ett_fph_rb);
|
|
|
|
hdr = tvb_get_ptr(tvb, offset, 4);
|
|
|
|
dch_id = (hdr[0] & 0x1f) + 1;
|
|
|
|
|
|
|
|
N = ((hdr[1] & 0x3f)<<3) | (hdr[0] >> 5);
|
|
|
|
size = ((hdr[3] & 0x07)<<10) | (hdr[2] << 2) | ((hdr[1] & 0xc0)>>6);
|
|
|
|
size = size == 0x1fff ? 0 : size;
|
|
|
|
|
|
|
|
fpi->chan_tf_size[i] = size;
|
|
|
|
fpi->chan_num_tbs[i] = N;
|
|
|
|
|
|
|
|
if (subtree) {
|
|
|
|
proto_tree_add_uint(subtree, hf_fph_dchid, tvb, offset, 1, dch_id);
|
|
|
|
proto_tree_add_uint(subtree, hf_fph_tf_n, tvb, offset, 2, N);
|
|
|
|
if (size)
|
|
|
|
proto_tree_add_uint(subtree, hf_fph_tf_size, tvb, offset + 1, 3, size);
|
|
|
|
}
|
|
|
|
offset += 4;
|
|
|
|
if (i > MAX_FP_CHANS) {
|
|
|
|
proto_tree_add_expert_format(tree, pinfo, &ei_fph_fp_channels, tvb, offset, -1,
|
|
|
|
"Frame contains more FP channels than currently supported (%u supported)",
|
|
|
|
MAX_FP_CHANS);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
rbcnt = tvb_get_guint8(tvb, offset); offset++;
|
|
|
|
if (rbcnt > 0)
|
|
|
|
/*offset =*/ assign_rb_info(tvb, pinfo, offset, rbcnt, tree);
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void assign_fph_fach(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, fp_info *fpi, proto_tree *tree)
|
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
const guint8 *hdr;
|
|
|
|
guint8 rbcnt;
|
|
|
|
guint16 blkcnt, blksz;
|
2009-10-09 06:37:48 +00:00
|
|
|
|
2014-08-14 18:55:06 +00:00
|
|
|
fpi->channel = CHANNEL_FACH_FDD;
|
2009-10-09 06:37:48 +00:00
|
|
|
|
2014-08-14 18:55:06 +00:00
|
|
|
hdr = tvb_get_ptr(tvb, offset, 4);
|
|
|
|
blkcnt = hdr[0] | ((hdr[1] & 0x01) << 8);
|
|
|
|
blksz = (hdr[1] >> 1) | ((hdr[2] & 0x3f) << 7);
|
2009-10-09 06:37:48 +00:00
|
|
|
|
2014-08-14 18:55:06 +00:00
|
|
|
fpi->num_chans = 1;
|
|
|
|
fpi->chan_tf_size[0] = blksz;
|
|
|
|
fpi->chan_num_tbs[0] = blkcnt;
|
2009-10-09 06:37:48 +00:00
|
|
|
|
2014-08-14 18:55:06 +00:00
|
|
|
offset += 4;
|
|
|
|
rbcnt = tvb_get_guint8(tvb, offset); offset++;
|
|
|
|
if (rbcnt > 0)
|
|
|
|
/*offset =*/ assign_rb_info(tvb, pinfo, offset, rbcnt, tree);
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void assign_fph_hsdsch(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, fp_info *fpi, proto_tree *tree)
|
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
guint8 rbcnt, hsdsch_info;
|
|
|
|
|
|
|
|
hsdsch_info = tvb_get_guint8(tvb, offset);
|
|
|
|
fpi->hsdsch_entity = hsdsch_info & 0x08 ? ehs : hs;
|
|
|
|
fpi->channel = CHANNEL_HSDSCH;
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_bits_item(tree, hf_fph_macehs, tvb,
|
|
|
|
offset*8+4, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_bits_item(tree, hf_fph_macdflowid, tvb,
|
|
|
|
offset*8+5, 3, ENC_LITTLE_ENDIAN);
|
|
|
|
}
|
|
|
|
|
|
|
|
offset++;
|
|
|
|
rbcnt = tvb_get_guint8(tvb, offset); offset++;
|
|
|
|
if (rbcnt > 0)
|
|
|
|
/*offset =*/ assign_rb_info(tvb, pinfo, offset, rbcnt, tree);
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void assign_fph_edch(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, fp_info *fpi, proto_tree *tree)
|
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
guint8 rbcnt, macdflow_id, maces_cnt, i = 0;
|
|
|
|
guint8 logical, ddi;
|
|
|
|
guint16 maces_size;
|
|
|
|
proto_item *pi;
|
|
|
|
proto_tree *subtree = NULL;
|
|
|
|
|
|
|
|
fpi->channel = CHANNEL_EDCH;
|
|
|
|
macdflow_id = tvb_get_guint8(tvb, offset);
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_uint(tree, hf_fph_macdflowid, tvb, offset, 1, macdflow_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
offset++;
|
|
|
|
maces_cnt = tvb_get_guint8(tvb, offset); offset++;
|
|
|
|
|
|
|
|
fpi->no_ddi_entries = maces_cnt;
|
|
|
|
while (i < maces_cnt) {
|
|
|
|
ddi = tvb_get_guint8(tvb, offset++);
|
|
|
|
logical = tvb_get_guint8(tvb, offset++);
|
|
|
|
maces_size = tvb_get_letohs(tvb, offset);
|
|
|
|
offset += 2;
|
|
|
|
fpi->edch_ddi[i] = ddi;
|
|
|
|
fpi->edch_macd_pdu_size[i] = maces_size;
|
|
|
|
if (tree) {
|
|
|
|
pi = proto_tree_add_item(tree, hf_fph_ddi_entry, tvb, offset - 4, 4, ENC_NA);
|
|
|
|
subtree = proto_item_add_subtree(pi, ett_fph_ddi_entry);
|
|
|
|
proto_tree_add_uint(subtree, hf_fph_ddi_value, tvb, offset - 4, 1, ddi);
|
|
|
|
proto_tree_add_uint(subtree, hf_fph_ddi_logical, tvb, offset - 3, 1, logical);
|
|
|
|
proto_tree_add_uint(subtree, hf_fph_ddi_size, tvb, offset - 2, 2, maces_size);
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
if (i >= MAX_EDCH_DDIS) {
|
|
|
|
proto_tree_add_expert_format(tree, pinfo, &ei_fph_fp_channels, tvb, offset, -1,
|
|
|
|
"Frame contains more FP channels than currently supported (%u supported)",
|
|
|
|
MAX_FP_CHANS);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rbcnt = tvb_get_guint8(tvb, offset); offset++;
|
|
|
|
if (rbcnt > 0)
|
|
|
|
/*offset =*/ assign_rb_info(tvb, pinfo, offset, rbcnt, tree);
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void attach_info(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, guint8 channel_type, guint8 frame_type, proto_tree *tree)
|
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
fp_info *fpi;
|
|
|
|
|
|
|
|
fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
|
|
|
|
if (!fpi) {
|
|
|
|
fpi = wmem_new0(wmem_file_scope(), fp_info);
|
|
|
|
p_add_proto_data(wmem_file_scope(), pinfo, proto_fp, 0, fpi);
|
|
|
|
}
|
|
|
|
|
|
|
|
fpi->is_uplink = pinfo->p2p_dir == P2P_DIR_RECV;
|
|
|
|
/* TODO make this configurable */
|
|
|
|
fpi->release = 7;
|
|
|
|
fpi->release_year = 2008;
|
|
|
|
fpi->release_month = 9;
|
|
|
|
fpi->dch_crc_present = 1;
|
|
|
|
|
|
|
|
switch (frame_type) {
|
|
|
|
case FPH_FRAME_ATM_AAL2:
|
|
|
|
fpi->link_type = FP_Link_ATM;
|
|
|
|
break;
|
|
|
|
case FPH_FRAME_ETHERNET:
|
|
|
|
fpi->link_type = FP_Link_Ethernet;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fpi->link_type = FP_Link_Unknown;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* at the moment, only IuB is supported */
|
|
|
|
fpi->iface_type = IuB_Interface;
|
|
|
|
/* at the moment, only FDD is supported */
|
|
|
|
fpi->division = Division_FDD;
|
|
|
|
|
|
|
|
switch (channel_type) {
|
|
|
|
case FPH_CHANNEL_PCH:
|
|
|
|
assign_fph_pch(tvb, pinfo, offset, fpi, tree);
|
|
|
|
break;
|
|
|
|
case FPH_CHANNEL_RACH:
|
|
|
|
assign_fph_rach(tvb, pinfo, offset, fpi, tree);
|
|
|
|
break;
|
|
|
|
case FPH_CHANNEL_FACH:
|
|
|
|
assign_fph_fach(tvb, pinfo, offset, fpi, tree);
|
|
|
|
break;
|
|
|
|
case FPH_CHANNEL_DCH:
|
|
|
|
assign_fph_dch(tvb, pinfo, offset, fpi, tree);
|
|
|
|
break;
|
|
|
|
case FPH_CHANNEL_HSDSCH:
|
|
|
|
assign_fph_hsdsch(tvb, pinfo, offset, fpi, tree);
|
|
|
|
break;
|
|
|
|
case FPH_CHANNEL_EDCH:
|
|
|
|
assign_fph_edch(tvb, pinfo, offset, fpi, tree);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fpi->channel = 0;
|
|
|
|
}
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
2015-11-10 04:01:28 +00:00
|
|
|
static int dissect_fp_hint(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2009-10-09 06:37:48 +00:00
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
guint8 frame_type, channel_type;
|
|
|
|
guint16 hdrlen;
|
|
|
|
guint32 atm_hdr, aal2_ext;
|
|
|
|
tvbuff_t *next_tvb;
|
2015-11-10 04:01:28 +00:00
|
|
|
dissector_handle_t next_dissector;
|
2016-01-14 00:03:26 +00:00
|
|
|
void *next_dissector_data;
|
2014-08-14 18:55:06 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *fph_tree = NULL;
|
2016-01-14 00:03:26 +00:00
|
|
|
struct atm_phdr atm_info;
|
2014-08-14 18:55:06 +00:00
|
|
|
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FP Hint");
|
|
|
|
|
|
|
|
hdrlen = tvb_get_letohs(tvb, 0);
|
|
|
|
frame_type = tvb_get_guint8(tvb, 2);
|
|
|
|
channel_type = tvb_get_guint8(tvb, 3);
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_item(tree, proto_fp_hint, tvb, 0, hdrlen, ENC_NA);
|
|
|
|
fph_tree = proto_item_add_subtree(ti, ett_fph);
|
|
|
|
proto_tree_add_uint(fph_tree, hf_fph_frametype, tvb, 2, 1, frame_type);
|
|
|
|
proto_tree_add_uint(fph_tree, hf_fph_channeltype, tvb, 3, 1, channel_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* attach FP, MAC, RLC information */
|
|
|
|
attach_info(tvb, pinfo, 4, channel_type, frame_type, fph_tree);
|
|
|
|
switch (frame_type) {
|
|
|
|
case FPH_FRAME_ATM_AAL2:
|
|
|
|
aal2_ext = tvb_get_ntohl(tvb, hdrlen); hdrlen += 4;
|
|
|
|
atm_hdr = tvb_get_ntohl(tvb, hdrlen); hdrlen += 4;
|
2016-01-14 00:03:26 +00:00
|
|
|
memset(&atm_info, 0, sizeof(atm_info));
|
|
|
|
atm_info.aal = AAL_2;
|
|
|
|
/* atm_info.flags = pinfo->p2p_dir; */
|
|
|
|
atm_info.flags = ATM_AAL2_NOPHDR;
|
|
|
|
atm_info.vpi = ((atm_hdr & 0x0ff00000) >> 20);
|
|
|
|
atm_info.vci = ((atm_hdr & 0x000ffff0) >> 4);
|
|
|
|
atm_info.aal2_cid = aal2_ext & 0x000000ff;
|
|
|
|
atm_info.type = TRAF_UMTS_FP;
|
2015-11-10 04:01:28 +00:00
|
|
|
next_dissector = atm_untrunc_handle;
|
2016-01-14 00:03:26 +00:00
|
|
|
next_dissector_data = &atm_info;
|
2014-08-14 18:55:06 +00:00
|
|
|
break;
|
|
|
|
case FPH_FRAME_ETHERNET:
|
2015-11-10 04:01:28 +00:00
|
|
|
next_dissector = ethwithfcs_handle;
|
2016-01-14 00:03:26 +00:00
|
|
|
next_dissector_data = NULL;
|
2014-08-14 18:55:06 +00:00
|
|
|
break;
|
|
|
|
default:
|
2015-11-10 04:01:28 +00:00
|
|
|
next_dissector = data_handle;
|
2016-01-14 00:03:26 +00:00
|
|
|
next_dissector_data = NULL;
|
|
|
|
break;
|
2014-08-14 18:55:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, hdrlen);
|
2016-01-14 00:03:26 +00:00
|
|
|
call_dissector_with_data(next_dissector, next_tvb, pinfo, tree,
|
|
|
|
next_dissector_data);
|
2015-11-10 04:01:28 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_fp_hint(void)
|
|
|
|
{
|
2014-08-14 18:55:06 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_fph_frametype, { "Frame Type", "fp_hint.frame_type", FT_UINT8, BASE_HEX, VALS(fph_frametype_vals), 0x0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_channeltype, { "Channel Type", "fp_hint.channel_type", FT_UINT8, BASE_HEX, VALS(fph_channeltype_vals), 0x0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_chcnt, { "Number of Channels", "fp_hint.num_chan", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_dchid, { "DCH ID", "fp_hint.dchid", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_macdflowid, { "MACd Flow ID", "fp_hint.macdflowid", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_macehs, { "MAC-ehs indicator", "fp_hint.mac_ehs", FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL } },
|
|
|
|
/* traffic format details */
|
|
|
|
{ &hf_fph_tf, { "Traffic Format", "fp_hint.tf", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_tf_n, { "N", "fp_hint.tf.n", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_tf_size, { "Size", "fp_hint.tf.size", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
|
|
|
|
/* DDI information for E-DCH */
|
|
|
|
{ &hf_fph_ddi_entry, { "DDI Entry", "fp_hint.ddi", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_ddi_value, { "DDI", "fp_hint.ddi.value", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_ddi_logical, { "Logical Channel ID", "fp_hint.ddi.logical", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_ddi_size, { "Size", "fp_hint.ddi.size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } },
|
|
|
|
/* radio bearer details */
|
|
|
|
{ &hf_fph_rb, { "Radio Bearer", "fp_hint.rb", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_urnti, { "U-RNTI", "fp_hint.rb.urnti", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_content, { "Content", "fp_hint.rb.content", FT_UINT8, BASE_DEC, VALS(fph_content_vals), 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_rlcmode, { "RLC Mode", "fp_hint.rb.rlc_mode", FT_UINT8, BASE_DEC, VALS(fph_rlcmode_vals), 0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_rbid, { "Radio Bearer ID", "fp_hint.rb.rbid", FT_UINT16, BASE_DEC, NULL, 0x01f0, NULL, HFILL } },
|
|
|
|
{ &hf_fph_ctmux, { "C/T Mux", "fp_hint.rb.ctmux", FT_BOOLEAN, BASE_NONE, TFS(&fph_ctmux_vals), 0, "C/T Mux field", HFILL } },
|
|
|
|
{ &hf_fph_ciphered, { "Ciphered", "fp_hint.rb.ciphered", FT_BOOLEAN, BASE_NONE, TFS(&fph_ciphered_vals), 0, "Ciphered flag", HFILL } },
|
|
|
|
{ &hf_fph_deciphered, { "Deciphered", "fp_hint.rb.deciphered", FT_BOOLEAN, BASE_NONE, TFS(&fph_deciphered_vals), 0, "Deciphered flag", HFILL } }
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_fph,
|
|
|
|
&ett_fph_rb,
|
|
|
|
&ett_fph_ddi_entry,
|
|
|
|
&ett_fph_tf
|
|
|
|
};
|
|
|
|
|
|
|
|
static ei_register_info ei[] = {
|
|
|
|
{ &ei_fph_radio_bearers, { "fp_hint.rb.invalid", PI_PROTOCOL, PI_WARN, "Frame contains more Radio Bearers than currently supported", EXPFILL }},
|
2014-11-07 03:10:11 +00:00
|
|
|
{ &ei_fph_mac_frames, { "fp_hint.mac_frames.invalid", PI_PROTOCOL, PI_WARN, "Frame contains more MAC Frames than currently supported", EXPFILL }},
|
2014-08-14 18:55:06 +00:00
|
|
|
{ &ei_fph_fp_channels, { "fp_hint.fp_channels.invalid", PI_PROTOCOL, PI_WARN, "Frame contains more FP channels than currently supported", EXPFILL }},
|
|
|
|
};
|
|
|
|
|
|
|
|
expert_module_t* expert_fp_hint;
|
|
|
|
|
|
|
|
proto_fp_hint = proto_register_protocol("FP Hint", "FP Hint", "fp_hint");
|
2015-12-09 04:04:01 +00:00
|
|
|
register_dissector("fp_hint", dissect_fp_hint, proto_fp_hint);
|
2014-08-14 18:55:06 +00:00
|
|
|
|
|
|
|
proto_register_field_array(proto_fp_hint, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
expert_fp_hint = expert_register_protocol(proto_fp_hint);
|
|
|
|
expert_register_field_array(expert_fp_hint, ei, array_length(ei));
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_fp_hint(void)
|
|
|
|
{
|
2016-03-16 13:02:52 +00:00
|
|
|
atm_untrunc_handle = find_dissector_add_dependency("atm_untruncated", proto_fp_hint);
|
2014-08-14 18:55:06 +00:00
|
|
|
data_handle = find_dissector("data");
|
2016-03-16 13:02:52 +00:00
|
|
|
ethwithfcs_handle = find_dissector_add_dependency("eth_withfcs", proto_fp_hint);
|
2009-10-09 06:37:48 +00:00
|
|
|
}
|
2014-08-14 18:55:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2014-08-14 18:55:06 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|