From f6fb1c387faf6fde6b495a660e8c8fc9ba06aced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Thu, 9 Dec 2021 10:43:11 +0000 Subject: [PATCH] Gadu-Gadu: Convert to old proto tree API Related with #17774. --- epan/dissectors/packet-gadu-gadu.c | 957 ++++++++++++++++------------- 1 file changed, 517 insertions(+), 440 deletions(-) diff --git a/epan/dissectors/packet-gadu-gadu.c b/epan/dissectors/packet-gadu-gadu.c index 0e88346656..ae129d9d38 100644 --- a/epan/dissectors/packet-gadu-gadu.c +++ b/epan/dissectors/packet-gadu-gadu.c @@ -10,9 +10,6 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ - -#define NEW_PROTO_TREE_API - #include "config.h" #include @@ -29,6 +26,69 @@ static gboolean gadu_gadu_desegment = TRUE; static dissector_handle_t gadu_gadu_handle; +static int proto_gadu_gadu = -1; + +static int hf_dcc_filename = -1; +static int hf_dcc_id = -1; +static int hf_dcc_type = -1; +static int hf_dcc_uin_from = -1; +static int hf_dcc_uin_to = -1; +static int hf_gadu_gadu_contact_type = -1; +static int hf_gadu_gadu_contact_uin = -1; +static int hf_gadu_gadu_contact_uin_str = -1; +static int hf_gadu_gadu_data = -1; +static int hf_gadu_gadu_header_length = -1; +static int hf_gadu_gadu_header_type_recv = -1; +static int hf_gadu_gadu_header_type_send = -1; +static int hf_gadu_gadu_login80_lang = -1; +static int hf_gadu_gadu_login_hash = -1; +static int hf_gadu_gadu_login_hash_type = -1; +static int hf_gadu_gadu_login_local_ip = -1; +static int hf_gadu_gadu_login_local_port = -1; +static int hf_gadu_gadu_login_protocol = -1; +static int hf_gadu_gadu_login_status = -1; +static int hf_gadu_gadu_login_uin = -1; +static int hf_gadu_gadu_login_version = -1; +static int hf_gadu_gadu_msg80_offset_attr = -1; +static int hf_gadu_gadu_msg80_offset_plain = -1; +static int hf_gadu_gadu_msg_ack_recipient = -1; +static int hf_gadu_gadu_msg_ack_seq = -1; +static int hf_gadu_gadu_msg_ack_status = -1; +static int hf_gadu_gadu_msg_class = -1; +static int hf_gadu_gadu_msg_recipient = -1; +static int hf_gadu_gadu_msg_sender = -1; +static int hf_gadu_gadu_msg_seq = -1; +static int hf_gadu_gadu_msg_text = -1; +static int hf_gadu_gadu_msg_time = -1; +static int hf_gadu_gadu_msg_uin = -1; +static int hf_gadu_gadu_new_status_desc = -1; +static int hf_gadu_gadu_new_status_status = -1; +static int hf_gadu_gadu_pubdir_reply_seq = -1; +static int hf_gadu_gadu_pubdir_reply_str = -1; +static int hf_gadu_gadu_pubdir_reply_type = -1; +static int hf_gadu_gadu_pubdir_request_seq = -1; +static int hf_gadu_gadu_pubdir_request_str = -1; +static int hf_gadu_gadu_pubdir_request_type = -1; +static int hf_gadu_gadu_status_descr = -1; +static int hf_gadu_gadu_status_img_size = -1; +static int hf_gadu_gadu_status_ip = -1; +static int hf_gadu_gadu_status_port = -1; +static int hf_gadu_gadu_status_status = -1; +static int hf_gadu_gadu_status_uin = -1; +static int hf_gadu_gadu_status_version = -1; +static int hf_gadu_gadu_typing_notify_type = -1; +static int hf_gadu_gadu_typing_notify_uin = -1; +static int hf_gadu_gadu_userdata_attr_name = -1; +static int hf_gadu_gadu_userdata_attr_type = -1; +static int hf_gadu_gadu_userdata_attr_value = -1; +static int hf_gadu_gadu_userdata_uin = -1; +static int hf_gadu_gadu_userlist = -1; +static int hf_gadu_gadu_userlist_format = -1; +static int hf_gadu_gadu_userlist_reply_type = -1; +static int hf_gadu_gadu_userlist_request_type = -1; +static int hf_gadu_gadu_userlist_version = -1; +static int hf_gadu_gadu_welcome_seed = -1; + static int ett_gadu_gadu = -1; static int ett_gadu_gadu_contact = -1; @@ -321,208 +381,6 @@ static const value_string gadu_gadu_pubdir_type_vals[] = { { 0, NULL } }; -static header_field_info *hfi_gadu_gadu = NULL; - -#define GADU_GADU_HFI_INIT HFI_INIT(proto_gadu_gadu) - -/* Header */ -static header_field_info hfi_gadu_gadu_header_type_recv GADU_GADU_HFI_INIT = - { "Packet Type", "gadu-gadu.recv", FT_UINT32, BASE_HEX, VALS(gadu_gadu_packets_type_recv), 0x0, "Packet Type (recv)", HFILL }; - -static header_field_info hfi_gadu_gadu_header_type_send GADU_GADU_HFI_INIT = - { "Packet Type", "gadu-gadu.send", FT_UINT32, BASE_HEX, VALS(gadu_gadu_packets_type_send), 0x0, "Packet Type (send)", HFILL }; - -static header_field_info hfi_gadu_gadu_header_length GADU_GADU_HFI_INIT = - { "Packet Length", "gadu-gadu.len", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }; - -/* Login common (gadu-gadu.login.*) */ -static header_field_info hfi_gadu_gadu_login_uin GADU_GADU_HFI_INIT = - { "Client UIN", "gadu-gadu.login.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_login_hash_type GADU_GADU_HFI_INIT = - { "Login hash type", "gadu-gadu.login.hash_type", FT_UINT8, BASE_HEX, VALS(gadu_gadu_hash_type_vals), 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_login_hash GADU_GADU_HFI_INIT = - { "Login hash", "gadu-gadu.login.hash", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_login_status GADU_GADU_HFI_INIT = - { "Client status", "gadu-gadu.login.status", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_login_protocol GADU_GADU_HFI_INIT = - { "Client protocol", "gadu-gadu.login.protocol", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_login_version GADU_GADU_HFI_INIT = - { "Client version", "gadu-gadu.login.version", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_login_local_ip GADU_GADU_HFI_INIT = - { "Client local IP", "gadu-gadu.login.local_ip", FT_IPv4, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_login_local_port GADU_GADU_HFI_INIT = - { "Client local port", "gadu-gadu.login.local_port", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -/* GG_LOGIN80 (gadu-gadu.login80.*) */ -static header_field_info hfi_gadu_gadu_login80_lang GADU_GADU_HFI_INIT = - { "Client language", "gadu-gadu.login80.lang", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -/* Contacts details (gadu-gadu.user_data.*) */ -static header_field_info hfi_gadu_gadu_userdata_uin GADU_GADU_HFI_INIT = - { "UIN", "gadu-gadu.user_data.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_userdata_attr_name GADU_GADU_HFI_INIT = - { "Attribute name", "gadu-gadu.user_data.attr_name", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_userdata_attr_type GADU_GADU_HFI_INIT = - { "Attribute type", "gadu-gadu.user_data.attr_type", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_userdata_attr_value GADU_GADU_HFI_INIT = - { "Attribute value", "gadu-gadu.user_data.attr_val", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -/* Typing notify (gadu-gadu.typing_notify.*) */ -static header_field_info hfi_gadu_gadu_typing_notify_type GADU_GADU_HFI_INIT = - { "Typing notify type", "gadu-gadu.typing_notify.type", FT_UINT16, BASE_HEX, VALS(gadu_gadu_typing_notify_type_vals), 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_typing_notify_uin GADU_GADU_HFI_INIT = - { "Typing notify recipient", "gadu-gadu.typing_notify.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -/* Message common (gadu-gadu.msg.*) */ -static header_field_info hfi_gadu_gadu_msg_uin GADU_GADU_HFI_INIT = - { "Message sender or recipient", "gadu-gadu.msg.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_msg_sender GADU_GADU_HFI_INIT = - { "Message sender", "gadu-gadu.msg.sender", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_msg_recipient GADU_GADU_HFI_INIT = - { "Message recipient", "gadu-gadu.msg.recipient", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_msg_seq GADU_GADU_HFI_INIT = - { "Message sequence number", "gadu-gadu.msg.seq", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_msg_time GADU_GADU_HFI_INIT = - { "Message time", "gadu-gadu.msg.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_msg_class GADU_GADU_HFI_INIT = - { "Message class", "gadu-gadu.msg.class", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_msg_text GADU_GADU_HFI_INIT = - { "Message text", "gadu-gadu.msg.text", FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL }; - -/* GG_RECV_MSG80, GG_SEND_MSG80 (gadu-gadu.msg80.*) */ -static header_field_info hfi_gadu_gadu_msg80_offset_plain GADU_GADU_HFI_INIT = - { "Message plaintext offset", "gadu-gadu.msg80.offset_plain", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_msg80_offset_attr GADU_GADU_HFI_INIT = - { "Message attribute offset", "gadu-gadu.msg80.offset_attributes", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -/* GG_SEND_MSG_ACK (gadu-gadu.msg_ack.*) */ -static header_field_info hfi_gadu_gadu_msg_ack_status GADU_GADU_HFI_INIT = - { "Message status", "gadu-gadu.msg_ack.status", FT_UINT32, BASE_HEX, VALS(gadu_gadu_msg_ack_status_vals), 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_msg_ack_recipient GADU_GADU_HFI_INIT = - { "Message recipient", "gadu-gadu.msg_ack.recipient", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_msg_ack_seq GADU_GADU_HFI_INIT = - { "Message sequence number", "gadu-gadu.msg_ack.seq", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -/* Status common (gadu-gadu.status.*) */ -static header_field_info hfi_gadu_gadu_status_uin GADU_GADU_HFI_INIT = - { "UIN", "gadu-gadu.status.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_status_status GADU_GADU_HFI_INIT = - { "Status", "gadu-gadu.status.status", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_status_ip GADU_GADU_HFI_INIT = - { "IP", "gadu-gadu.status.remote_ip", FT_IPv4, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_status_port GADU_GADU_HFI_INIT = - { "Port", "gadu-gadu.status.remote_port", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_status_version GADU_GADU_HFI_INIT = - { "Version", "gadu-gadu.status.version", FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_status_img_size GADU_GADU_HFI_INIT = - { "Image size", "gadu-gadu.status.image_size", FT_UINT8, BASE_DEC, NULL, 0x00, "Maximum image size in KB", HFILL }; - -static header_field_info hfi_gadu_gadu_status_descr GADU_GADU_HFI_INIT = - { "Description", "gadu-gadu.status.description", FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -/* Direct Connection (gadu-gadu.dcc.*) */ -static header_field_info hfi_dcc_type GADU_GADU_HFI_INIT = - { "Direct connection type", "gadu-gadu.dcc.type", FT_UINT32, BASE_HEX, VALS(gadu_gadu_dcc_type_vals), 0x00, NULL, HFILL }; - -static header_field_info hfi_dcc_id GADU_GADU_HFI_INIT = - { "Direct connection id", "gadu-gadu.dcc.id", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_dcc_uin_to GADU_GADU_HFI_INIT = - { "Direct connection UIN target", "gadu-gadu.dcc.uin_to", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_dcc_uin_from GADU_GADU_HFI_INIT = - { "Direct connection UIN initiator", "gadu-gadu.dcc.uin_from", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_dcc_filename GADU_GADU_HFI_INIT = - { "Direct connection filename", "gadu-gadu.dcc.filename", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -/* New status (setting status) common (gadu-gadu.new_status.*) */ -static header_field_info hfi_gadu_gadu_new_status_status GADU_GADU_HFI_INIT = - { "Status", "gadu-gadu.new_status.status", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_new_status_desc GADU_GADU_HFI_INIT = - { "Description", "gadu-gadu.new_status.description", FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -/* Userlist (gadu-gadu.userlist.*) */ -static header_field_info hfi_gadu_gadu_userlist_request_type GADU_GADU_HFI_INIT = - { "Request type", "gadu-gadu.userlist.request_type", FT_UINT32, BASE_HEX, VALS(gadu_gadu_userlist_request_type_vals), 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_userlist_version GADU_GADU_HFI_INIT = - { "Userlist version", "gadu-gadu.userlist.version", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_userlist_format GADU_GADU_HFI_INIT = - { "Userlist format", "gadu-gadu.userlist.format", FT_UINT8, BASE_HEX, VALS(gadu_gadu_userlist_request_format_vals), 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_userlist_reply_type GADU_GADU_HFI_INIT = - { "Reply type", "gadu-gadu.userlist.reply_type", FT_UINT32, BASE_HEX, VALS(gadu_gadu_userlist_reply_type_vals), 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_userlist GADU_GADU_HFI_INIT = - { "Userlist XML data", "gadu-gadu.userlist", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }; - - -/* Public Directory (gadu-gadu.pubdir.*) */ -static header_field_info hfi_gadu_gadu_pubdir_request_type GADU_GADU_HFI_INIT = - { "Request type", "gadu-gadu.pubdir.request_type", FT_UINT8, BASE_HEX, VALS(gadu_gadu_pubdir_type_vals), 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_pubdir_request_seq GADU_GADU_HFI_INIT = - { "Request sequence", "gadu-gadu.pubdir.request_seq", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_pubdir_request_str GADU_GADU_HFI_INIT = - { "Request string", "gadu-gadu.pubdir.request_str", FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_pubdir_reply_type GADU_GADU_HFI_INIT = - { "Reply type", "gadu-gadu.pubdir.reply_type", FT_UINT8, BASE_HEX, VALS(gadu_gadu_pubdir_type_vals), 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_pubdir_reply_seq GADU_GADU_HFI_INIT = - { "Reply sequence", "gadu-gadu.pubdir.reply_seq", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_pubdir_reply_str GADU_GADU_HFI_INIT = - { "Reply string", "gadu-gadu.pubdir.request_str", FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -/* Contact (notify) common (gadu-gadu.contact.*) */ -static header_field_info hfi_gadu_gadu_contact_uin GADU_GADU_HFI_INIT = - { "UIN", "gadu-gadu.contact.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_contact_uin_str GADU_GADU_HFI_INIT = - { "UIN", "gadu-gadu.contact.uin_str", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }; - -static header_field_info hfi_gadu_gadu_contact_type GADU_GADU_HFI_INIT = - { "Type", "gadu-gadu.contact.type", FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }; - -/* GG_WELCOME */ -static header_field_info hfi_gadu_gadu_welcome_seed GADU_GADU_HFI_INIT = - { "Seed", "gadu-gadu.welcome.seed", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }; - -/* Not dissected data */ -static header_field_info hfi_gadu_gadu_data GADU_GADU_HFI_INIT = - { "Packet Data", "gadu-gadu.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }; - - static dissector_handle_t xml_handle; struct gadu_gadu_conv_data { @@ -536,12 +394,12 @@ gadu_gadu_create_conversation(packet_info *pinfo, guint32 uin) struct gadu_gadu_conv_data *gg_conv; conv = find_or_create_conversation(pinfo); - gg_conv = (struct gadu_gadu_conv_data *)conversation_get_proto_data(conv, hfi_gadu_gadu->id); + gg_conv = (struct gadu_gadu_conv_data *)conversation_get_proto_data(conv, proto_gadu_gadu); if (!gg_conv) { gg_conv = wmem_new(wmem_file_scope(), struct gadu_gadu_conv_data); gg_conv->uin = uin; - conversation_add_proto_data(conv, hfi_gadu_gadu->id, gg_conv); + conversation_add_proto_data(conv, proto_gadu_gadu, gg_conv); } /* assert(gg_conv->uin == uin); */ return gg_conv; @@ -554,7 +412,7 @@ gadu_gadu_get_conversation_data(packet_info *pinfo) conv = find_conversation_pinfo(pinfo, 0); if (conv) - return (struct gadu_gadu_conv_data *)conversation_get_proto_data(conv, hfi_gadu_gadu->id); + return (struct gadu_gadu_conv_data *)conversation_get_proto_data(conv, proto_gadu_gadu); return NULL; } @@ -584,17 +442,17 @@ gadu_gadu_strsize(tvbuff_t *tvb, const gint abs_offset) } static int -dissect_gadu_gadu_stringz_cp1250(tvbuff_t *tvb, header_field_info *hfi, proto_tree *tree, const int offset) +dissect_gadu_gadu_stringz_cp1250(tvbuff_t *tvb, int hfindex, proto_tree *tree, const int offset) { int len = gadu_gadu_strsize(tvb, offset); - proto_tree_add_item(tree, hfi, tvb, offset, len, ENC_WINDOWS_1250 | ENC_NA); + proto_tree_add_item(tree, hfindex, tvb, offset, len, ENC_WINDOWS_1250 | ENC_NA); return offset + len; } static int -dissect_gadu_gadu_uint32_string_utf8(tvbuff_t *tvb, header_field_info *hfi, proto_tree *tree, int offset) +dissect_gadu_gadu_uint32_string_utf8(tvbuff_t *tvb, int hfindex, proto_tree *tree, int offset) { const int org_offset = offset; @@ -605,7 +463,7 @@ dissect_gadu_gadu_uint32_string_utf8(tvbuff_t *tvb, header_field_info *hfi, prot offset += len; - proto_tree_add_item(tree, hfi, tvb, org_offset, offset - org_offset, ENC_UTF_8 | ENC_NA); + proto_tree_add_item(tree, hfindex, tvb, org_offset, offset - org_offset, ENC_UTF_8 | ENC_NA); return offset; } @@ -653,8 +511,8 @@ dissect_gadu_gadu_login_protocol(tvbuff_t *tvb, proto_tree *tree, int offset) guint32 protocol; protocol = tvb_get_letohl(tvb, offset) & 0xff; - proto_tree_add_item(tree, &hfi_gadu_gadu_login_protocol, tvb, offset, 4, ENC_LITTLE_ENDIAN); - ti = proto_tree_add_string(tree, &hfi_gadu_gadu_login_version, tvb, offset, 4, val_to_str(protocol, gadu_gadu_version_vals, "Unknown (0x%x)")); + proto_tree_add_item(tree, hf_gadu_gadu_login_protocol, tvb, offset, 4, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_string(tree, hf_gadu_gadu_login_version, tvb, offset, 4, val_to_str(protocol, gadu_gadu_version_vals, "Unknown (0x%x)")); proto_item_set_generated(ti); offset += 4; @@ -674,26 +532,26 @@ dissect_gadu_gadu_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int uin = tvb_get_letohl(tvb, offset); gadu_gadu_create_conversation(pinfo, uin); - proto_tree_add_uint(tree, &hfi_gadu_gadu_login_uin, tvb, offset, 4, uin); + proto_tree_add_uint(tree, hf_gadu_gadu_login_uin, tvb, offset, 4, uin); offset += 4; - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_login_hash_type, tvb, 0, 0, GG_LOGIN_HASH_GG32); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_login_hash_type, tvb, 0, 0, GG_LOGIN_HASH_GG32); proto_item_set_generated(ti); /* hash is 32-bit number written in LE */ _tvb_memcpy_reverse(tvb, hash, offset, 4); - proto_tree_add_bytes_format_value(tree, &hfi_gadu_gadu_login_hash, tvb, offset, 4, hash, "0x%.8x", tvb_get_letohl(tvb, offset)); + proto_tree_add_bytes_format_value(tree, hf_gadu_gadu_login_hash, tvb, offset, 4, hash, "0x%.8x", tvb_get_letohl(tvb, offset)); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_login_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_login_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; offset = dissect_gadu_gadu_login_protocol(tvb, tree, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_login_local_ip, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_login_local_ip, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_login_local_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_login_local_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; return offset; @@ -708,34 +566,34 @@ dissect_gadu_gadu_login_hash(tvbuff_t *tvb, proto_tree *tree, int offset) int i; hash_type = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_login_hash_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_login_hash_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; switch (hash_type) { case GG_LOGIN_HASH_GG32: /* hash is 32-bit number written in LE */ _tvb_memcpy_reverse(tvb, hash, offset, 4); - proto_tree_add_bytes_format_value(tree, &hfi_gadu_gadu_login_hash, tvb, offset, 4, hash, "0x%.8x", tvb_get_letohl(tvb, offset)); + proto_tree_add_bytes_format_value(tree, hf_gadu_gadu_login_hash, tvb, offset, 4, hash, "0x%.8x", tvb_get_letohl(tvb, offset)); for (i = 4; i < 64; i++) { if (tvb_get_guint8(tvb, offset+i)) { - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset + 4, 64-4, ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset + 4, 64-4, ENC_NA); break; } } break; case GG_LOGIN_HASH_SHA1: - proto_tree_add_item(tree, &hfi_gadu_gadu_login_hash, tvb, offset, 20, ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_login_hash, tvb, offset, 20, ENC_NA); for (i = 20; i < 64; i++) { if (tvb_get_guint8(tvb, offset+i)) { - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset + 20, 64-20, ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset + 20, 64-20, ENC_NA); break; } } break; default: - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 64, ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 64, ENC_NA); break; } offset += 64; @@ -753,23 +611,23 @@ dissect_gadu_gadu_login70(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i uin = tvb_get_letohl(tvb, offset) & ~(GG_ERA_OMNIX_MASK | GG_HAS_AUDIO_MASK); gadu_gadu_create_conversation(pinfo, uin); - proto_tree_add_uint(tree, &hfi_gadu_gadu_login_uin, tvb, offset, 4, uin); + proto_tree_add_uint(tree, hf_gadu_gadu_login_uin, tvb, offset, 4, uin); offset += 4; offset = dissect_gadu_gadu_login_hash(tvb, tree, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_login_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_login_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; offset = dissect_gadu_gadu_login_protocol(tvb, tree, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 00 */ + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 00 */ offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_login_local_ip, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_login_local_ip, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_login_local_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_login_local_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* XXX packet not fully dissected */ @@ -787,15 +645,15 @@ dissect_gadu_gadu_login80(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i uin = tvb_get_letohl(tvb, offset); gadu_gadu_create_conversation(pinfo, uin); - proto_tree_add_item(tree, &hfi_gadu_gadu_login_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_login_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_login80_lang, tvb, offset, 2, ENC_ASCII | ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_login80_lang, tvb, offset, 2, ENC_ASCII | ENC_NA); offset += 2; offset = dissect_gadu_gadu_login_hash(tvb, tree, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_login_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_login_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; /* XXX packet not fully dissected */ @@ -828,7 +686,7 @@ dissect_gadu_gadu_login_ok80(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree { col_set_str(pinfo->cinfo, COL_INFO, "Login success (8.0)"); - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 4, ENC_NA); /* 01 00 00 00 */ + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 4, ENC_NA); /* 01 00 00 00 */ offset += 4; return offset; @@ -839,7 +697,7 @@ dissect_gadu_gadu_login80_failed(tvbuff_t *tvb, packet_info *pinfo, proto_tree * { col_set_str(pinfo->cinfo, COL_INFO, "Login fail (8.0)"); - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 4, ENC_NA); /* 01 00 00 00 */ + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 4, ENC_NA); /* 01 00 00 00 */ offset += 4; return offset; @@ -862,7 +720,7 @@ dissect_gadu_gadu_user_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, while (users_num--) { guint32 attr_num; - proto_tree_add_item(tree, &hfi_gadu_gadu_userdata_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userdata_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; attr_num = tvb_get_letohl(tvb, offset); @@ -876,17 +734,17 @@ dissect_gadu_gadu_user_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 4; name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, name_size, ENC_ASCII | ENC_NA); - proto_tree_add_string(tree, &hfi_gadu_gadu_userdata_attr_name, tvb, offset - 4, 4 + name_size, name); + proto_tree_add_string(tree, hf_gadu_gadu_userdata_attr_name, tvb, offset - 4, 4 + name_size, name); offset += name_size; /* type */ - proto_tree_add_item(tree, &hfi_gadu_gadu_userdata_attr_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userdata_attr_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; /* value */ val_size = tvb_get_letohl(tvb, offset); offset += 4; val = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, val_size, ENC_ASCII | ENC_NA); - proto_tree_add_string(tree, &hfi_gadu_gadu_userdata_attr_value, tvb, offset - 4, 4 + val_size, val); + proto_tree_add_string(tree, hf_gadu_gadu_userdata_attr_value, tvb, offset - 4, 4 + val_size, val); offset += val_size; } } @@ -900,10 +758,10 @@ dissect_gadu_gadu_typing_notify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t col_set_str(pinfo->cinfo, COL_INFO, "Typing notify"); /* XXX, when type > 1, it's length not type ! */ - proto_tree_add_item(tree, &hfi_gadu_gadu_typing_notify_type, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_typing_notify_type, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_item(tree, &hfi_gadu_gadu_typing_notify_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_typing_notify_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; return offset; @@ -926,29 +784,29 @@ dissect_gadu_gadu_recv_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_set_str(pinfo->cinfo, COL_INFO, "Receive message (< 8.0)"); if ((conv = gadu_gadu_get_conversation_data(pinfo))) { - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_recipient, tvb, 0, 0, conv->uin); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_msg_recipient, tvb, 0, 0, conv->uin); proto_item_set_generated(ti); - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin); proto_item_set_generated(ti); proto_item_set_hidden(ti); } - ti = proto_tree_add_item(tree, &hfi_gadu_gadu_msg_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_item(tree, hf_gadu_gadu_msg_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); proto_item_set_hidden(ti); - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_sender, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_sender, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_time, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_time, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - offset = dissect_gadu_gadu_stringz_cp1250(tvb, &hfi_gadu_gadu_msg_text, tree, offset); + offset = dissect_gadu_gadu_stringz_cp1250(tvb, hf_gadu_gadu_msg_text, tree, offset); offset = dissect_gadu_gadu_msg_attr(tvb, tree, offset); @@ -963,30 +821,30 @@ dissect_gadu_gadu_send_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_set_str(pinfo->cinfo, COL_INFO, "Send message (< 8.0)"); - ti = proto_tree_add_item(tree, &hfi_gadu_gadu_msg_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_item(tree, hf_gadu_gadu_msg_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); proto_item_set_hidden(ti); - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_recipient, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_recipient, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; if ((conv = gadu_gadu_get_conversation_data(pinfo))) { - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_sender, tvb, 0, 0, conv->uin); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_msg_sender, tvb, 0, 0, conv->uin); proto_item_set_generated(ti); - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin); proto_item_set_generated(ti); proto_item_set_hidden(ti); } - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - ti = proto_tree_add_time(tree, &hfi_gadu_gadu_msg_time, tvb, 0, 0, &(pinfo->abs_ts)); + ti = proto_tree_add_time(tree, hf_gadu_gadu_msg_time, tvb, 0, 0, &(pinfo->abs_ts)); proto_item_set_generated(ti); - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - offset = dissect_gadu_gadu_stringz_cp1250(tvb, &hfi_gadu_gadu_msg_text, tree, offset); + offset = dissect_gadu_gadu_stringz_cp1250(tvb, hf_gadu_gadu_msg_text, tree, offset); offset = dissect_gadu_gadu_msg_attr(tvb, tree, offset); @@ -1002,32 +860,32 @@ dissect_gadu_gadu_recv_msg80(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree col_set_str(pinfo->cinfo, COL_INFO, "Receive message (8.0)"); if ((conv = gadu_gadu_get_conversation_data(pinfo))) { - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_recipient, tvb, 0, 0, conv->uin); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_msg_recipient, tvb, 0, 0, conv->uin); proto_item_set_generated(ti); - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin); proto_item_set_generated(ti); proto_item_set_hidden(ti); } - ti = proto_tree_add_item(tree, &hfi_gadu_gadu_msg_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_item(tree, hf_gadu_gadu_msg_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); proto_item_set_hidden(ti); - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_sender, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_sender, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_time, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_time, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg80_offset_plain, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg80_offset_plain, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg80_offset_attr, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg80_offset_attr, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; /* XXX packet not fully dissected */ @@ -1043,33 +901,33 @@ dissect_gadu_gadu_send_msg80(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree col_set_str(pinfo->cinfo, COL_INFO, "Send message (8.0)"); - ti = proto_tree_add_item(tree, &hfi_gadu_gadu_msg_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_item(tree, hf_gadu_gadu_msg_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); proto_item_set_hidden(ti); - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_recipient, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_recipient, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; if ((conv = gadu_gadu_get_conversation_data(pinfo))) { - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_sender, tvb, 0, 0, conv->uin); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_msg_sender, tvb, 0, 0, conv->uin); proto_item_set_generated(ti); - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin); proto_item_set_generated(ti); proto_item_set_hidden(ti); } - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - ti = proto_tree_add_time(tree, &hfi_gadu_gadu_msg_time, tvb, 0, 0, &(pinfo->abs_ts)); + ti = proto_tree_add_time(tree, hf_gadu_gadu_msg_time, tvb, 0, 0, &(pinfo->abs_ts)); proto_item_set_generated(ti); - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg80_offset_plain, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg80_offset_plain, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg80_offset_attr, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg80_offset_attr, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; /* XXX packet not fully dissected */ @@ -1082,13 +940,13 @@ dissect_gadu_gadu_send_msg_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr { col_set_str(pinfo->cinfo, COL_INFO, "Message acknowledge (server)"); - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_ack_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_ack_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_ack_recipient, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_ack_recipient, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_ack_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_ack_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; return offset; @@ -1099,7 +957,7 @@ dissect_gadu_gadu_recv_msg_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr { col_set_str(pinfo->cinfo, COL_INFO, "Message acknowledge (client)"); - proto_tree_add_item(tree, &hfi_gadu_gadu_msg_ack_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_msg_ack_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; return offset; @@ -1114,30 +972,30 @@ dissect_gadu_gadu_status60(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_set_str(pinfo->cinfo, COL_INFO, "Receive status (6.0)"); uin = tvb_get_letohl(tvb, offset) & ~(GG_ERA_OMNIX_MASK | GG_HAS_AUDIO_MASK); - proto_tree_add_uint(tree, &hfi_gadu_gadu_status_uin, tvb, offset, 4, uin); + proto_tree_add_uint(tree, hf_gadu_gadu_status_uin, tvb, offset, 4, uin); offset += 4; status = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_status_status, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_status, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_ip, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_ip, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_version, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_version, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_img_size, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_img_size, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 00 */ + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 00 */ offset += 1; if (gadu_gadu_status_has_descr(status)) - offset = dissect_gadu_gadu_stringz_cp1250(tvb, &hfi_gadu_gadu_status_descr, tree, offset); + offset = dissect_gadu_gadu_stringz_cp1250(tvb, hf_gadu_gadu_status_descr, tree, offset); return offset; } @@ -1151,33 +1009,33 @@ dissect_gadu_gadu_status77(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_set_str(pinfo->cinfo, COL_INFO, "Receive status (7.7)"); uin = tvb_get_letohl(tvb, offset) & ~(GG_ERA_OMNIX_MASK | GG_HAS_AUDIO_MASK); - proto_tree_add_uint(tree, &hfi_gadu_gadu_status_uin, tvb, offset, 4, uin); + proto_tree_add_uint(tree, hf_gadu_gadu_status_uin, tvb, offset, 4, uin); offset += 4; status = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_status_status, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_status, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_ip, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_ip, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_version, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_version, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_img_size, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_img_size, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 00 */ + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 00 */ offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 4, ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 4, ENC_NA); offset += 4; if (gadu_gadu_status_has_descr(status)) - offset = dissect_gadu_gadu_stringz_cp1250(tvb, &hfi_gadu_gadu_status_descr, tree, offset); + offset = dissect_gadu_gadu_stringz_cp1250(tvb, hf_gadu_gadu_status_descr, tree, offset); return offset; } @@ -1187,31 +1045,31 @@ dissect_gadu_gadu_status80(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { col_set_str(pinfo->cinfo, COL_INFO, "Receive status (8.0)"); - proto_tree_add_item(tree, &hfi_gadu_gadu_status_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 4, ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 4, ENC_NA); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_ip, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_ip, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_item(tree, &hfi_gadu_gadu_status_img_size, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_status_img_size, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 1, ENC_NA); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 4, ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 4, ENC_NA); offset += 4; - offset = dissect_gadu_gadu_uint32_string_utf8(tvb, &hfi_gadu_gadu_status_descr, tree, offset); + offset = dissect_gadu_gadu_uint32_string_utf8(tvb, hf_gadu_gadu_status_descr, tree, offset); return offset; } @@ -1234,11 +1092,11 @@ dissect_gadu_gadu_new_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree col_set_str(pinfo->cinfo, COL_INFO, "New status (< 8.0)"); status = tvb_get_letohl(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_new_status_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_new_status_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; if (gadu_gadu_status_has_descr(status & 0xff)) - offset = dissect_gadu_gadu_stringz_cp1250(tvb, &hfi_gadu_gadu_status_descr, tree, offset); + offset = dissect_gadu_gadu_stringz_cp1250(tvb, hf_gadu_gadu_status_descr, tree, offset); return offset; } @@ -1248,13 +1106,13 @@ dissect_gadu_gadu_new_status80(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr { col_set_str(pinfo->cinfo, COL_INFO, "New status (8.0)"); - proto_tree_add_item(tree, &hfi_gadu_gadu_new_status_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_new_status_status, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 4, ENC_NA); + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 4, ENC_NA); offset += 4; - offset = dissect_gadu_gadu_uint32_string_utf8(tvb, &hfi_gadu_gadu_new_status_desc, tree, offset); + offset = dissect_gadu_gadu_uint32_string_utf8(tvb, hf_gadu_gadu_new_status_desc, tree, offset); return offset; } @@ -1274,10 +1132,10 @@ dissect_gadu_gadu_add_notify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree { col_set_str(pinfo->cinfo, COL_INFO, "Notify list add"); - proto_tree_add_item(tree, &hfi_gadu_gadu_contact_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_contact_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_contact_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_contact_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; return offset; @@ -1289,18 +1147,18 @@ dissect_gadu_gadu_notify105_common(tvbuff_t *tvb, proto_tree *tree, int offset, guint16 uin_len; char *uin; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* unknown 00 */ + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* unknown 00 */ offset += 1; uin_len = tvb_get_guint8(tvb, offset); offset += 1; uin = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, uin_len, ENC_ASCII | ENC_NA); - proto_tree_add_string(tree, &hfi_gadu_gadu_contact_uin_str, tvb, offset - 1, 1 + uin_len, uin); + proto_tree_add_string(tree, hf_gadu_gadu_contact_uin_str, tvb, offset - 1, 1 + uin_len, uin); offset += uin_len; if (puin) *puin = uin; - proto_tree_add_item(tree, &hfi_gadu_gadu_contact_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_contact_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; return offset; @@ -1319,10 +1177,10 @@ dissect_gadu_gadu_remove_notify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t { col_set_str(pinfo->cinfo, COL_INFO, "Notify list remove"); - proto_tree_add_item(tree, &hfi_gadu_gadu_contact_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_contact_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_gadu_gadu_contact_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_contact_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; return offset; @@ -1347,10 +1205,10 @@ dissect_gadu_gadu_notify_common(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre contact_tree = proto_tree_add_subtree_format(tree, tvb, offset, 5, ett_gadu_gadu_contact, NULL, "Contact: %u", uin); - proto_tree_add_item(contact_tree, &hfi_gadu_gadu_contact_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(contact_tree, hf_gadu_gadu_contact_uin, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(contact_tree, &hfi_gadu_gadu_contact_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(contact_tree, hf_gadu_gadu_contact_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; } @@ -1412,7 +1270,7 @@ dissect_gadu_gadu_welcome(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i { col_set_str(pinfo->cinfo, COL_INFO, "Welcome"); - proto_tree_add_item(tree, &hfi_gadu_gadu_welcome_seed, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_welcome_seed, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; return offset; @@ -1428,14 +1286,14 @@ dissect_gadu_gadu_userlist_xml_compressed(tvbuff_t *tvb, packet_info *pinfo, pro return offset; if ((uncomp_tvb = tvb_child_uncompress(tvb, tvb, offset, remain))) { - proto_tree_add_bytes_format_value(tree, &hfi_gadu_gadu_userlist, tvb, offset, remain, NULL, "%s", "[Decompression succeeded]"); + proto_tree_add_bytes_format_value(tree, hf_gadu_gadu_userlist, tvb, offset, remain, NULL, "%s", "[Decompression succeeded]"); add_new_data_source(pinfo, uncomp_tvb, "Uncompressed userlist"); /* XXX add DTD (pinfo->match_string) */ call_dissector_only(xml_handle, uncomp_tvb, pinfo, tree, NULL); } else - proto_tree_add_bytes_format_value(tree, &hfi_gadu_gadu_userlist, tvb, offset, remain, NULL, "%s", "[Error: Decompression failed] (or no zlib)"); + proto_tree_add_bytes_format_value(tree, hf_gadu_gadu_userlist, tvb, offset, remain, NULL, "%s", "[Error: Decompression failed] (or no zlib)"); offset += remain; @@ -1451,10 +1309,10 @@ dissect_gadu_gadu_userlist_request80(tvbuff_t *tvb, packet_info *pinfo, proto_tr col_set_str(pinfo->cinfo, COL_INFO, "Userlist request (8.0)"); type = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_request_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userlist_request_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_userlist_format, tvb, 0, 0, GG_USERLIST100_FORMAT_TYPE_GG100); + ti = proto_tree_add_uint(tree, hf_gadu_gadu_userlist_format, tvb, 0, 0, GG_USERLIST100_FORMAT_TYPE_GG100); proto_item_set_generated(ti); switch (type) { @@ -1474,17 +1332,17 @@ dissect_gadu_gadu_userlist_request100(tvbuff_t *tvb, packet_info *pinfo, proto_t col_set_str(pinfo->cinfo, COL_INFO, "Userlist request (10.0)"); type = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_request_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userlist_request_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_version, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userlist_version, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; format = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_format, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userlist_format, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 01 */ + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 01 */ offset += 1; switch (type) { @@ -1505,7 +1363,7 @@ dissect_gadu_gadu_userlist_reply80(tvbuff_t *tvb, packet_info *pinfo, proto_tree col_set_str(pinfo->cinfo, COL_INFO, "Userlist reply (8.0)"); type = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_reply_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userlist_reply_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; switch (type) { @@ -1525,17 +1383,17 @@ dissect_gadu_gadu_userlist_reply100(tvbuff_t *tvb, packet_info *pinfo, proto_tre col_set_str(pinfo->cinfo, COL_INFO, "Userlist reply (10.0)"); type = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_reply_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userlist_reply_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_version, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userlist_version, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; format = tvb_get_guint8(tvb, offset); - proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_format, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userlist_format, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 01 */ + proto_tree_add_item(tree, hf_gadu_gadu_data, tvb, offset, 1, ENC_NA); /* 01 */ offset += 1; switch (type) { @@ -1553,7 +1411,7 @@ dissect_gadu_gadu_userlist_version100(tvbuff_t *tvb, packet_info *pinfo, proto_t { col_set_str(pinfo->cinfo, COL_INFO, "Userlist version (10.0)"); - proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_version, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_userlist_version, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; return offset; @@ -1564,7 +1422,7 @@ dissect_gadu_gadu_dcc7_id_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree { col_set_str(pinfo->cinfo, COL_INFO, "Direct connection id request"); - proto_tree_add_item(tree, &hfi_dcc_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_dcc_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; return offset; @@ -1575,10 +1433,10 @@ dissect_gadu_gadu_dcc7_id_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t { col_set_str(pinfo->cinfo, COL_INFO, "Direct connection id reply"); - proto_tree_add_item(tree, &hfi_dcc_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_dcc_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_dcc_id, tvb, offset, 8, ENC_NA); + proto_tree_add_item(tree, hf_dcc_id, tvb, offset, 8, ENC_NA); offset += 8; return offset; @@ -1589,19 +1447,19 @@ dissect_gadu_gadu_dcc7_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { col_set_str(pinfo->cinfo, COL_INFO, "Direct connection new"); - proto_tree_add_item(tree, &hfi_dcc_id, tvb, offset, 8, ENC_NA); + proto_tree_add_item(tree, hf_dcc_id, tvb, offset, 8, ENC_NA); offset += 8; - proto_tree_add_item(tree, &hfi_dcc_uin_from, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_dcc_uin_from, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_dcc_uin_to, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_dcc_uin_to, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_dcc_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_dcc_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_dcc_filename, tvb, offset, 255, ENC_ASCII | ENC_NA); + proto_tree_add_item(tree, hf_dcc_filename, tvb, offset, 255, ENC_ASCII | ENC_NA); offset += 255; return offset; @@ -1612,13 +1470,13 @@ dissect_gadu_gadu_dcc7_id_abort(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t { col_set_str(pinfo->cinfo, COL_INFO, "Direct connection abort"); - proto_tree_add_item(tree, &hfi_dcc_id, tvb, offset, 8, ENC_NA); + proto_tree_add_item(tree, hf_dcc_id, tvb, offset, 8, ENC_NA); offset += 8; - proto_tree_add_item(tree, &hfi_dcc_uin_from, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_dcc_uin_from, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tree, &hfi_dcc_uin_to, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_dcc_uin_to, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; return offset; @@ -1631,16 +1489,16 @@ dissect_gadu_gadu_pubdir50_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree col_set_str(pinfo->cinfo, COL_INFO, "Public directory request"); - proto_tree_add_item(tree, &hfi_gadu_gadu_pubdir_request_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_pubdir_request_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_pubdir_request_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_pubdir_request_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; /* XXX, link request sequence with reply sequence */ while ((pos = tvb_find_guint8(tvb, offset, -1, '\0')) > 0) { /* XXX, display it better, field=value */ - proto_tree_add_item(tree, &hfi_gadu_gadu_pubdir_request_str, tvb, offset, (pos - offset) + 1, ENC_NA | ENC_WINDOWS_1250); + proto_tree_add_item(tree, hf_gadu_gadu_pubdir_request_str, tvb, offset, (pos - offset) + 1, ENC_NA | ENC_WINDOWS_1250); offset = pos + 1; } @@ -1654,16 +1512,16 @@ dissect_gadu_gadu_pubdir50_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree * col_set_str(pinfo->cinfo, COL_INFO, "Public directory reply"); - proto_tree_add_item(tree, &hfi_gadu_gadu_pubdir_reply_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_pubdir_reply_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; - proto_tree_add_item(tree, &hfi_gadu_gadu_pubdir_reply_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_gadu_gadu_pubdir_reply_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; /* XXX, link reply sequence with request sequence */ while ((pos = tvb_find_guint8(tvb, offset, -1, '\0')) > 0) { /* XXX, display it better, field=value */ - proto_tree_add_item(tree, &hfi_gadu_gadu_pubdir_reply_str, tvb, offset, (pos - offset) + 1, ENC_NA | ENC_WINDOWS_1250); + proto_tree_add_item(tree, hf_gadu_gadu_pubdir_reply_str, tvb, offset, (pos - offset) + 1, ENC_NA | ENC_WINDOWS_1250); offset = pos + 1; } @@ -1697,14 +1555,14 @@ dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* col_clear(pinfo->cinfo, COL_INFO); /* XXX, remove, add separator when multiple PDU */ if (tree) { - proto_item *ti = proto_tree_add_item(tree, hfi_gadu_gadu, tvb, 0, -1, ENC_NA); + proto_item *ti = proto_tree_add_item(tree, proto_gadu_gadu, tvb, 0, -1, ENC_NA); gadu_gadu_tree = proto_item_add_subtree(ti, ett_gadu_gadu); } pkt_type = tvb_get_letohl(tvb, offset); - proto_tree_add_item(gadu_gadu_tree, (pinfo->p2p_dir == P2P_DIR_RECV) ? &hfi_gadu_gadu_header_type_recv : &hfi_gadu_gadu_header_type_send, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(gadu_gadu_tree, (pinfo->p2p_dir == P2P_DIR_RECV) ? hf_gadu_gadu_header_type_recv : hf_gadu_gadu_header_type_send, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(gadu_gadu_tree, &hfi_gadu_gadu_header_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(gadu_gadu_tree, hf_gadu_gadu_header_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; if (pinfo->p2p_dir == P2P_DIR_RECV) { @@ -1956,7 +1814,7 @@ dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* /* for now display rest of data as FT_BYTES. */ if (tvb_reported_length_remaining(tvb, offset) > 0) { - proto_tree_add_item(gadu_gadu_tree, &hfi_gadu_gadu_data, tvb, offset, -1, ENC_NA); + proto_tree_add_item(gadu_gadu_tree, hf_gadu_gadu_data, tvb, offset, -1, ENC_NA); } return tvb_captured_length(tvb); @@ -1991,86 +1849,308 @@ dissect_gadu_gadu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat void proto_register_gadu_gadu(void) { -#ifndef HAVE_HFI_SECTION_INIT - static header_field_info *hfi[] = { - /* Header */ - &hfi_gadu_gadu_header_type_recv, - &hfi_gadu_gadu_header_type_send, - &hfi_gadu_gadu_header_length, - /* Login common */ - &hfi_gadu_gadu_login_uin, - &hfi_gadu_gadu_login_hash_type, - &hfi_gadu_gadu_login_hash, - &hfi_gadu_gadu_login_status, - &hfi_gadu_gadu_login_protocol, - &hfi_gadu_gadu_login_version, - &hfi_gadu_gadu_login_local_ip, - &hfi_gadu_gadu_login_local_port, - /* GG_LOGIN80 */ - &hfi_gadu_gadu_login80_lang, - /* Contacts details */ - &hfi_gadu_gadu_userdata_uin, - &hfi_gadu_gadu_userdata_attr_name, - &hfi_gadu_gadu_userdata_attr_type, - &hfi_gadu_gadu_userdata_attr_value, - /* Typing notify */ - &hfi_gadu_gadu_typing_notify_type, - &hfi_gadu_gadu_typing_notify_uin, - /* Message common */ - &hfi_gadu_gadu_msg_uin, - &hfi_gadu_gadu_msg_sender, - &hfi_gadu_gadu_msg_recipient, - &hfi_gadu_gadu_msg_seq, - &hfi_gadu_gadu_msg_time, - &hfi_gadu_gadu_msg_class, - &hfi_gadu_gadu_msg_text, - /* GG_RECV_MSG80, GG_SEND_MSG80 */ - &hfi_gadu_gadu_msg80_offset_plain, - &hfi_gadu_gadu_msg80_offset_attr, - /* GG_SEND_MSG_ACK */ - &hfi_gadu_gadu_msg_ack_status, - &hfi_gadu_gadu_msg_ack_recipient, - &hfi_gadu_gadu_msg_ack_seq, - /* Status common */ - &hfi_gadu_gadu_status_uin, - &hfi_gadu_gadu_status_status, - &hfi_gadu_gadu_status_ip, - &hfi_gadu_gadu_status_port, - &hfi_gadu_gadu_status_version, - &hfi_gadu_gadu_status_img_size, - &hfi_gadu_gadu_status_descr, - /* Direct Connection */ - &hfi_dcc_type, - &hfi_dcc_id, - &hfi_dcc_uin_to, - &hfi_dcc_uin_from, - &hfi_dcc_filename, - /* New status (setting status) common */ - &hfi_gadu_gadu_new_status_status, - &hfi_gadu_gadu_new_status_desc, - /* Userlist */ - &hfi_gadu_gadu_userlist_request_type, - &hfi_gadu_gadu_userlist_version, - &hfi_gadu_gadu_userlist_format, - &hfi_gadu_gadu_userlist_reply_type, - &hfi_gadu_gadu_userlist, - /* Public Directory */ - &hfi_gadu_gadu_pubdir_request_type, - &hfi_gadu_gadu_pubdir_request_seq, - &hfi_gadu_gadu_pubdir_request_str, - &hfi_gadu_gadu_pubdir_reply_type, - &hfi_gadu_gadu_pubdir_reply_seq, - &hfi_gadu_gadu_pubdir_reply_str, - /* Contact (notify) common */ - &hfi_gadu_gadu_contact_uin, - &hfi_gadu_gadu_contact_uin_str, - &hfi_gadu_gadu_contact_type, - /* GG_WELCOME */ - &hfi_gadu_gadu_welcome_seed, - /* Not dissected data */ - &hfi_gadu_gadu_data, + static hf_register_info hf[] = { + { &hf_gadu_gadu_header_type_recv, + { "Packet Type", "gadu-gadu.recv", + FT_UINT32, BASE_HEX, VALS(gadu_gadu_packets_type_recv), 0x0, + "Packet Type (recv)", HFILL } + }, + { &hf_gadu_gadu_header_type_send, + { "Packet Type", "gadu-gadu.send", + FT_UINT32, BASE_HEX, VALS(gadu_gadu_packets_type_send), 0x0, + "Packet Type (send)", HFILL } + }, + { &hf_gadu_gadu_header_length, + { "Packet Length", "gadu-gadu.len", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gadu_gadu_login_uin, + { "Client UIN", "gadu-gadu.login.uin", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_login_hash_type, + { "Login hash type", "gadu-gadu.login.hash_type", + FT_UINT8, BASE_HEX, VALS(gadu_gadu_hash_type_vals), 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_login_hash, + { "Login hash", "gadu-gadu.login.hash", + FT_BYTES, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_login_status, + { "Client status", "gadu-gadu.login.status", + FT_UINT32, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_login_protocol, + { "Client protocol", "gadu-gadu.login.protocol", + FT_UINT32, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_login_version, + { "Client version", "gadu-gadu.login.version", + FT_STRING, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_login_local_ip, + { "Client local IP", "gadu-gadu.login.local_ip", + FT_IPv4, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_login_local_port, + { "Client local port", "gadu-gadu.login.local_port", + FT_UINT16, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_login80_lang, + { "Client language", "gadu-gadu.login80.lang", + FT_STRING, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_userdata_uin, + { "UIN", "gadu-gadu.user_data.uin", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_userdata_attr_name, + { "Attribute name", "gadu-gadu.user_data.attr_name", + FT_STRING, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_userdata_attr_type, + { "Attribute type", "gadu-gadu.user_data.attr_type", + FT_UINT32, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_userdata_attr_value, + { "Attribute value", "gadu-gadu.user_data.attr_val", + FT_STRING, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_typing_notify_type, + { "Typing notify type", "gadu-gadu.typing_notify.type", + FT_UINT16, BASE_HEX, VALS(gadu_gadu_typing_notify_type_vals), 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_typing_notify_uin, + { "Typing notify recipient", "gadu-gadu.typing_notify.uin", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_uin, + { "Message sender or recipient", "gadu-gadu.msg.uin", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_sender, + { "Message sender", "gadu-gadu.msg.sender", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_recipient, + { "Message recipient", "gadu-gadu.msg.recipient", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_seq, + { "Message sequence number", "gadu-gadu.msg.seq", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_time, + { "Message time", "gadu-gadu.msg.time", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_class, + { "Message class", "gadu-gadu.msg.class", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_text, + { "Message text", "gadu-gadu.msg.text", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg80_offset_plain, + { "Message plaintext offset", "gadu-gadu.msg80.offset_plain", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg80_offset_attr, + { "Message attribute offset", "gadu-gadu.msg80.offset_attributes", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_ack_status, + { "Message status", "gadu-gadu.msg_ack.status", + FT_UINT32, BASE_HEX, VALS(gadu_gadu_msg_ack_status_vals), 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_ack_recipient, + { "Message recipient", "gadu-gadu.msg_ack.recipient", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_msg_ack_seq, + { "Message sequence number", "gadu-gadu.msg_ack.seq", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_status_uin, + { "UIN", "gadu-gadu.status.uin", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_status_status, + { "Status", "gadu-gadu.status.status", + FT_UINT32, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_status_ip, + { "IP", "gadu-gadu.status.remote_ip", + FT_IPv4, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_status_port, + { "Port", "gadu-gadu.status.remote_port", + FT_UINT16, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_status_version, + { "Version", "gadu-gadu.status.version", + FT_UINT8, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_status_img_size, + { "Image size", "gadu-gadu.status.image_size", + FT_UINT8, BASE_DEC, NULL, 0x00, + "Maximum image size in KB", HFILL } + }, + { &hf_gadu_gadu_status_descr, + { "Description", "gadu-gadu.status.description", + FT_STRINGZ, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_dcc_type, + { "Direct connection type", "gadu-gadu.dcc.type", + FT_UINT32, BASE_HEX, VALS(gadu_gadu_dcc_type_vals), 0x00, + NULL, HFILL } + }, + { &hf_dcc_id, + { "Direct connection id", "gadu-gadu.dcc.id", + FT_BYTES, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_dcc_uin_to, + { "Direct connection UIN target", "gadu-gadu.dcc.uin_to", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_dcc_uin_from, + { "Direct connection UIN initiator", "gadu-gadu.dcc.uin_from", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_dcc_filename, + { "Direct connection filename", "gadu-gadu.dcc.filename", + FT_STRING, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_new_status_status, + { "Status", "gadu-gadu.new_status.status", + FT_UINT32, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_new_status_desc, + { "Description", "gadu-gadu.new_status.description", + FT_STRINGZ, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_userlist_request_type, + { "Request type", "gadu-gadu.userlist.request_type", + FT_UINT32, BASE_HEX, VALS(gadu_gadu_userlist_request_type_vals), 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_userlist_version, + { "Userlist version", "gadu-gadu.userlist.version", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_userlist_format, + { "Userlist format", "gadu-gadu.userlist.format", + FT_UINT8, BASE_HEX, VALS(gadu_gadu_userlist_request_format_vals), 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_userlist_reply_type, + { "Reply type", "gadu-gadu.userlist.reply_type", + FT_UINT32, BASE_HEX, VALS(gadu_gadu_userlist_reply_type_vals), 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_userlist, + { "Userlist XML data", "gadu-gadu.userlist", + FT_BYTES, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_pubdir_request_type, + { "Request type", "gadu-gadu.pubdir.request_type", + FT_UINT8, BASE_HEX, VALS(gadu_gadu_pubdir_type_vals), 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_pubdir_request_seq, + { "Request sequence", "gadu-gadu.pubdir.request_seq", + FT_UINT32, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_pubdir_request_str, + { "Request string", "gadu-gadu.pubdir.request_str", + FT_STRINGZ, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_pubdir_reply_type, + { "Reply type", "gadu-gadu.pubdir.reply_type", + FT_UINT8, BASE_HEX, VALS(gadu_gadu_pubdir_type_vals), 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_pubdir_reply_seq, + { "Reply sequence", "gadu-gadu.pubdir.reply_seq", + FT_UINT32, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_pubdir_reply_str, + { "Reply string", "gadu-gadu.pubdir.request_str", + FT_STRINGZ, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_contact_uin, + { "UIN", "gadu-gadu.contact.uin", + FT_UINT32, BASE_DEC, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_contact_uin_str, + { "UIN", "gadu-gadu.contact.uin_str", + FT_STRING, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_contact_type, + { "Type", "gadu-gadu.contact.type", + FT_UINT8, BASE_HEX, NULL, 0x00, + NULL, HFILL } + }, + { &hf_gadu_gadu_welcome_seed, + { "Seed", "gadu-gadu.welcome.seed", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gadu_gadu_data, + { "Packet Data", "gadu-gadu.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, }; -#endif /* HAVE_HFI_SECTION_INIT */ static gint *ett[] = { &ett_gadu_gadu, @@ -2079,10 +2159,7 @@ proto_register_gadu_gadu(void) module_t *gadu_gadu_module; - int proto_gadu_gadu; - proto_gadu_gadu = proto_register_protocol("Gadu-Gadu Protocol", "Gadu-Gadu", "gadu-gadu"); - hfi_gadu_gadu = proto_registrar_get_nth(proto_gadu_gadu); gadu_gadu_module = prefs_register_protocol(proto_gadu_gadu, NULL); prefs_register_bool_preference(gadu_gadu_module, "desegment", @@ -2091,7 +2168,7 @@ proto_register_gadu_gadu(void) "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &gadu_gadu_desegment); - proto_register_fields(proto_gadu_gadu, hfi, array_length(hfi)); + proto_register_field_array(proto_gadu_gadu, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); gadu_gadu_handle = create_dissector_handle(dissect_gadu_gadu, proto_gadu_gadu); @@ -2102,7 +2179,7 @@ proto_reg_handoff_gadu_gadu(void) { dissector_add_uint_with_preference("tcp.port", TCP_PORT_GADU_GADU, gadu_gadu_handle); - xml_handle = find_dissector_add_dependency("xml", hfi_gadu_gadu->id); + xml_handle = find_dissector_add_dependency("xml", proto_gadu_gadu); } /*