aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bthsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-bthsp.c')
-rw-r--r--epan/dissectors/packet-bthsp.c78
1 files changed, 38 insertions, 40 deletions
diff --git a/epan/dissectors/packet-bthsp.c b/epan/dissectors/packet-bthsp.c
index 564921cc84..13465629c8 100644
--- a/epan/dissectors/packet-bthsp.c
+++ b/epan/dissectors/packet-bthsp.c
@@ -15,39 +15,40 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
+#include <epan/strutil.h>
#include "packet-btrfcomm.h"
#include "packet-btsdp.h"
-static int proto_bthsp = -1;
-
-static int hf_command = -1;
-static int hf_parameters = -1;
-static int hf_command_in = -1;
-static int hf_unsolicited = -1;
-static int hf_role = -1;
-static int hf_at_cmd = -1;
-static int hf_at_cmd_type = -1;
-static int hf_at_command_line_prefix = -1;
-static int hf_at_ignored = -1;
-static int hf_parameter = -1;
-static int hf_unknown_parameter = -1;
-static int hf_data = -1;
-static int hf_fragment = -1;
-static int hf_fragmented = -1;
-static int hf_vgs = -1;
-static int hf_vgm = -1;
-static int hf_ckpd = -1;
-
-static expert_field ei_non_mandatory_command = EI_INIT;
-static expert_field ei_invalid_usage = EI_INIT;
-static expert_field ei_unknown_parameter = EI_INIT;
-static expert_field ei_vgm_gain = EI_INIT;
-static expert_field ei_vgs_gain = EI_INIT;
-static expert_field ei_ckpd = EI_INIT;
-
-static gint ett_bthsp = -1;
-static gint ett_bthsp_command = -1;
-static gint ett_bthsp_parameters = -1;
+static int proto_bthsp;
+
+static int hf_command;
+static int hf_parameters;
+static int hf_command_in;
+static int hf_unsolicited;
+static int hf_role;
+static int hf_at_cmd;
+static int hf_at_cmd_type;
+static int hf_at_command_line_prefix;
+static int hf_at_ignored;
+static int hf_parameter;
+static int hf_unknown_parameter;
+static int hf_data;
+static int hf_fragment;
+static int hf_fragmented;
+static int hf_vgs;
+static int hf_vgm;
+static int hf_ckpd;
+
+static expert_field ei_non_mandatory_command;
+static expert_field ei_invalid_usage;
+static expert_field ei_unknown_parameter;
+static expert_field ei_vgm_gain;
+static expert_field ei_vgs_gain;
+static expert_field ei_ckpd;
+
+static gint ett_bthsp;
+static gint ett_bthsp_command;
+static gint ett_bthsp_parameters;
static dissector_handle_t bthsp_handle;
@@ -290,12 +291,12 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (!command_number) {
proto_tree_add_item(tree, hf_data, tvb, offset, length, ENC_NA | ENC_ASCII);
- col_str = (char *) wmem_alloc(wmem_packet_scope(), length + 1);
+ col_str = (char *) wmem_alloc(pinfo->pool, length + 1);
tvb_memcpy(tvb, col_str, offset, length);
col_str[length] = '\0';
}
- at_stream = (char *) wmem_alloc(wmem_packet_scope(), length + 1);
+ at_stream = (char *) wmem_alloc(pinfo->pool, length + 1);
tvb_memcpy(tvb, at_stream, offset, length);
at_stream[length] = '\0';
while (at_stream[i_char]) {
@@ -394,9 +395,7 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (i_at_cmd && i_at_cmd->name == NULL) {
char *name;
- name = (char *) wmem_alloc(wmem_packet_scope(), i_char + 2);
- (void) g_strlcpy(name, at_command, i_char + 1);
- name[i_char + 1] = '\0';
+ name = format_text(pinfo->pool, at_command, i_char + 1);
proto_item_append_text(command_item, ": %s (Unknown)", name);
proto_item_append_text(pitem, " (Unknown - Non-Standard HSP Command)");
expert_add_info(pinfo, pitem, &ei_non_mandatory_command);
@@ -825,7 +824,7 @@ dissect_bthsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* Detect reassemble end character: \r for HS or \n for AG */
length = tvb_reported_length(tvb);
- at_stream = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, length, ENC_ASCII);
+ at_stream = tvb_get_string_enc(pinfo->pool, tvb, 0, length, ENC_ASCII);
reassemble_start_offset = 0;
@@ -986,12 +985,11 @@ dissect_bthsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
}
}
} else {
- col_append_fstr(pinfo->cinfo, COL_INFO, "Fragment: %s",
- tvb_format_text_wsp(wmem_packet_scope(), tvb, offset, tvb_captured_length_remaining(tvb, offset)));
pitem = proto_tree_add_item(main_tree, hf_fragmented, tvb, 0, 0, ENC_NA);
proto_item_set_generated(pitem);
- proto_tree_add_item(main_tree, hf_fragment, tvb, offset,
- tvb_captured_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
+ char *display_str;
+ proto_tree_add_item_ret_display_string(main_tree, hf_fragment, tvb, offset, -1, ENC_ASCII, pinfo->pool, &display_str);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Fragment: %s", display_str);
offset = tvb_captured_length(tvb);
}