Partial implementation of UMTS FP. Currently only works with Catapult DCT2000 format files, as need extra information about packet when decoding. There are a few TODOs (notably E-DCH channels), but the current version gives OK coverage.

svn path=/trunk/; revision=19130
This commit is contained in:
Martin Mathieson 2006-09-04 11:04:14 +00:00
parent 6e040b3a83
commit 76192b1c6c
7 changed files with 1892 additions and 34 deletions

View File

@ -651,6 +651,7 @@ DISSECTOR_SRC = \
packet-uma.c \
packet-udp.c \
packet-ulp.c \
packet-umts_fp.c \
packet-umts_rrc.c \
packet-umts_rrc_ies.c \
packet-umts_rrc_pdu_def.c \
@ -949,6 +950,7 @@ DISSECTOR_INCLUDES = \
packet-tr.h \
packet-udp.h \
packet-ulp.h \
packet-umts_fp.h \
packet-umts_rrc.h \
packet-umts_rrc_ies.h \
packet-umts_rrc_pdu_def.h \

View File

@ -66,6 +66,7 @@ static dissector_handle_t llc_handle;
static dissector_handle_t sscop_handle;
static dissector_handle_t lane_handle;
static dissector_handle_t ilmi_handle;
static dissector_handle_t fp_handle;
static dissector_handle_t data_handle;
/*
@ -1014,7 +1015,8 @@ dissect_reassembled_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_text(atm_tree, tvb, 0, 0, "Cells: %u",
reported_length/48);
}
if (length >= reported_length) {
if (pinfo->pseudo_header->atm.aal == AAL_5 &&
length >= reported_length) {
/*
* XXX - what if the packet is truncated? Can that happen?
* What if you capture with Windows Sniffer on an ATM link
@ -1051,23 +1053,23 @@ dissect_reassembled_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (tree) {
if (pad_length > 0) {
proto_tree_add_text(atm_tree, tvb, aal5_length, pad_length,
"Padding");
"Padding");
}
proto_tree_add_text(atm_tree, tvb, length - 8, 1, "AAL5 UU: 0x%02x",
tvb_get_guint8(tvb, length - 8));
tvb_get_guint8(tvb, length - 8));
proto_tree_add_text(atm_tree, tvb, length - 7, 1, "AAL5 CPI: 0x%02x",
tvb_get_guint8(tvb, length - 7));
tvb_get_guint8(tvb, length - 7));
proto_tree_add_text(atm_tree, tvb, length - 6, 2, "AAL5 len: %u",
aal5_length);
aal5_length);
crc = tvb_get_ntohl(tvb, length - 4);
calc_crc = update_crc(0xFFFFFFFF, tvb_get_ptr(tvb, 0, length),
length);
length);
proto_tree_add_text(atm_tree, tvb, length - 4, 4,
"AAL5 CRC: 0x%08X (%s)", crc,
(calc_crc == 0xC704DD7B) ? "correct" : "incorrect");
}
"AAL5 CRC: 0x%08X (%s)", crc,
(calc_crc == 0xC704DD7B) ? "correct" : "incorrect");
}
next_tvb = tvb_new_subset(tvb, 0, aal5_length, aal5_length);
}
}
}
}
}
@ -1106,6 +1108,31 @@ dissect_reassembled_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
break;
case AAL_2:
switch (pinfo->pseudo_header->atm.type) {
case TRAF_UMTS_FP:
/* Skip first 4 bytes of message
- CID
- length
- UUI (always 26 to indicate last data received)
TODO: should they be:
- stripped earlier?
- dissected as SSSAR sublayer? */
next_tvb = tvb_new_subset(tvb, 4,
tvb_length_remaining(tvb, 4),
tvb_length_remaining(tvb, 4));
call_dissector(fp_handle, next_tvb, pinfo, tree);
break;
default:
if (tree) {
/* Dump it as raw data. */
call_dissector(data_handle, next_tvb, pinfo, tree);
break;
}
}
break;
default:
if (tree) {
/* Dump it as raw data. */
@ -1673,6 +1700,7 @@ proto_reg_handoff_atm(void)
lane_handle = find_dissector("lane");
ilmi_handle = find_dissector("ilmi");
data_handle = find_dissector("data");
fp_handle = find_dissector("fp");
atm_handle = create_dissector_handle(dissect_atm, proto_atm);
dissector_add("wtap_encap", WTAP_ENCAP_ATM_PDUS, atm_handle);

View File

@ -27,12 +27,15 @@
#endif
#include <string.h>
#include <ctype.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include <epan/proto.h>
#include <epan/prefs.h>
#include <epan/strutil.h>
#include <wiretap/catapult_dct2000.h>
#include "packet-umts_fp.h"
/* Protocol and registered fields. */
static int proto_catapult_dct2000 = -1;
@ -74,9 +77,19 @@ static const value_string encap_vals[] = {
};
#define MAX_OUTHDR_VALUES 32
static guint outhdr_values[MAX_OUTHDR_VALUES];
static gint outhdr_values_found = 0;
extern int proto_fp;
void proto_reg_handoff_catapult_dct2000(void);
void proto_register_catapult_dct2000(void);
static dissector_handle_t look_for_dissector(char *protocol_name);
/* Look for the protocol data within an ipprim packet.
Only set *data_offset if data field found. */
@ -305,6 +318,20 @@ dissector_handle_t look_for_dissector(char *protocol_name)
{
return find_dissector("http");
}
else
if ((strcmp(protocol_name, "fp") == 0) ||
(strcmp(protocol_name, "fp_r4") == 0) ||
(strcmp(protocol_name, "fp_r5") == 0) ||
(strcmp(protocol_name, "fp_r6") == 0))
{
return find_dissector("fp");
}
else
if ((strcmp(protocol_name, "iuup_rtp_r5") == 0) ||
(strcmp(protocol_name, "iuup_rtp_r6") == 0))
{
return find_dissector("rtp");
}
/* Try for an exact match */
else
@ -314,14 +341,111 @@ dissector_handle_t look_for_dissector(char *protocol_name)
}
/* Populate outhdr_values array with numbers found in outhdr_string */
void parse_outhdr_string(char *outhdr_string)
{
int n = 0;
/* Populate values array */
for (outhdr_values_found=0; n < MAX_OUTHDR_VALUES; )
{
guint start_i = n;
guint digits;
/* Find digits */
for (digits = 0; digits < strlen(outhdr_string); digits++, n++)
{
if (!isdigit(outhdr_string[n]))
{
break;
}
}
if (digits == 0)
{
/* No more numbers left */
break;
}
/* Convert digits into value */
outhdr_values[outhdr_values_found++] =
atoi(format_text(outhdr_string+start_i, digits));
/* Skip comma */
n++;
}
}
/* Fill in an FP packet info struct and attach it to the packet for the FP
dissector to use */
void attach_fp_info(packet_info *pinfo, gboolean received)
{
int i=0;
int chan;
int tf_start, num_chans_start;
/* Allocate & zero struct */
struct _fp_info *p_fp_info = se_alloc(sizeof(struct _fp_info));
if (!p_fp_info)
{
return;
}
memset(p_fp_info, 0, sizeof(struct _fp_info));
/* Read values from array into their places */
if (outhdr_values_found < 5)
{
return;
}
/* Channel type */
p_fp_info->channel = outhdr_values[i++];
/* Node type */
p_fp_info->node_type = outhdr_values[i++];
p_fp_info->is_uplink = (( received && (p_fp_info->node_type == 2)) ||
(!received && (p_fp_info->node_type == 1)));
/* DCH CRC present */
p_fp_info->dch_crc_present = outhdr_values[i++];
/* How many paging indications (if PCH data) */
p_fp_info->paging_indications = outhdr_values[i++];
/* Number of channels (for coordinated channels) */
p_fp_info->num_chans = outhdr_values[i++];
/* TF size for each channel */
tf_start = i;
for (chan=0; chan < p_fp_info->num_chans; chan++)
{
p_fp_info->chan_tf_size[chan] = outhdr_values[tf_start+chan];
}
/* Number of TBs for each channel */
num_chans_start = tf_start + p_fp_info->num_chans;
for (chan=0; chan < p_fp_info->num_chans; chan++)
{
p_fp_info->chan_num_tbs[chan] = outhdr_values[num_chans_start+chan];
}
/* TODO: EDCH info */
/* Store info in packet */
p_add_proto_data(pinfo->fd, proto_fp, p_fp_info);
}
/*****************************************/
/* Main dissection function. */
/*****************************************/
static void
dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *dct2000_tree;
proto_item *ti;
proto_tree *dct2000_tree;
proto_item *ti;
gint offset = 0;
gint context_length;
guint8 port_number;
@ -339,6 +463,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissector_handle_t protocol_handle = 0;
dissector_handle_t heur_protocol_handle = 0;
int sub_dissector_result = 0;
char *protocol_name;
/* Protocol name */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
@ -416,15 +541,27 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_set_len(dct2000_tree, offset);
/* Add useful details to protocol tree label */
protocol_name = tvb_get_ephemeral_string(tvb, protocol_start, protocol_length);
proto_item_append_text(ti, " context=%s.%u t=%s %c prot=%s (v=%s)",
tvb_get_ephemeral_string(tvb, 0, context_length),
port_number,
tvb_get_ephemeral_string(tvb, timestamp_start, timestamp_length),
(direction == 0) ? 'S' : 'R',
tvb_get_ephemeral_string(tvb, protocol_start, protocol_length),
protocol_name,
tvb_get_ephemeral_string(tvb, variant_start, variant_length));
/* FP protocols need info from outhdr attached */
if ((strcmp(protocol_name, "fp") == 0) ||
(strcmp(protocol_name, "fp_r4") == 0) ||
(strcmp(protocol_name, "fp_r5") == 0) ||
(strcmp(protocol_name, "fp_r6") == 0))
{
parse_outhdr_string(tvb_get_ephemeral_string(tvb, outhdr_start, outhdr_length));
attach_fp_info(pinfo, direction);
}
/* Note that the first item of pinfo->pseudo_header->dct2000 will contain
the pseudo-header needed (in some cases) by the wireshark dissector */
@ -465,6 +602,23 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
protocol_handle = find_dissector("mtp2");
break;
case DCT2000_ENCAP_UNHANDLED:
/* Show context.port in src or dest column as appropriate */
if (check_col(pinfo->cinfo, COL_DEF_SRC) && direction == 0)
{
col_add_fstr(pinfo->cinfo, COL_DEF_SRC,
"%s.%u",
tvb_get_ephemeral_string(tvb, 0, context_length),
port_number);
}
else
if (check_col(pinfo->cinfo, COL_DEF_DST) && direction == 1)
{
col_add_fstr(pinfo->cinfo, COL_DEF_DST,
"%s.%u",
tvb_get_ephemeral_string(tvb, 0, context_length),
port_number);
}
/* Many DCT2000 protocols have at least one IPPrim variant. If the
protocol names match, try to find the UDP/TCP data inside them and
pass that offset to dissector
@ -475,8 +629,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (catapult_dct2000_try_ipprim_heuristic)
{
heur_protocol_handle =
look_for_dissector((char*)tvb_get_ephemeral_string(tvb, protocol_start,
protocol_length));
look_for_dissector(protocol_name);
if ((heur_protocol_handle != 0) &&
find_ipprim_data_offset(tvb, &offset))
{
@ -487,9 +640,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Try SCTP Prim heuristic if configured to */
if (!protocol_handle && catapult_dct2000_try_sctpprim_heuristic)
{
heur_protocol_handle =
look_for_dissector(tvb_get_ephemeral_string(tvb, protocol_start,
protocol_length));
heur_protocol_handle = look_for_dissector(protocol_name);
if ((heur_protocol_handle != 0) &&
(find_sctpprim_variant1_data_offset(tvb, &offset) ||
find_sctpprim_variant3_data_offset(tvb, &offset)))
@ -661,8 +812,5 @@ void proto_register_catapult_dct2000(void)
"dissector matching the DCT2000 protocol name, "
"try parsing the payload using that dissector",
&catapult_dct2000_try_sctpprim_heuristic);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
/* packet-fp.h
*
* Martin Mathieson
* $Id: packet-rtcp.h 18196 2006-05-21 04:49:01Z sahlberg $
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Channel types */
#define CHANNEL_RACH_FDD 1
#define CHANNEL_RACH_TDD 2
#define CHANNEL_FACH_FDD 3
#define CHANNEL_FACH_TDD 4
#define CHANNEL_DSCH_FDD 5
#define CHANNEL_DSCH_TDD 6
#define CHANNEL_USCH_TDD_384 8
#define CHANNEL_USCH_TDD_128 24
#define CHANNEL_PCH 9
#define CHANNEL_CPCH 10
#define CHANNEL_BCH 11
#define CHANNEL_DCH 12
#define CHANNEL_HSDSCH 13
#define CHANNEL_IUR_CPCHF 14
#define CHANNEL_IUR_FACH 15
#define CHANNEL_IUR_DSCH 16
#define CHANNEL_EDCH 17
#define CHANNEL_RACH_TDD_128 18
/* Info attached to each FP packet */
struct _fp_info
{
gboolean is_uplink;
gint channel;
gint node_type;
gboolean dch_crc_present;
gint paging_indications;
gint num_chans;
#define MAX_FP_CHANS 64
gint chan_tf_size[MAX_FP_CHANS];
gint chan_num_tbs[MAX_FP_CHANS];
/* TODO: EDCH info */
};

