diff options
Diffstat (limited to 'epan/dissectors/packet-yami.c')
-rw-r--r-- | epan/dissectors/packet-yami.c | 289 |
1 files changed, 155 insertions, 134 deletions
diff --git a/epan/dissectors/packet-yami.c b/epan/dissectors/packet-yami.c index 6381d49cab..ba2dad82e9 100644 --- a/epan/dissectors/packet-yami.c +++ b/epan/dissectors/packet-yami.c @@ -11,9 +11,6 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ - -#define NEW_PROTO_TREE_API - #include "config.h" #include <epan/packet.h> @@ -60,70 +57,33 @@ static const value_string yami_param_type_vals[] = { { 0, NULL } }; -static header_field_info *hfi_yami = NULL; - -#define YAMI_HFI_INIT HFI_INIT(proto_yami) - -/* Header */ -static header_field_info hfi_yami_message_id YAMI_HFI_INIT = - { "Message ID", "yami.message_id", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_yami_frame_number YAMI_HFI_INIT = - { "Frame Number", "yami.frame_number", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_yami_message_header_size YAMI_HFI_INIT = - { "Message Header Size", "yami.message_header_size", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_yami_frame_payload_size YAMI_HFI_INIT = - { "Frame Payload Size", "yami.frame_payload_size", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_yami_message_hdr YAMI_HFI_INIT = - { "Header message", "yami.msg_hdr", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_yami_message_data YAMI_HFI_INIT = - { "Data message", "yami.msg_data", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -/* Parameter */ -static header_field_info hfi_yami_param YAMI_HFI_INIT = - { "Parameter", "yami.param", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_yami_param_name YAMI_HFI_INIT = - { "Name", "yami.param.name", FT_STRING, BASE_NONE, NULL, 0x00, "Parameter name", HFILL }; - -static header_field_info hfi_yami_param_type YAMI_HFI_INIT = - { "Type", "yami.param.type", FT_INT32, BASE_DEC, VALS(yami_param_type_vals), 0x00, "Parameter type", HFILL }; - -static header_field_info hfi_yami_param_value_bool YAMI_HFI_INIT = - { "Value", "yami.param.value_bool", FT_BOOLEAN, BASE_NONE, NULL, 0x00, "Parameter value (bool)", HFILL }; - -static header_field_info hfi_yami_param_value_int YAMI_HFI_INIT = - { "Value", "yami.param.value_int", FT_INT32, BASE_DEC, NULL, 0x00, "Parameter value (int)", HFILL }; - -static header_field_info hfi_yami_param_value_long YAMI_HFI_INIT = - { "Value", "yami.param.value_long", FT_INT64, BASE_DEC, NULL, 0x00, "Parameter value (long)", HFILL }; - -static header_field_info hfi_yami_param_value_double YAMI_HFI_INIT = - { "Value", "yami.param.value_double", FT_DOUBLE, BASE_NONE, NULL, 0x00, "Parameter value (double)", HFILL }; - -static header_field_info hfi_yami_param_value_str YAMI_HFI_INIT = - { "Value", "yami.param.value_str", FT_STRING, BASE_NONE, NULL, 0x00, "Parameter value (string)", HFILL }; - -static header_field_info hfi_yami_param_value_bin YAMI_HFI_INIT = - { "Value", "yami.param.value_bin", FT_BYTES, BASE_NONE, NULL, 0x00, "Parameter value (binary)", HFILL }; - -static header_field_info hfi_yami_params_count YAMI_HFI_INIT = - { "Parameters count", "yami.params_count", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_yami_items_count YAMI_HFI_INIT = - { "Items count", "yami.items_count", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static int ett_yami = -1; -static int ett_yami_msg_hdr = -1; -static int ett_yami_msg_data = -1; -static int ett_yami_param = -1; +static int proto_yami; + +static int hf_yami_frame_number; +static int hf_yami_frame_payload_size; +static int hf_yami_items_count; +static int hf_yami_message_data; +static int hf_yami_message_hdr; +static int hf_yami_message_header_size; +static int hf_yami_message_id; +static int hf_yami_param; +static int hf_yami_param_name; +static int hf_yami_param_type; +static int hf_yami_param_value_bin; +static int hf_yami_param_value_bool; +static int hf_yami_param_value_double; +static int hf_yami_param_value_int; +static int hf_yami_param_value_long; +static int hf_yami_param_value_str; +static int hf_yami_params_count; + +static int ett_yami; +static int ett_yami_msg_hdr; +static int ett_yami_msg_data; +static int ett_yami_param; static int -dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *par_ti) +dissect_yami_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_item *par_ti) { const int orig_offset = offset; @@ -136,21 +96,21 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * guint32 type; - ti = proto_tree_add_item(tree, &hfi_yami_param, tvb, offset, 0, ENC_NA); + ti = proto_tree_add_item(tree, hf_yami_param, tvb, offset, 0, ENC_NA); yami_param = proto_item_add_subtree(ti, ett_yami_param); name_offset = offset; name_len = tvb_get_letohl(tvb, offset); offset += 4; - name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, name_len, ENC_ASCII | ENC_NA); + name = tvb_get_string_enc(pinfo->pool, tvb, offset, name_len, ENC_ASCII | ENC_NA); proto_item_append_text(ti, ": %s", name); proto_item_append_text(par_ti, "%s, ", name); offset += WS_ROUNDUP_4(name_len); - proto_tree_add_string(yami_param, &hfi_yami_param_name, tvb, name_offset, offset - name_offset, name); + proto_tree_add_string(yami_param, hf_yami_param_name, tvb, name_offset, offset - name_offset, name); type = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_param, &hfi_yami_param_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_param_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; switch (type) { @@ -158,7 +118,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * { guint32 val = tvb_get_letohl(tvb, offset); proto_item_append_text(ti, ", Type: boolean, Value: %s", val ? "True" : "False"); - proto_tree_add_item(yami_param, &hfi_yami_param_value_bool, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_param_value_bool, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; break; } @@ -167,7 +127,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * { gint32 val = tvb_get_letohl(tvb, offset); proto_item_append_text(ti, ", Type: integer, Value: %d", val); - proto_tree_add_item(yami_param, &hfi_yami_param_value_int, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_param_value_int, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; break; } @@ -175,8 +135,8 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * case YAMI_TYPE_LONGLONG: { gint64 val = tvb_get_letoh64(tvb, offset); - proto_item_append_text(ti, ", Type: long, Value: %" G_GINT64_MODIFIER "d", val); - proto_tree_add_item(yami_param, &hfi_yami_param_value_long, tvb, offset, 8, ENC_LITTLE_ENDIAN); + proto_item_append_text(ti, ", Type: long, Value: %" PRId64, val); + proto_tree_add_item(yami_param, hf_yami_param_value_long, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; break; } @@ -185,7 +145,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * { gdouble val = tvb_get_letohieee_double(tvb, offset); proto_item_append_text(ti, ", Type: double, Value: %g", val); - proto_tree_add_item(yami_param, &hfi_yami_param_value_double, tvb, offset, 8, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_param_value_double, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; break; } @@ -199,11 +159,11 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * val_len = tvb_get_letohl(tvb, offset); offset += 4; - val = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, val_len, ENC_ASCII | ENC_NA); + val = tvb_get_string_enc(pinfo->pool, tvb, offset, val_len, ENC_ASCII | ENC_NA); proto_item_append_text(ti, ", Type: string, Value: \"%s\"", val); offset += WS_ROUNDUP_4(val_len); - proto_tree_add_string(yami_param, &hfi_yami_param_value_str, tvb, val_offset, offset - val_offset, val); + proto_tree_add_string(yami_param, hf_yami_param_value_str, tvb, val_offset, offset - val_offset, val); break; } @@ -218,11 +178,11 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * offset += 4; val = tvb_get_ptr(tvb, offset, val_len); - repr = bytes_to_str(wmem_packet_scope(), val, val_len); + repr = bytes_to_str(pinfo->pool, val, val_len); proto_item_append_text(ti, ", Type: binary, Value: %s", repr); offset += WS_ROUNDUP_4(val_len); - proto_tree_add_bytes_format_value(yami_param, &hfi_yami_param_value_bin, tvb, val_offset, offset - val_offset, val, "%s", repr); + proto_tree_add_bytes_format_value(yami_param, hf_yami_param_value_bin, tvb, val_offset, offset - val_offset, val, "%s", repr); break; } @@ -233,7 +193,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * int j; count = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_param, &hfi_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_append_text(ti, ", Type: boolean[], %u items: {", count); @@ -245,7 +205,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * int r = !!(val & (1U << j)); proto_item_append_text(ti, "%s, ", r ? "T" : "F"); - proto_tree_add_boolean(yami_param, &hfi_yami_param_value_bool, tvb, offset+(j/8), 1, r); + proto_tree_add_boolean(yami_param, hf_yami_param_value_bool, tvb, offset+(j/8), 1, r); } offset += 4; } @@ -258,7 +218,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * int r = !!(val & (1 << j)); proto_item_append_text(ti, "%s, ", r ? "T" : "F"); - proto_tree_add_boolean(yami_param, &hfi_yami_param_value_bool, tvb, offset+(j/8), 1, r); + proto_tree_add_boolean(yami_param, hf_yami_param_value_bool, tvb, offset+(j/8), 1, r); } offset += 4; } @@ -273,7 +233,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * guint i; count = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_param, &hfi_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_append_text(ti, ", Type: integer[], %u items: {", count); @@ -281,7 +241,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * gint32 val = tvb_get_letohl(tvb, offset); proto_item_append_text(ti, "%d, ", val); - proto_tree_add_item(yami_param, &hfi_yami_param_value_int, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_param_value_int, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; } proto_item_append_text(ti, "}"); @@ -294,7 +254,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * guint i; count = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_param, &hfi_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_append_text(ti, ", Type: long long[], %u items: {", count); @@ -302,8 +262,8 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * for (i = 0; i < count; i++) { gint64 val = tvb_get_letoh64(tvb, offset); - proto_item_append_text(ti, "%" G_GINT64_MODIFIER "d, ", val); - proto_tree_add_item(yami_param, &hfi_yami_param_value_long, tvb, offset, 8, ENC_LITTLE_ENDIAN); + proto_item_append_text(ti, "%" PRId64 ", ", val); + proto_tree_add_item(yami_param, hf_yami_param_value_long, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; } proto_item_append_text(ti, "}"); @@ -316,7 +276,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * guint i; count = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_param, &hfi_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_append_text(ti, ", Type: double[], %u items: {", count); @@ -325,7 +285,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * gdouble val = tvb_get_letohieee_double(tvb, offset); proto_item_append_text(ti, "%g, ", val); - proto_tree_add_item(yami_param, &hfi_yami_param_value_double, tvb, offset, 8, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_param_value_double, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; } proto_item_append_text(ti, "}"); @@ -338,7 +298,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * guint i; count = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_param, &hfi_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_append_text(ti, ", Type: string[], %u items: {", count); @@ -351,10 +311,10 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * val_len = tvb_get_letohl(tvb, offset); offset += 4; - val = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, val_len, ENC_ASCII | ENC_NA); + val = tvb_get_string_enc(pinfo->pool, tvb, offset, val_len, ENC_ASCII | ENC_NA); proto_item_append_text(ti, "\"%s\", ", val); - proto_tree_add_string(yami_param, &hfi_yami_param_value_str, tvb, val_offset, offset - val_offset, val); + proto_tree_add_string(yami_param, hf_yami_param_value_str, tvb, val_offset, offset - val_offset, val); offset += WS_ROUNDUP_4(val_len); } proto_item_append_text(ti, "}"); @@ -367,7 +327,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * guint i; count = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_param, &hfi_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_append_text(ti, ", Type: binary[], %u items: {", count); @@ -382,11 +342,11 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * offset += 4; val = tvb_get_ptr(tvb, offset, val_len); - repr = bytes_to_str(wmem_packet_scope(), val, val_len); + repr = bytes_to_str(pinfo->pool, val, val_len); proto_item_append_text(ti, "%s, ", repr); offset += WS_ROUNDUP_4(val_len); - proto_tree_add_bytes_format_value(yami_param, &hfi_yami_param_value_bin, tvb, val_offset, offset - val_offset, val, "%s", repr); + proto_tree_add_bytes_format_value(yami_param, hf_yami_param_value_bin, tvb, val_offset, offset - val_offset, val, "%s", repr); } proto_item_append_text(ti, "}"); break; @@ -398,13 +358,13 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * guint i; count = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_param, &hfi_yami_params_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_param, hf_yami_params_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_append_text(ti, ", Type: nested, %u parameters: ", count); for (i = 0; i < count; i++) { - offset = dissect_yami_parameter(tvb, yami_param, offset, ti); + offset = dissect_yami_parameter(tvb, pinfo, yami_param, offset, ti); /* smth went wrong */ if (offset == -1) return -1; @@ -422,7 +382,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * } static int -dissect_yami_data(tvbuff_t *tvb, gboolean data, proto_tree *tree, int offset) +dissect_yami_data(tvbuff_t *tvb, packet_info *pinfo, gboolean data, proto_tree *tree, int offset) { const int orig_offset = offset; @@ -432,17 +392,17 @@ dissect_yami_data(tvbuff_t *tvb, gboolean data, proto_tree *tree, int offset) guint32 count; guint i; - ti = proto_tree_add_item(tree, (data) ? &hfi_yami_message_data : &hfi_yami_message_hdr, tvb, offset, 0, ENC_NA); + ti = proto_tree_add_item(tree, (data) ? hf_yami_message_data : hf_yami_message_hdr, tvb, offset, 0, ENC_NA); yami_data_tree = proto_item_add_subtree(ti, (data) ? ett_yami_msg_data : ett_yami_msg_hdr); count = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_data_tree, &hfi_yami_params_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_data_tree, hf_yami_params_count, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_append_text(ti, ", %u parameters: ", count); for (i = 0; i < count; i++) { - offset = dissect_yami_parameter(tvb, yami_data_tree, offset, ti); + offset = dissect_yami_parameter(tvb, pinfo, yami_data_tree, offset, ti); /* smth went wrong */ if (offset == -1) return -1; @@ -468,29 +428,29 @@ dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data col_set_str(pinfo->cinfo, COL_PROTOCOL, "YAMI"); col_clear(pinfo->cinfo, COL_INFO); - ti = proto_tree_add_item(tree, hfi_yami, tvb, 0, -1, ENC_NA); + ti = proto_tree_add_item(tree, proto_yami, tvb, 0, -1, ENC_NA); yami_tree = proto_item_add_subtree(ti, ett_yami); offset = 0; - proto_tree_add_item(yami_tree, &hfi_yami_message_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_tree, hf_yami_message_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; frame_number = tvb_get_letohl(tvb, offset); - ti = proto_tree_add_item(yami_tree, &hfi_yami_frame_number, tvb, offset, 4, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_item(yami_tree, hf_yami_frame_number, tvb, offset, 4, ENC_LITTLE_ENDIAN); if(frame_number < 0) proto_item_append_text(ti, "%s", " (last frame)"); offset += 4; message_header_size = tvb_get_letohl(tvb, offset); - proto_tree_add_item(yami_tree, &hfi_yami_message_header_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(yami_tree, hf_yami_message_header_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); if (message_header_size < 4) { /* XXX, expert info */ } offset += 4; frame_payload_size = tvb_get_letohl(tvb, offset); - ti = proto_tree_add_item(yami_tree, &hfi_yami_frame_payload_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_item(yami_tree, hf_yami_frame_payload_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); frame_size = frame_payload_size + 16; proto_item_append_text(ti, ", (YAMI Frame Size: %d)", frame_size); offset += 4; @@ -499,13 +459,13 @@ dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data if (message_header_size <= frame_payload_size) { const int orig_offset = offset; - offset = dissect_yami_data(tvb, FALSE, yami_tree, offset); + offset = dissect_yami_data(tvb, pinfo, FALSE, yami_tree, offset); if (offset != orig_offset + message_header_size) { /* XXX, expert info */ offset = orig_offset + message_header_size; } - dissect_yami_data(tvb, TRUE, yami_tree, offset); + dissect_yami_data(tvb, pinfo, TRUE, yami_tree, offset); } } @@ -533,29 +493,93 @@ dissect_yami(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) void proto_register_yami(void) { -#ifndef HAVE_HFI_SECTION_INIT - static header_field_info *hfi[] = { - /* Header */ - &hfi_yami_message_id, - &hfi_yami_frame_number, - &hfi_yami_message_header_size, - &hfi_yami_frame_payload_size, - &hfi_yami_message_hdr, - &hfi_yami_message_data, - /* Parameter */ - &hfi_yami_param, - &hfi_yami_param_name, - &hfi_yami_param_type, - &hfi_yami_param_value_bool, - &hfi_yami_param_value_int, - &hfi_yami_param_value_long, - &hfi_yami_param_value_double, - &hfi_yami_param_value_str, - &hfi_yami_param_value_bin, - &hfi_yami_params_count, - &hfi_yami_items_count, + static hf_register_info hf[] = { + { &hf_yami_message_id, + { "Message ID", "yami.message_id", + FT_INT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_yami_frame_number, + { "Frame Number", "yami.frame_number", + FT_INT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_yami_message_header_size, + { "Message Header Size", "yami.message_header_size", + FT_INT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_yami_frame_payload_size, + { "Frame Payload Size", "yami.frame_payload_size", + FT_INT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_yami_message_hdr, + { "Header message", "yami.msg_hdr", + FT_NONE, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_yami_message_data, + { "Data message", "yami.msg_data", + FT_NONE, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_yami_param, + { "Parameter", "yami.param", + FT_NONE, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_yami_param_name, + { "Name", "yami.param.name", + FT_STRING, BASE_NONE, NULL, 0x00, + "Parameter name", HFILL } + }, + { &hf_yami_param_type, + { "Type", "yami.param.type", + FT_INT32, BASE_DEC, VALS(yami_param_type_vals), 0x00, + "Parameter type", HFILL } + }, + { &hf_yami_param_value_bool, + { "Value", "yami.param.value_bool", + FT_BOOLEAN, BASE_NONE, NULL, 0x00, + "Parameter value (bool)", HFILL } + }, + { &hf_yami_param_value_int, + { "Value", "yami.param.value_int", + FT_INT32, BASE_DEC, NULL, 0x00, + "Parameter value (int)", HFILL } + }, + { &hf_yami_param_value_long, + { "Value", "yami.param.value_long", + FT_INT64, BASE_DEC, NULL, 0x00, + "Parameter value (long)", HFILL } + }, + { &hf_yami_param_value_double, + { "Value", "yami.param.value_double", + FT_DOUBLE, BASE_NONE, NULL, 0x00, + "Parameter value (double)", HFILL } + }, + { &hf_yami_param_value_str, + { "Value", "yami.param.value_str", + FT_STRING, BASE_NONE, NULL, 0x00, + "Parameter value (string)", HFILL } + }, + { &hf_yami_param_value_bin, + { "Value", "yami.param.value_bin", + FT_BYTES, BASE_NONE, NULL, 0x00, + "Parameter value (binary)", HFILL } + }, + { &hf_yami_params_count, + { "Parameters count", "yami.params_count", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_yami_items_count, + { "Items count", "yami.items_count", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, }; -#endif static gint *ett[] = { &ett_yami, @@ -566,12 +590,9 @@ proto_register_yami(void) module_t *yami_module; - int proto_yami; - proto_yami = proto_register_protocol("YAMI Protocol", "YAMI", "yami"); - hfi_yami = proto_registrar_get_nth(proto_yami); - proto_register_fields(proto_yami, hfi, array_length(hfi)); + proto_register_field_array(proto_yami, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); yami_module = prefs_register_protocol(proto_yami, NULL); @@ -581,7 +602,7 @@ proto_register_yami(void) "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &yami_desegment); - yami_handle = create_dissector_handle(dissect_yami, proto_yami); + yami_handle = register_dissector("yami", dissect_yami, proto_yami); } void |