aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-catapult-dct2000.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2011-01-06 16:08:56 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2011-01-06 16:08:56 +0000
commit18f751d8777d473590a123d7e52d83e8d7b168b9 (patch)
tree8372c351b7fc24616ddd70c5ace3c76ccb39aee9 /epan/dissectors/packet-catapult-dct2000.c
parent8934e6bf26f42dd341f1baf8d41413af2ef6e6e0 (diff)
(After discussion on -dev) revert 35393: the old code is faster (and it is safe).
svn path=/trunk/; revision=35400
Diffstat (limited to 'epan/dissectors/packet-catapult-dct2000.c')
-rw-r--r--epan/dissectors/packet-catapult-dct2000.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c
index a786fdc472..b442ed81a8 100644
--- a/epan/dissectors/packet-catapult-dct2000.c
+++ b/epan/dissectors/packet-catapult-dct2000.c
@@ -1714,15 +1714,15 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *ti = NULL;
gint offset = 0;
gint context_length;
- const char *context_name;
guint8 port_number;
+ gint protocol_start;
gint protocol_length;
+ gint timestamp_start;
gint timestamp_length;
- const char *timestamp_string;
+ gint variant_start;
gint variant_length;
- const char *variant_string;
+ gint outhdr_start;
gint outhdr_length;
- const char *outhdr_string;
guint8 direction;
tvbuff_t *next_tvb;
int encap;
@@ -1749,7 +1749,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* by the wiretap module */
/* Context Name */
- context_name = tvb_get_ephemeral_stringz(tvb, offset, &context_length);
+ context_length = tvb_strsize(tvb, offset);
if (dct2000_tree) {
proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_context, tvb,
offset, context_length, FALSE);
@@ -1765,29 +1765,33 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset++;
/* Timestamp in file */
- timestamp_string = tvb_get_ephemeral_stringz(tvb, offset, &timestamp_length);
+ timestamp_start = offset;
+ timestamp_length = tvb_strsize(tvb, offset);
if (dct2000_tree) {
/* TODO: this is *very* slow, but float version adds trailing digits when
displayed as a custom column... */
proto_tree_add_double(dct2000_tree, hf_catapult_dct2000_timestamp, tvb,
offset, timestamp_length,
- atof(timestamp_string));
+ atof(tvb_get_ptr(tvb, offset, timestamp_length)));
}
offset += timestamp_length;
/* DCT2000 protocol name */
- protocol_name = tvb_get_ephemeral_stringz(tvb, offset, &protocol_length);
+ protocol_start = offset;
+ protocol_length = tvb_strsize(tvb, offset);
if (dct2000_tree) {
proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_protocol, tvb,
offset, protocol_length, FALSE);
}
+ protocol_name = (char*)tvb_get_ptr(tvb, protocol_start, protocol_length);
is_comment = (strcmp(protocol_name, "comment") == 0);
offset += protocol_length;
/* Protocol Variant */
- variant_string = tvb_get_ephemeral_stringz(tvb, offset, &variant_length);
+ variant_start = offset;
+ variant_length = tvb_strsize(tvb, offset);
if (!is_comment) {
proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_variant, tvb,
offset, variant_length, FALSE);
@@ -1795,7 +1799,8 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += variant_length;
/* Outhdr (shown as string) */
- outhdr_string = tvb_get_ephemeral_stringz(tvb, offset, &outhdr_length);
+ outhdr_start = offset;
+ outhdr_length = tvb_strsize(tvb, offset);
if (!is_comment && (outhdr_length > 1)) {
proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_outhdr, tvb,
offset, outhdr_length, FALSE);
@@ -1820,12 +1825,12 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Add useful details to protocol tree label */
proto_item_append_text(ti, " context=%s.%u t=%s %c prot=%s (v=%s)",
- context_name,
+ tvb_get_ptr(tvb, 0, context_length),
port_number,
- timestamp_string,
+ tvb_get_ptr(tvb, timestamp_start, timestamp_length),
(direction == 0) ? 'S' : 'R',
protocol_name,
- variant_string);
+ tvb_get_ptr(tvb, variant_start, variant_length));
@@ -1838,25 +1843,26 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
(strcmp(protocol_name, "fp_r8") == 0) ||
(strcmp(protocol_name, "fpiur_r5") == 0)) {
- parse_outhdr_string(outhdr_string);
- attach_fp_info(pinfo, direction, protocol_name, atoi(variant_string));
+ parse_outhdr_string(tvb_get_ptr(tvb, outhdr_start, outhdr_length));
+ attach_fp_info(pinfo, direction, protocol_name,
+ atoi((char*)tvb_get_ptr(tvb, variant_start, variant_length)));
}
/* LTE MAC needs info attached */
else if (strcmp(protocol_name, "mac_r8_lte") == 0) {
- parse_outhdr_string(outhdr_string);
+ parse_outhdr_string(tvb_get_ptr(tvb, outhdr_start, outhdr_length));
attach_mac_lte_info(pinfo);
}
/* LTE RLC needs info attached */
else if (strcmp(protocol_name, "rlc_r8_lte") == 0) {
- parse_outhdr_string(outhdr_string);
+ parse_outhdr_string(tvb_get_ptr(tvb, outhdr_start, outhdr_length));
attach_rlc_lte_info(pinfo);
}
/* LTE PDCP needs info attached */
else if (strcmp(protocol_name, "pdcp_r8_lte") == 0) {
- parse_outhdr_string(outhdr_string);
+ parse_outhdr_string(tvb_get_ptr(tvb, outhdr_start, outhdr_length));
attach_pdcp_lte_info(pinfo);
}
@@ -1916,14 +1922,14 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (direction == 0) {
col_add_fstr(pinfo->cinfo, COL_DEF_SRC,
"%s.%u",
- context_name,
+ tvb_get_ptr(tvb, 0, context_length),
port_number);
}
else
if (direction == 1) {
col_add_fstr(pinfo->cinfo, COL_DEF_DST,
"%s.%u",
- context_name,
+ tvb_get_ptr(tvb, 0, context_length),
port_number);
}
@@ -2330,12 +2336,12 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_add_fstr(pinfo->cinfo, COL_INFO,
"Not dissected (context=%s.%u t=%s %c prot=%s (v=%s))",
- context_name,
+ tvb_get_ptr(tvb, 0, context_length),
port_number,
- timestamp_string,
+ tvb_get_ptr(tvb, timestamp_start, timestamp_length),
(direction == 0) ? 'S' : 'R',
- protocol_name,
- variant_string);
+ tvb_get_ptr(tvb, protocol_start, protocol_length),
+ tvb_get_ptr(tvb, variant_start, variant_length));
}
else {
/* Show number of dissected bytes */