View File

@ -143,9 +143,8 @@ static void set_pseudo_header_info(wtap *wth,
int pkt_encap,
long file_offset,
union wtap_pseudo_header *pseudo_header,
gint length,
packet_direction_t direction);
static void set_aal_info(union wtap_pseudo_header *pseudo_header, gint length,
static void set_aal_info(union wtap_pseudo_header *pseudo_header,
packet_direction_t direction);
static void set_isdn_info(union wtap_pseudo_header *pseudo_header,
packet_direction_t direction);
@ -395,7 +394,7 @@ gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
/* Set pseudo-header if necessary */
set_pseudo_header_info(wth, encap, this_offset, &wth->pseudo_header,
data_chars/2, direction);
direction);
/* OK, we have packet details to return */
*err = errno;
@ -468,7 +467,7 @@ catapult_dct2000_seek_read(wtap *wth, long seek_off,
}
/* Set packet pseudo-header if necessary */
set_pseudo_header_info(wth, encap, seek_off, pseudo_header, data_chars/2, direction);
set_pseudo_header_info(wth, encap, seek_off, pseudo_header, direction);
*err = errno = 0;
return TRUE;
@ -1163,7 +1162,6 @@ void set_pseudo_header_info(wtap *wth,
int pkt_encap,
long file_offset,
union wtap_pseudo_header *pseudo_header,
gint length,
packet_direction_t direction)
{
pseudo_header->dct2000.seek_off = file_offset;
@ -1172,7 +1170,7 @@ void set_pseudo_header_info(wtap *wth,
switch (pkt_encap)
{
case WTAP_ENCAP_ATM_PDUS_UNTRUNCATED:
set_aal_info(pseudo_header, length, direction);
set_aal_info(pseudo_header, direction);
break;
case WTAP_ENCAP_ISDN:
set_isdn_info(pseudo_header, direction);
@ -1191,8 +1189,7 @@ void set_pseudo_header_info(wtap *wth,
/*********************************************/
/* Fill in atm pseudo-header with known info */
/*********************************************/
void set_aal_info(union wtap_pseudo_header *pseudo_header, gint length,
packet_direction_t direction)
void set_aal_info(union wtap_pseudo_header *pseudo_header, packet_direction_t direction)
{
/* 'aal_head_chars' has this format (for AAL2 at least):
Global Flow Control (4 bits) | VPI (8 bits) | VCI (16 bits) |
@ -1212,7 +1209,7 @@ void set_aal_info(union wtap_pseudo_header *pseudo_header, gint length,
/* Assume always AAL2 for FP */
pseudo_header->dct2000.inner_pseudo_header.atm.aal = AAL_2;
pseudo_header->dct2000.inner_pseudo_header.atm.type = TRAF_UNKNOWN;
pseudo_header->dct2000.inner_pseudo_header.atm.type = TRAF_UMTS_FP;
pseudo_header->dct2000.inner_pseudo_header.atm.subtype = TRAF_ST_UNKNOWN;
/* vpi is 8 bits (2nd & 3rd nibble) */
@ -1229,10 +1226,6 @@ void set_aal_info(union wtap_pseudo_header *pseudo_header, gint length,
/* 0 means we don't know how many cells the frame comprises. */
pseudo_header->dct2000.inner_pseudo_header.atm.cells = 0;
pseudo_header->dct2000.inner_pseudo_header.atm.aal5t_u2u = 0;
pseudo_header->dct2000.inner_pseudo_header.atm.aal5t_len = length;
pseudo_header->dct2000.inner_pseudo_header.atm.aal5t_chksum = 0;
}

View File

@ -318,6 +318,7 @@ struct isdn_phdr {
#define TRAF_FR 5 /* Frame Relay */
#define TRAF_SPANS 6 /* FORE SPANS */
#define TRAF_IPSILON 7 /* Ipsilon */
#define TRAF_UMTS_FP 8 /* UMTS Frame Protocol */
/*
* Traffic subtypes.