forked from osmocom/wireshark
From Martin Mathieson:
This patch: - treats the variant field as a variable-length string field. This is needed for some of the more complicated protocols where the variant number of the embedded protocol is also represented - the patch to Makefile.am was not applied from http://www.wireshark.org/lists/wireshark-dev/200606/msg00009.html svn path=/trunk/; revision=18427
This commit is contained in:
parent
ea3364b8f3
commit
81bda938ff
|
@ -105,9 +105,12 @@ dtdsdir = $(pkgdatadir)/dtds
|
|||
dtds_DATA = \
|
||||
dtds/dc.dtd \
|
||||
dtds/itunes.dtd \
|
||||
dtds/pocsettings.dtd \
|
||||
dtds/presence.dtd \
|
||||
dtds/reginfo.dtd \
|
||||
dtds/rss.dtd \
|
||||
dtds/smil.dtd
|
||||
|
||||
dtds/smil.dtd \
|
||||
dtds/watcherinfo.dtd
|
||||
#
|
||||
# Install the RADIUS directory files in the "radius" subdirectory
|
||||
# of that directory.
|
||||
|
|
|
@ -134,11 +134,12 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
gint offset = 0;
|
||||
gint context_length;
|
||||
guint8 port_number;
|
||||
guint8 variant;
|
||||
gint protocol_start;
|
||||
gint protocol_length;
|
||||
gint timestamp_start;
|
||||
gint timestamp_length;
|
||||
gint variant_start;
|
||||
gint variant_length;
|
||||
guint8 direction;
|
||||
tvbuff_t *next_tvb;
|
||||
int encap;
|
||||
|
@ -190,10 +191,11 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
offset += protocol_length;
|
||||
|
||||
/* Variant */
|
||||
variant = tvb_get_guint8(tvb, offset);
|
||||
variant_start = offset;
|
||||
variant_length = tvb_strsize(tvb, offset);
|
||||
proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_variant, tvb,
|
||||
offset, 1, FALSE);
|
||||
offset++;
|
||||
offset, variant_length, FALSE);
|
||||
offset += variant_length;
|
||||
|
||||
/* Direction */
|
||||
direction = tvb_get_guint8(tvb, offset);
|
||||
|
@ -210,13 +212,13 @@ 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 */
|
||||
proto_item_append_text(ti, " context=%s.%u t=%s %c prot=%s (v=%d)",
|
||||
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),
|
||||
variant);
|
||||
tvb_get_ephemeral_string(tvb, variant_start, variant_length));
|
||||
|
||||
|
||||
/* Note that the first item of pinfo->pseudo_header->dct2000 will contain
|
||||
|
@ -309,13 +311,13 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
if (check_col(pinfo->cinfo, COL_INFO))
|
||||
{
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO,
|
||||
"Unparsed protocol data (context=%s.%u t=%s %c prot=%s (v=%d))",
|
||||
"Unparsed protocol data (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),
|
||||
variant);
|
||||
tvb_get_ephemeral_string(tvb, variant_start, variant_length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +367,7 @@ void proto_register_catapult_dct2000(void)
|
|||
},
|
||||
{ &hf_catapult_dct2000_variant,
|
||||
{ "Protocol variant",
|
||||
"dct2000.variant", FT_UINT8, BASE_DEC, NULL, 0x0,
|
||||
"dct2000.variant", FT_STRING, BASE_NONE, NULL, 0x0,
|
||||
"DCT2000 protocol variant", HFILL
|
||||
}
|
||||
},
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#define MAX_CONTEXT_NAME 64
|
||||
#define MAX_PROTOCOL_NAME 64
|
||||
#define MAX_PORT_DIGITS 2
|
||||
#define MAX_VARIANT_DIGITS 2
|
||||
#define MAX_VARIANT_DIGITS 32
|
||||
#define AAL_HEADER_CHARS 12
|
||||
|
||||
/* TODO:
|
||||
|
@ -104,7 +104,7 @@ static guint8 context_port;
|
|||
|
||||
/* The DCT2000 protocol name of the packet, plus variant number */
|
||||
static gchar protocol_name[MAX_PROTOCOL_NAME+1];
|
||||
static gchar variant;
|
||||
static gchar variant_name[MAX_VARIANT_DIGITS+1];
|
||||
|
||||
|
||||
/*************************************************/
|
||||
|
@ -139,7 +139,7 @@ static gboolean parse_line(gint line_length, gint *seconds, gint *useconds,
|
|||
packet_direction_t *direction,
|
||||
int *encap,
|
||||
gboolean seek_read);
|
||||
int write_stub_header(guchar *frame_buffer, char *timestamp_string,
|
||||
static int write_stub_header(guchar *frame_buffer, char *timestamp_string,
|
||||
packet_direction_t direction, int encap);
|
||||
static guchar hex_from_char(gchar c);
|
||||
static gchar char_from_hex(guchar hex);
|
||||
|
@ -740,8 +740,6 @@ gboolean parse_line(gint line_length, gint *seconds, gint *useconds,
|
|||
int port_digits = 0;
|
||||
char port_number_string[MAX_PORT_DIGITS+1];
|
||||
int variant_digits = 0;
|
||||
char variant_number_string[MAX_VARIANT_DIGITS+1];
|
||||
|
||||
int protocol_chars = 0;
|
||||
|
||||
char seconds_buff[MAX_SECONDS_CHARS+1];
|
||||
|
@ -908,7 +906,7 @@ gboolean parse_line(gint line_length, gint *seconds, gint *useconds,
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
variant_number_string[variant_digits] = linebuff[n];
|
||||
variant_name[variant_digits] = linebuff[n];
|
||||
}
|
||||
if (variant_digits > MAX_VARIANT_DIGITS || (n+1 >= line_length))
|
||||
{
|
||||
|
@ -916,12 +914,11 @@ gboolean parse_line(gint line_length, gint *seconds, gint *useconds,
|
|||
}
|
||||
if (variant_digits > 0)
|
||||
{
|
||||
variant_number_string[variant_digits] = '\0';
|
||||
variant = atoi(variant_number_string);
|
||||
variant_name[variant_digits] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
variant = 1;
|
||||
strcpy(variant_name, "1");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1106,9 +1103,9 @@ int write_stub_header(guchar *frame_buffer, char *timestamp_string,
|
|||
stub_offset += (strlen(protocol_name) + 1);
|
||||
|
||||
/* Protocol variant number */
|
||||
frame_buffer[stub_offset] = variant;
|
||||
stub_offset++;
|
||||
|
||||
strcpy((void*)&frame_buffer[stub_offset], variant_name);
|
||||
stub_offset += (strlen(variant_name) + 1);
|
||||
|
||||
/* Direction */
|
||||
frame_buffer[stub_offset] = direction;
|
||||
stub_offset++;
|
||||
|
|
Loading…
Reference in New Issue