Fix few concept of new api tree:

- (for now) keep ABI, restore prototype of old proto_tree_add_item, add new proto_tree_add_item_new
- add few helpers for boolean, time, string which will do ->id
- don't use HFI_INIT directly, use it by another macro (MSVC has very small limit for section name)

svn path=/trunk/; revision=51401
This commit is contained in:
Jakub Zawadzki 2013-08-17 07:16:12 +00:00
parent 68f9abdc87
commit 4e870dd240
7 changed files with 225 additions and 183 deletions

View File

@ -39,7 +39,8 @@ void proto_reg_handoff_dbus(void);
static gboolean dbus_desegment = TRUE; static gboolean dbus_desegment = TRUE;
static int proto_dbus = -1; static dissector_handle_t dbus_handle;
static dissector_handle_t dbus_handle_tcp;
#define DBUS_MESSAGE_TYPE_INVALID 0 #define DBUS_MESSAGE_TYPE_INVALID 0
#define DBUS_MESSAGE_TYPE_METHOD_CALL 1 #define DBUS_MESSAGE_TYPE_METHOD_CALL 1
@ -81,60 +82,64 @@ static const value_string field_code_vals[] = {
{ 0, NULL } { 0, NULL }
}; };
static header_field_info *hfi_dbus = NULL;
#define DBUS_HFI_INIT HFI_INIT(proto_dbus)
/* XXX, FT_NONE -> FT_BYTES? */ /* XXX, FT_NONE -> FT_BYTES? */
/* Header */ /* Header */
static header_field_info hfi_dbus_hdr HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr DBUS_HFI_INIT =
{ "Header", "dbus.header", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Header", "dbus.header", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_hdr_endianness HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr_endianness DBUS_HFI_INIT =
{ "Endianness Flag", "dbus.endianness", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Endianness Flag", "dbus.endianness", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_hdr_type HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr_type DBUS_HFI_INIT =
{ "Message Type", "dbus.type", FT_UINT8, BASE_DEC, VALS(message_type_vals), 0x00, NULL, HFILL }; { "Message Type", "dbus.type", FT_UINT8, BASE_DEC, VALS(message_type_vals), 0x00, NULL, HFILL };
static header_field_info hfi_dbus_hdr_flags HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr_flags DBUS_HFI_INIT =
{ "Message Flags", "dbus.flags", FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }; { "Message Flags", "dbus.flags", FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_hdr_version HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr_version DBUS_HFI_INIT =
{ "Protocol Version", "dbus.version", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Protocol Version", "dbus.version", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_hdr_body_length HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr_body_length DBUS_HFI_INIT =
{ "Message body Length", "dbus.length", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Message body Length", "dbus.length", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_hdr_serial HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr_serial DBUS_HFI_INIT =
{ "Message Serial (cookie)", "dbus.serial", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Message Serial (cookie)", "dbus.serial", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_hdr_fields_length HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr_fields_length DBUS_HFI_INIT =
{ "Header fields Length", "dbus.fields_length", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Header fields Length", "dbus.fields_length", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
/* Header field */ /* Header field */
static header_field_info hfi_dbus_hdr_field HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr_field DBUS_HFI_INIT =
{ "Header Field", "dbus.field", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Header Field", "dbus.field", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_hdr_field_code HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_hdr_field_code DBUS_HFI_INIT =
{ "Field code", "dbus.field.code", FT_UINT8, BASE_DEC, VALS(field_code_vals), 0x00, NULL, HFILL }; { "Field code", "dbus.field.code", FT_UINT8, BASE_DEC, VALS(field_code_vals), 0x00, NULL, HFILL };
static header_field_info hfi_dbus_type_signature HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_type_signature DBUS_HFI_INIT =
{ "Type signature", "dbus.type_signature", FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Type signature", "dbus.type_signature", FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_body HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_body DBUS_HFI_INIT =
{ "Body", "dbus.body", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Body", "dbus.body", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL };
/* Values */ /* Values */
static header_field_info hfi_dbus_value_bool HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_value_bool DBUS_HFI_INIT =
{ "Value", "dbus.value.bool", FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Value", "dbus.value.bool", FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_value_int HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_value_int DBUS_HFI_INIT =
{ "Value", "dbus.value.int", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Value", "dbus.value.int", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_value_uint HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_value_uint DBUS_HFI_INIT =
{ "Value", "dbus.value.uint", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Value", "dbus.value.uint", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_value_str HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_value_str DBUS_HFI_INIT =
{ "Value", "dbus.value.str", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Value", "dbus.value.str", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dbus_value_double HFI_INIT(proto_dbus) = static header_field_info hfi_dbus_value_double DBUS_HFI_INIT =
{ "Value", "dbus.value.double", FT_DOUBLE, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Value", "dbus.value.double", FT_DOUBLE, BASE_NONE, NULL, 0x00, NULL, HFILL };
@ -368,7 +373,7 @@ dissect_dbus_field_signature(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree
sig = tvb_get_ephemeral_string(tvb, offset, sig_len); sig = tvb_get_ephemeral_string(tvb, offset, sig_len);
offset += (sig_len + 1); offset += (sig_len + 1);
ti = proto_tree_add_string(tree, hfi_dbus_type_signature.id, tvb, org_offset, offset - org_offset, sig); ti = proto_tree_add_string(tree, &hfi_dbus_type_signature, tvb, org_offset, offset - org_offset, sig);
if (!dbus_validate_signature(sig)) { if (!dbus_validate_signature(sig)) {
expert_add_info(dinfo->pinfo, ti, &ei_dbus_invalid_signature); expert_add_info(dinfo->pinfo, ti, &ei_dbus_invalid_signature);
return -1; return -1;
@ -564,7 +569,7 @@ dissect_dbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
} }
if (tree) { if (tree) {
proto_item *ti = proto_tree_add_item_old(tree, proto_dbus, tvb, 0, -1, ENC_NA); proto_item *ti = proto_tree_add_item(tree, hfi_dbus, tvb, 0, -1, ENC_NA);
dbus_tree = proto_item_add_subtree(ti, ett_dbus); dbus_tree = proto_item_add_subtree(ti, ett_dbus);
} }
@ -661,22 +666,25 @@ proto_register_dbus(void)
{ &ei_dbus_invalid_signature, { "dbus.invalid_signature", PI_PROTOCOL, PI_WARN, "Invalid signature", EXPFILL }}, { &ei_dbus_invalid_signature, { "dbus.invalid_signature", PI_PROTOCOL, PI_WARN, "Invalid signature", EXPFILL }},
}; };
expert_module_t* expert_dbus; expert_module_t *expert_dbus;
int proto_dbus;
proto_dbus = proto_register_protocol("D-Bus", "D-BUS", "dbus"); proto_dbus = proto_register_protocol("D-Bus", "D-BUS", "dbus");
hfi_dbus = proto_registrar_get_nth(proto_dbus);
proto_register_fields(proto_dbus, hfi, array_length(hfi)); proto_register_fields(proto_dbus, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett)); proto_register_subtree_array(ett, array_length(ett));
expert_dbus = expert_register_protocol(proto_dbus); expert_dbus = expert_register_protocol(proto_dbus);
expert_register_field_array(expert_dbus, ei, array_length(ei)); expert_register_field_array(expert_dbus, ei, array_length(ei));
dbus_handle = new_create_dissector_handle(dissect_dbus, proto_dbus);
dbus_handle_tcp = new_create_dissector_handle(dissect_dbus_tcp, proto_dbus);
} }
void void
proto_reg_handoff_dbus(void) proto_reg_handoff_dbus(void)
{ {
dissector_handle_t dbus_handle = new_create_dissector_handle(dissect_dbus, proto_dbus);
dissector_handle_t dbus_handle_tcp = new_create_dissector_handle(dissect_dbus_tcp, proto_dbus);
dissector_add_uint("wtap_encap", WTAP_ENCAP_DBUS, dbus_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_DBUS, dbus_handle);
dissector_add_handle("tcp.port", dbus_handle_tcp); dissector_add_handle("tcp.port", dbus_handle_tcp);
} }

View File

@ -41,7 +41,7 @@
/* desegmentation of Gadu-Gadu over TCP */ /* desegmentation of Gadu-Gadu over TCP */
static gboolean gadu_gadu_desegment = TRUE; static gboolean gadu_gadu_desegment = TRUE;
static int proto_gadu_gadu = -1; static dissector_handle_t gadu_gadu_handle;
static int ett_gadu_gadu = -1; static int ett_gadu_gadu = -1;
static int ett_gadu_gadu_contact = -1; static int ett_gadu_gadu_contact = -1;
@ -335,197 +335,201 @@ static const value_string gadu_gadu_pubdir_type_vals[] = {
{ 0, NULL } { 0, NULL }
}; };
static header_field_info *hfi_gadu_gadu = NULL;
#define GADU_GADU_HFI_INIT HFI_INIT(proto_gadu_gadu)
/* Header */ /* Header */
static header_field_info hfi_gadu_gadu_header_type_recv HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Packet Length", "gadu-gadu.len", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL };
/* Login common (gadu-gadu.login.*) */ /* Login common (gadu-gadu.login.*) */
static header_field_info hfi_gadu_gadu_login_uin HFI_INIT(proto_gadu_gadu) = 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 }; { "Client UIN", "gadu-gadu.login.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_login_hash_type HFI_INIT(proto_gadu_gadu) = 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, gadu_gadu_hash_type_vals, 0x00, NULL, HFILL }; { "Login hash type", "gadu-gadu.login.hash_type", FT_UINT8, BASE_HEX, gadu_gadu_hash_type_vals, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_login_hash HFI_INIT(proto_gadu_gadu) = 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 }; { "Login hash", "gadu-gadu.login.hash", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_login_status HFI_INIT(proto_gadu_gadu) = 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 }; { "Client status", "gadu-gadu.login.status", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_login_protocol HFI_INIT(proto_gadu_gadu) = 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 }; { "Client protocol", "gadu-gadu.login.protocol", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_login_version HFI_INIT(proto_gadu_gadu) = 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 }; { "Client version", "gadu-gadu.login.version", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_login_local_ip HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Client local port", "gadu-gadu.login.local_port", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL };
/* GG_LOGIN80 (gadu-gadu.login80.*) */ /* GG_LOGIN80 (gadu-gadu.login80.*) */
static header_field_info hfi_gadu_gadu_login80_lang HFI_INIT(proto_gadu_gadu) = 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 }; { "Client language", "gadu-gadu.login80.lang", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL };
/* Contacts details (gadu-gadu.user_data.*) */ /* Contacts details (gadu-gadu.user_data.*) */
static header_field_info hfi_gadu_gadu_userdata_uin HFI_INIT(proto_gadu_gadu) = 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 }; { "UIN", "gadu-gadu.user_data.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_userdata_attr_name HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Attribute value", "gadu-gadu.user_data.attr_val", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL };
/* Typing notify (gadu-gadu.typing_notify.*) */ /* Typing notify (gadu-gadu.typing_notify.*) */
static header_field_info hfi_gadu_gadu_typing_notify_type HFI_INIT(proto_gadu_gadu) = 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, gadu_gadu_typing_notify_type_vals, 0x00, NULL, HFILL }; { "Typing notify type", "gadu-gadu.typing_notify.type", FT_UINT16, BASE_HEX, gadu_gadu_typing_notify_type_vals, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_typing_notify_uin HFI_INIT(proto_gadu_gadu) = 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 }; { "Typing notify recipient", "gadu-gadu.typing_notify.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
/* Message common (gadu-gadu.msg.*) */ /* Message common (gadu-gadu.msg.*) */
static header_field_info hfi_gadu_gadu_msg_uin HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Message sender", "gadu-gadu.msg.sender", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_msg_recipient HFI_INIT(proto_gadu_gadu) = 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 }; { "Message recipient", "gadu-gadu.msg.recipient", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_msg_seq HFI_INIT(proto_gadu_gadu) = 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 }; { "Message sequence number", "gadu-gadu.msg.seq", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_msg_time HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Message class", "gadu-gadu.msg.class", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL };
static header_field_info hfi_gadu_gadu_msg_text HFI_INIT(proto_gadu_gadu) = 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 }; { "Message text", "gadu-gadu.msg.text", FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL };
/* GG_RECV_MSG80, GG_SEND_MSG80 (gadu-gadu.msg80.*) */ /* GG_RECV_MSG80, GG_SEND_MSG80 (gadu-gadu.msg80.*) */
static header_field_info hfi_gadu_gadu_msg80_offset_plain HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Message attribute offset", "gadu-gadu.msg80.offset_attributes", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
/* GG_SEND_MSG_ACK (gadu-gadu.msg_ack.*) */ /* GG_SEND_MSG_ACK (gadu-gadu.msg_ack.*) */
static header_field_info hfi_gadu_gadu_msg_ack_status HFI_INIT(proto_gadu_gadu) = 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, gadu_gadu_msg_ack_status_vals, 0x00, NULL, HFILL }; { "Message status", "gadu-gadu.msg_ack.status", FT_UINT32, BASE_HEX, gadu_gadu_msg_ack_status_vals, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_msg_ack_recipient HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Message sequence number", "gadu-gadu.msg_ack.seq", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
/* Status common (gadu-gadu.status.*) */ /* Status common (gadu-gadu.status.*) */
static header_field_info hfi_gadu_gadu_status_uin HFI_INIT(proto_gadu_gadu) = 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 }; { "UIN", "gadu-gadu.status.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_status_status HFI_INIT(proto_gadu_gadu) = 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 }; { "Status", "gadu-gadu.status.status", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_status_ip HFI_INIT(proto_gadu_gadu) = 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 }; { "IP", "gadu-gadu.status.remote_ip", FT_IPv4, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_status_port HFI_INIT(proto_gadu_gadu) = 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 }; { "Port", "gadu-gadu.status.remote_port", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_status_version HFI_INIT(proto_gadu_gadu) = 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 }; { "Version", "gadu-gadu.status.version", FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_status_img_size HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Description", "gadu-gadu.status.description", FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL };
/* Direct Connection (gadu-gadu.dcc.*) */ /* Direct Connection (gadu-gadu.dcc.*) */
static header_field_info hfi_dcc_type HFI_INIT(proto_gadu_gadu) = static header_field_info hfi_dcc_type GADU_GADU_HFI_INIT =
{ "Direct connection type", "gadu-gadu.dcc.type", FT_UINT32, BASE_HEX, gadu_gadu_dcc_type_vals, 0x00, NULL, HFILL }; { "Direct connection type", "gadu-gadu.dcc.type", FT_UINT32, BASE_HEX, gadu_gadu_dcc_type_vals, 0x00, NULL, HFILL };
static header_field_info hfi_dcc_id HFI_INIT(proto_gadu_gadu) = 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 }; { "Direct connection id", "gadu-gadu.dcc.id", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dcc_uin_to HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Direct connection UIN initiator", "gadu-gadu.dcc.uin_from", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_dcc_filename HFI_INIT(proto_gadu_gadu) = 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 }; { "Direct connection filename", "gadu-gadu.dcc.filename", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL };
/* New status (setting status) common (gadu-gadu.new_status.*) */ /* New status (setting status) common (gadu-gadu.new_status.*) */
static header_field_info hfi_gadu_gadu_new_status_status HFI_INIT(proto_gadu_gadu) = 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 }; { "Status", "gadu-gadu.new_status.status", FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_new_status_desc HFI_INIT(proto_gadu_gadu) = 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 }; { "Description", "gadu-gadu.new_status.description", FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL };
/* Userlist (gadu-gadu.userlist.*) */ /* Userlist (gadu-gadu.userlist.*) */
static header_field_info hfi_gadu_gadu_userlist_request_type HFI_INIT(proto_gadu_gadu) = 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, gadu_gadu_userlist_request_type_vals, 0x00, NULL, HFILL }; { "Request type", "gadu-gadu.userlist.request_type", FT_UINT32, BASE_HEX, gadu_gadu_userlist_request_type_vals, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_userlist_version HFI_INIT(proto_gadu_gadu) = 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 }; { "Userlist version", "gadu-gadu.userlist.version", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_userlist_format HFI_INIT(proto_gadu_gadu) = static header_field_info hfi_gadu_gadu_userlist_format GADU_GADU_HFI_INIT =
{ "Userlist format", "gadu-gadu.userlist.format", FT_UINT8, BASE_HEX, gadu_gadu_userlist_request_format_vals, 0x00, NULL, HFILL }; { "Userlist format", "gadu-gadu.userlist.format", FT_UINT8, BASE_HEX, gadu_gadu_userlist_request_format_vals, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_userlist_reply_type HFI_INIT(proto_gadu_gadu) = 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, gadu_gadu_userlist_reply_type_vals, 0x00, NULL, HFILL }; { "Reply type", "gadu-gadu.userlist.reply_type", FT_UINT32, BASE_HEX, gadu_gadu_userlist_reply_type_vals, 0x00, NULL, HFILL };
/* Public Directory (gadu-gadu.pubdir.*) */ /* Public Directory (gadu-gadu.pubdir.*) */
static header_field_info hfi_gadu_gadu_pubdir_request_type HFI_INIT(proto_gadu_gadu) = 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, gadu_gadu_pubdir_type_vals, 0x00, NULL, HFILL }; { "Request type", "gadu-gadu.pubdir.request_type", FT_UINT8, BASE_HEX, gadu_gadu_pubdir_type_vals, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_pubdir_request_seq HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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, gadu_gadu_pubdir_type_vals, 0x00, NULL, HFILL }; { "Reply type", "gadu-gadu.pubdir.reply_type", FT_UINT8, BASE_HEX, gadu_gadu_pubdir_type_vals, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_pubdir_reply_seq HFI_INIT(proto_gadu_gadu) = 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 }; { "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 HFI_INIT(proto_gadu_gadu) = 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 }; { "Reply string", "gadu-gadu.pubdir.request_str", FT_STRINGZ, BASE_NONE, NULL, 0x00, NULL, HFILL };
/* Contact (notify) common (gadu-gadu.contact.*) */ /* Contact (notify) common (gadu-gadu.contact.*) */
static header_field_info hfi_gadu_gadu_contact_uin HFI_INIT(proto_gadu_gadu) = 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 }; { "UIN", "gadu-gadu.contact.uin", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_contact_uin_str HFI_INIT(proto_gadu_gadu) = 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 }; { "UIN", "gadu-gadu.contact.uin_str", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_gadu_gadu_contact_type HFI_INIT(proto_gadu_gadu) = 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 }; { "Type", "gadu-gadu.contact.type", FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL };
/* GG_WELCOME */ /* GG_WELCOME */
static header_field_info hfi_gadu_gadu_welcome_seed HFI_INIT(proto_gadu_gadu) = 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 }; { "Seed", "gadu-gadu.welcome.seed", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL };
/* Not dissected data */ /* Not dissected data */
static header_field_info hfi_gadu_gadu_data HFI_INIT(proto_gadu_gadu) = 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 }; { "Packet Data", "gadu-gadu.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL };
@ -542,12 +546,12 @@ gadu_gadu_create_conversation(packet_info *pinfo, guint32 uin)
struct gadu_gadu_conv_data *gg_conv; struct gadu_gadu_conv_data *gg_conv;
conv = find_or_create_conversation(pinfo); conv = find_or_create_conversation(pinfo);
gg_conv = (struct gadu_gadu_conv_data *)conversation_get_proto_data(conv, proto_gadu_gadu); gg_conv = (struct gadu_gadu_conv_data *)conversation_get_proto_data(conv, hfi_gadu_gadu->id);
if (!gg_conv) { if (!gg_conv) {
gg_conv = se_new(struct gadu_gadu_conv_data); gg_conv = se_new(struct gadu_gadu_conv_data);
gg_conv->uin = uin; gg_conv->uin = uin;
conversation_add_proto_data(conv, proto_gadu_gadu, gg_conv); conversation_add_proto_data(conv, hfi_gadu_gadu->id, gg_conv);
} }
/* assert(gg_conv->uin == uin); */ /* assert(gg_conv->uin == uin); */
return gg_conv; return gg_conv;
@ -560,7 +564,7 @@ gadu_gadu_get_conversation_data(packet_info *pinfo)
conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
if (conv) if (conv)
return (struct gadu_gadu_conv_data *)conversation_get_proto_data(conv, proto_gadu_gadu); return (struct gadu_gadu_conv_data *)conversation_get_proto_data(conv, hfi_gadu_gadu->id);
return NULL; return NULL;
} }
@ -697,7 +701,7 @@ dissect_gadu_gadu_login_protocol(tvbuff_t *tvb, proto_tree *tree, int offset)
protocol = tvb_get_letohl(tvb, offset) & 0xff; protocol = tvb_get_letohl(tvb, offset) & 0xff;
proto_tree_add_item(tree, &hfi_gadu_gadu_login_protocol, tvb, offset, 4, ENC_LITTLE_ENDIAN); 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.id, tvb, offset, 4, val_to_str(protocol, gadu_gadu_version_vals, "Unknown (0x%x)")); 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_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
offset += 4; offset += 4;
@ -717,10 +721,10 @@ dissect_gadu_gadu_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
uin = tvb_get_letohl(tvb, offset); uin = tvb_get_letohl(tvb, offset);
gadu_gadu_create_conversation(pinfo, uin); gadu_gadu_create_conversation(pinfo, uin);
proto_tree_add_uint(tree, hfi_gadu_gadu_login_uin.id, tvb, offset, 4, uin); proto_tree_add_uint(tree, &hfi_gadu_gadu_login_uin, tvb, offset, 4, uin);
offset += 4; offset += 4;
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_login_hash_type.id, tvb, 0, 0, GG_LOGIN_HASH_GG32); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_login_hash_type, tvb, 0, 0, GG_LOGIN_HASH_GG32);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
/* hash is 32-bit number written in LE */ /* hash is 32-bit number written in LE */
@ -796,7 +800,7 @@ 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); uin = tvb_get_letohl(tvb, offset) & ~(GG_ERA_OMNIX_MASK | GG_HAS_AUDIO_MASK);
gadu_gadu_create_conversation(pinfo, uin); gadu_gadu_create_conversation(pinfo, uin);
proto_tree_add_uint(tree, hfi_gadu_gadu_login_uin.id, tvb, offset, 4, uin); proto_tree_add_uint(tree, &hfi_gadu_gadu_login_uin, tvb, offset, 4, uin);
offset += 4; offset += 4;
offset = dissect_gadu_gadu_login_hash(tvb, tree, offset); offset = dissect_gadu_gadu_login_hash(tvb, tree, offset);
@ -919,7 +923,7 @@ dissect_gadu_gadu_user_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 4; offset += 4;
name = tvb_get_ephemeral_string_enc(tvb, offset, name_size, ENC_ASCII | ENC_NA); name = tvb_get_ephemeral_string_enc(tvb, offset, name_size, ENC_ASCII | ENC_NA);
proto_tree_add_string(tree, hfi_gadu_gadu_userdata_attr_name.id, tvb, offset - 4, 4 + name_size, name); proto_tree_add_string(tree, &hfi_gadu_gadu_userdata_attr_name, tvb, offset - 4, 4 + name_size, name);
offset += name_size; offset += name_size;
/* type */ /* type */
proto_tree_add_item(tree, &hfi_gadu_gadu_userdata_attr_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, &hfi_gadu_gadu_userdata_attr_type, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@ -929,7 +933,7 @@ dissect_gadu_gadu_user_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 4; offset += 4;
val = tvb_get_ephemeral_string_enc(tvb, offset, val_size, ENC_ASCII | ENC_NA); val = tvb_get_ephemeral_string_enc(tvb, offset, val_size, ENC_ASCII | ENC_NA);
proto_tree_add_string(tree, hfi_gadu_gadu_userdata_attr_value.id, tvb, offset - 4, 4 + val_size, val); proto_tree_add_string(tree, &hfi_gadu_gadu_userdata_attr_value, tvb, offset - 4, 4 + val_size, val);
offset += val_size; offset += val_size;
} }
} }
@ -969,10 +973,10 @@ 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)"); col_set_str(pinfo->cinfo, COL_INFO, "Receive message (< 8.0)");
if ((conv = gadu_gadu_get_conversation_data(pinfo))) { if ((conv = gadu_gadu_get_conversation_data(pinfo))) {
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_msg_recipient.id, tvb, 0, 0, conv->uin); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_recipient, tvb, 0, 0, conv->uin);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_msg_uin.id, tvb, 0, 0, conv->uin); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
PROTO_ITEM_SET_HIDDEN(ti); PROTO_ITEM_SET_HIDDEN(ti);
} }
@ -1012,10 +1016,10 @@ dissect_gadu_gadu_send_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 4; offset += 4;
if ((conv = gadu_gadu_get_conversation_data(pinfo))) { if ((conv = gadu_gadu_get_conversation_data(pinfo))) {
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_msg_sender.id, tvb, 0, 0, conv->uin); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_sender, tvb, 0, 0, conv->uin);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_msg_uin.id, tvb, 0, 0, conv->uin); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
PROTO_ITEM_SET_HIDDEN(ti); PROTO_ITEM_SET_HIDDEN(ti);
} }
@ -1023,7 +1027,7 @@ dissect_gadu_gadu_send_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(tree, &hfi_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, &hfi_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4; offset += 4;
ti = proto_tree_add_time(tree, hfi_gadu_gadu_msg_time.id, tvb, 0, 0, &(pinfo->fd->abs_ts)); ti = proto_tree_add_time(tree, &hfi_gadu_gadu_msg_time, tvb, 0, 0, &(pinfo->fd->abs_ts));
PROTO_ITEM_SET_GENERATED(ti); 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, &hfi_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@ -1045,10 +1049,10 @@ 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)"); col_set_str(pinfo->cinfo, COL_INFO, "Receive message (8.0)");
if ((conv = gadu_gadu_get_conversation_data(pinfo))) { if ((conv = gadu_gadu_get_conversation_data(pinfo))) {
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_msg_recipient.id, tvb, 0, 0, conv->uin); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_recipient, tvb, 0, 0, conv->uin);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_msg_uin.id, tvb, 0, 0, conv->uin); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
PROTO_ITEM_SET_HIDDEN(ti); PROTO_ITEM_SET_HIDDEN(ti);
} }
@ -1092,10 +1096,10 @@ dissect_gadu_gadu_send_msg80(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
offset += 4; offset += 4;
if ((conv = gadu_gadu_get_conversation_data(pinfo))) { if ((conv = gadu_gadu_get_conversation_data(pinfo))) {
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_msg_sender.id, tvb, 0, 0, conv->uin); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_sender, tvb, 0, 0, conv->uin);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_msg_uin.id, tvb, 0, 0, conv->uin); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_msg_uin, tvb, 0, 0, conv->uin);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
PROTO_ITEM_SET_HIDDEN(ti); PROTO_ITEM_SET_HIDDEN(ti);
} }
@ -1103,7 +1107,7 @@ dissect_gadu_gadu_send_msg80(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
proto_tree_add_item(tree, &hfi_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, &hfi_gadu_gadu_msg_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4; offset += 4;
ti = proto_tree_add_time(tree, hfi_gadu_gadu_msg_time.id, tvb, 0, 0, &(pinfo->fd->abs_ts)); ti = proto_tree_add_time(tree, &hfi_gadu_gadu_msg_time, tvb, 0, 0, &(pinfo->fd->abs_ts));
PROTO_ITEM_SET_GENERATED(ti); 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, &hfi_gadu_gadu_msg_class, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@ -1157,7 +1161,7 @@ dissect_gadu_gadu_status60(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
col_set_str(pinfo->cinfo, COL_INFO, "Receive status (6.0)"); 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); uin = tvb_get_letohl(tvb, offset) & ~(GG_ERA_OMNIX_MASK | GG_HAS_AUDIO_MASK);
proto_tree_add_uint(tree, hfi_gadu_gadu_status_uin.id, tvb, offset, 4, uin); proto_tree_add_uint(tree, &hfi_gadu_gadu_status_uin, tvb, offset, 4, uin);
offset += 4; offset += 4;
status = tvb_get_guint8(tvb, offset); status = tvb_get_guint8(tvb, offset);
@ -1194,7 +1198,7 @@ dissect_gadu_gadu_status77(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
col_set_str(pinfo->cinfo, COL_INFO, "Receive status (7.7)"); 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); uin = tvb_get_letohl(tvb, offset) & ~(GG_ERA_OMNIX_MASK | GG_HAS_AUDIO_MASK);
proto_tree_add_uint(tree, hfi_gadu_gadu_status_uin.id, tvb, offset, 4, uin); proto_tree_add_uint(tree, &hfi_gadu_gadu_status_uin, tvb, offset, 4, uin);
offset += 4; offset += 4;
status = tvb_get_guint8(tvb, offset); status = tvb_get_guint8(tvb, offset);
@ -1338,7 +1342,7 @@ dissect_gadu_gadu_notify105_common(tvbuff_t *tvb, proto_tree *tree, int offset,
uin_len = tvb_get_guint8(tvb, offset); uin_len = tvb_get_guint8(tvb, offset);
offset += 1; offset += 1;
uin = tvb_get_ephemeral_string_enc(tvb, offset, uin_len, ENC_ASCII | ENC_NA); uin = tvb_get_ephemeral_string_enc(tvb, offset, uin_len, ENC_ASCII | ENC_NA);
proto_tree_add_string(tree, hfi_gadu_gadu_contact_uin_str.id, tvb, offset - 1, 1 + uin_len, uin); proto_tree_add_string(tree, &hfi_gadu_gadu_contact_uin_str, tvb, offset - 1, 1 + uin_len, uin);
offset += uin_len; offset += uin_len;
if (puin) if (puin)
*puin = uin; *puin = uin;
@ -1499,7 +1503,7 @@ dissect_gadu_gadu_userlist_request80(tvbuff_t *tvb, packet_info *pinfo, proto_tr
proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_request_type, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, &hfi_gadu_gadu_userlist_request_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1; offset += 1;
ti = proto_tree_add_uint(tree, hfi_gadu_gadu_userlist_format.id, tvb, 0, 0, GG_USERLIST100_FORMAT_TYPE_GG100); ti = proto_tree_add_uint(tree, &hfi_gadu_gadu_userlist_format, tvb, 0, 0, GG_USERLIST100_FORMAT_TYPE_GG100);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
switch (type) { switch (type) {
@ -1742,7 +1746,7 @@ dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->cinfo, COL_INFO); /* XXX, remove, add separator when multiple PDU */ col_clear(pinfo->cinfo, COL_INFO); /* XXX, remove, add separator when multiple PDU */
if (tree) { if (tree) {
proto_item *ti = proto_tree_add_item_old(tree, proto_gadu_gadu, tvb, 0, -1, ENC_NA); proto_item *ti = proto_tree_add_item(tree, hfi_gadu_gadu, tvb, 0, -1, ENC_NA);
gadu_gadu_tree = proto_item_add_subtree(ti, ett_gadu_gadu); gadu_gadu_tree = proto_item_add_subtree(ti, ett_gadu_gadu);
} }
@ -2117,7 +2121,10 @@ proto_register_gadu_gadu(void)
module_t *gadu_gadu_module; module_t *gadu_gadu_module;
int proto_gadu_gadu;
proto_gadu_gadu = proto_register_protocol("Gadu-Gadu Protocol", "Gadu-Gadu", "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); gadu_gadu_module = prefs_register_protocol(proto_gadu_gadu, NULL);
prefs_register_bool_preference(gadu_gadu_module, "desegment", prefs_register_bool_preference(gadu_gadu_module, "desegment",
@ -2128,13 +2135,13 @@ proto_register_gadu_gadu(void)
proto_register_fields(proto_gadu_gadu, hfi, array_length(hfi)); proto_register_fields(proto_gadu_gadu, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett)); proto_register_subtree_array(ett, array_length(ett));
gadu_gadu_handle = new_create_dissector_handle(dissect_gadu_gadu, proto_gadu_gadu);
} }
void void
proto_reg_handoff_gadu_gadu(void) proto_reg_handoff_gadu_gadu(void)
{ {
dissector_handle_t gadu_gadu_handle = new_create_dissector_handle(dissect_gadu_gadu, proto_gadu_gadu);
dissector_add_uint("tcp.port", TCP_PORT_GADU_GADU, gadu_gadu_handle); dissector_add_uint("tcp.port", TCP_PORT_GADU_GADU, gadu_gadu_handle);
xml_handle = find_dissector("xml"); xml_handle = find_dissector("xml");

View File

@ -37,41 +37,43 @@
#include <epan/packet.h> #include <epan/packet.h>
#include <epan/tvbparse.h> #include <epan/tvbparse.h>
static gint proto_json = -1;
static gint ett_json = -1; static gint ett_json = -1;
static gint ett_json_array = -1; static gint ett_json_array = -1;
static gint ett_json_object = -1; static gint ett_json_object = -1;
static gint ett_json_member = -1; static gint ett_json_member = -1;
static header_field_info hfi_json_array HFI_INIT(proto_json) = static header_field_info *hfi_json = NULL;
#define JSON_HFI_INIT HFI_INIT(proto_json)
static header_field_info hfi_json_array JSON_HFI_INIT =
{ "Array", "json.array", FT_NONE, BASE_NONE, NULL, 0x00, "JSON array", HFILL }; { "Array", "json.array", FT_NONE, BASE_NONE, NULL, 0x00, "JSON array", HFILL };
static header_field_info hfi_json_object HFI_INIT(proto_json) = static header_field_info hfi_json_object JSON_HFI_INIT =
{ "Object", "json.object", FT_NONE, BASE_NONE, NULL, 0x00, "JSON object", HFILL }; { "Object", "json.object", FT_NONE, BASE_NONE, NULL, 0x00, "JSON object", HFILL };
static header_field_info hfi_json_member HFI_INIT(proto_json) = static header_field_info hfi_json_member JSON_HFI_INIT =
{ "Member", "json.member", FT_NONE, BASE_NONE, NULL, 0x00, "JSON object member", HFILL }; { "Member", "json.member", FT_NONE, BASE_NONE, NULL, 0x00, "JSON object member", HFILL };
#if 0 #if 0
/* XXX */ /* XXX */
static header_field_info hfi_json_member_key HFI_INIT(proto_json) = static header_field_info hfi_json_member_key JSON_HFI_INIT =
{ "Key", "json.member.key", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Key", "json.member.key", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL };
#endif #endif
static header_field_info hfi_json_value_string HFI_INIT(proto_json) = /* FT_STRINGZ? */ static header_field_info hfi_json_value_string JSON_HFI_INIT = /* FT_STRINGZ? */
{ "String value", "json.value.string", FT_STRING, BASE_NONE, NULL, 0x00, "JSON string value", HFILL }; { "String value", "json.value.string", FT_STRING, BASE_NONE, NULL, 0x00, "JSON string value", HFILL };
static header_field_info hfi_json_value_number HFI_INIT(proto_json) = /* FT_DOUBLE/ FT_INT64? */ static header_field_info hfi_json_value_number JSON_HFI_INIT = /* FT_DOUBLE/ FT_INT64? */
{ "Number value", "json.value.number", FT_STRING, BASE_NONE, NULL, 0x00, "JSON number value", HFILL }; { "Number value", "json.value.number", FT_STRING, BASE_NONE, NULL, 0x00, "JSON number value", HFILL };
static header_field_info hfi_json_value_false HFI_INIT(proto_json) = static header_field_info hfi_json_value_false JSON_HFI_INIT =
{ "False value", "json.value.false", FT_NONE, BASE_NONE, NULL, 0x00, "JSON false value", HFILL }; { "False value", "json.value.false", FT_NONE, BASE_NONE, NULL, 0x00, "JSON false value", HFILL };
static header_field_info hfi_json_value_null HFI_INIT(proto_json) = static header_field_info hfi_json_value_null JSON_HFI_INIT =
{ "Null value", "json.value.null", FT_NONE, BASE_NONE, NULL, 0x00, "JSON null value", HFILL }; { "Null value", "json.value.null", FT_NONE, BASE_NONE, NULL, 0x00, "JSON null value", HFILL };
static header_field_info hfi_json_value_true HFI_INIT(proto_json) = static header_field_info hfi_json_value_true JSON_HFI_INIT =
{ "True value", "json.value.true", FT_NONE, BASE_NONE, NULL, 0x00, "JSON true value", HFILL }; { "True value", "json.value.true", FT_NONE, BASE_NONE, NULL, 0x00, "JSON true value", HFILL };
@ -126,7 +128,7 @@ dissect_json(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} }
if (tree) { if (tree) {
ti = proto_tree_add_item_old(tree, proto_json, tvb, 0, -1, ENC_NA); ti = proto_tree_add_item(tree, hfi_json, tvb, 0, -1, ENC_NA);
json_tree = proto_item_add_subtree(ti, ett_json); json_tree = proto_item_add_subtree(ti, ett_json);
if (data_name) if (data_name)
@ -568,7 +570,10 @@ proto_register_json(void) {
&hfi_json_value_true, &hfi_json_value_true,
}; };
int proto_json;
proto_json = proto_register_protocol("JavaScript Object Notation", "JSON", "json"); proto_json = proto_register_protocol("JavaScript Object Notation", "JSON", "json");
hfi_json = proto_registrar_get_nth(proto_json);
proto_register_fields(proto_json, hfi, array_length(hfi)); proto_register_fields(proto_json, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett)); proto_register_subtree_array(ett, array_length(ett));

View File

@ -104,48 +104,50 @@ static const value_string nflog_tlv_vals[] = {
static gint nflog_byte_order = BYTE_ORDER_AUTO; static gint nflog_byte_order = BYTE_ORDER_AUTO;
static int proto_nflog = -1;
static int ett_nflog = -1; static int ett_nflog = -1;
static int ett_nflog_tlv = -1; static int ett_nflog_tlv = -1;
static header_field_info *hfi_nflog = NULL;
#define NFLOG_HFI_INIT HFI_INIT(proto_nflog)
/* Header */ /* Header */
static header_field_info hfi_nflog_family HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_family NFLOG_HFI_INIT =
{ "Family", "nflog.family", FT_UINT8, BASE_DEC, VALS(_linux_family_vals), 0x00, NULL, HFILL }; { "Family", "nflog.family", FT_UINT8, BASE_DEC, VALS(_linux_family_vals), 0x00, NULL, HFILL };
static header_field_info hfi_nflog_version HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_version NFLOG_HFI_INIT =
{ "Version", "nflog.version", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Version", "nflog.version", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_nflog_resid HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_resid NFLOG_HFI_INIT =
{ "Resource id", "nflog.res_id", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Resource id", "nflog.res_id", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_nflog_encoding HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_encoding NFLOG_HFI_INIT =
{ "Encoding", "nflog.encoding", FT_UINT32, BASE_HEX, VALS(_encoding_vals), 0x00, NULL, HFILL }; { "Encoding", "nflog.encoding", FT_UINT32, BASE_HEX, VALS(_encoding_vals), 0x00, NULL, HFILL };
/* TLV */ /* TLV */
static header_field_info hfi_nflog_tlv HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_tlv NFLOG_HFI_INIT =
{ "TLV", "nflog.tlv", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "TLV", "nflog.tlv", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_nflog_tlv_length HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_tlv_length NFLOG_HFI_INIT =
{ "Length", "nflog.tlv_length", FT_UINT16, BASE_DEC, NULL, 0x00, "TLV Length", HFILL }; { "Length", "nflog.tlv_length", FT_UINT16, BASE_DEC, NULL, 0x00, "TLV Length", HFILL };
static header_field_info hfi_nflog_tlv_type HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_tlv_type NFLOG_HFI_INIT =
{ "Type", "nflog.tlv_type", FT_UINT16, BASE_DEC, VALS(nflog_tlv_vals), 0x7fff, "TLV Type", HFILL }; { "Type", "nflog.tlv_type", FT_UINT16, BASE_DEC, VALS(nflog_tlv_vals), 0x7fff, "TLV Type", HFILL };
/* TLV values */ /* TLV values */
static header_field_info hfi_nflog_tlv_prefix HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_tlv_prefix NFLOG_HFI_INIT =
{ "Prefix", "nflog.prefix", FT_STRINGZ, BASE_NONE, NULL, 0x00, "TLV Prefix Value", HFILL }; { "Prefix", "nflog.prefix", FT_STRINGZ, BASE_NONE, NULL, 0x00, "TLV Prefix Value", HFILL };
static header_field_info hfi_nflog_tlv_uid HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_tlv_uid NFLOG_HFI_INIT =
{ "UID", "nflog.uid", FT_INT32, BASE_DEC, NULL, 0x00, "TLV UID Value", HFILL }; { "UID", "nflog.uid", FT_INT32, BASE_DEC, NULL, 0x00, "TLV UID Value", HFILL };
static header_field_info hfi_nflog_tlv_gid HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_tlv_gid NFLOG_HFI_INIT =
{ "GID", "nflog.gid", FT_INT32, BASE_DEC, NULL, 0x00, "TLV GID Value", HFILL }; { "GID", "nflog.gid", FT_INT32, BASE_DEC, NULL, 0x00, "TLV GID Value", HFILL };
static header_field_info hfi_nflog_tlv_timestamp HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_tlv_timestamp NFLOG_HFI_INIT =
{ "Timestamp", "nflog.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00, "TLV Timestamp Value", HFILL }; { "Timestamp", "nflog.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00, "TLV Timestamp Value", HFILL };
static header_field_info hfi_nflog_tlv_unknown HFI_INIT(proto_nflog) = static header_field_info hfi_nflog_tlv_unknown NFLOG_HFI_INIT =
{ "Value", "nflog.tlv_value", FT_BYTES, BASE_NONE, NULL, 0x00, "TLV Value", HFILL }; { "Value", "nflog.tlv_value", FT_BYTES, BASE_NONE, NULL, 0x00, "TLV Value", HFILL };
static dissector_handle_t ip_handle; static dissector_handle_t ip_handle;
@ -234,8 +236,8 @@ dissect_nflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} }
/* Header */ /* Header */
if (proto_field_is_referenced(tree, proto_nflog)) { if (proto_field_is_referenced(tree, hfi_nflog->id)) {
ti = proto_tree_add_item_old(tree, proto_nflog, tvb, 0, -1, ENC_NA); ti = proto_tree_add_item(tree, hfi_nflog, tvb, 0, -1, ENC_NA);
nflog_tree = proto_item_add_subtree(ti, ett_nflog); nflog_tree = proto_item_add_subtree(ti, ett_nflog);
proto_tree_add_item(nflog_tree, &hfi_nflog_family, tvb, offset, 1, ENC_NA); proto_tree_add_item(nflog_tree, &hfi_nflog_family, tvb, offset, 1, ENC_NA);
@ -247,7 +249,7 @@ dissect_nflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(nflog_tree, &hfi_nflog_resid, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(nflog_tree, &hfi_nflog_resid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2; offset += 2;
ti = proto_tree_add_uint(nflog_tree, hfi_nflog_encoding.id, ti = proto_tree_add_uint(nflog_tree, &hfi_nflog_encoding,
tvb, offset, tvb_length_remaining(tvb, offset), enc); tvb, offset, tvb_length_remaining(tvb, offset), enc);
PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_GENERATED(ti);
} }
@ -316,7 +318,7 @@ dissect_nflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ts.secs = (time_t)tvb_get_ntoh64(tvb, offset + 4); ts.secs = (time_t)tvb_get_ntoh64(tvb, offset + 4);
/* XXX - add an "expert info" warning if this is >= 10^9? */ /* XXX - add an "expert info" warning if this is >= 10^9? */
ts.nsecs = (int)tvb_get_ntoh64(tvb, offset + 12); ts.nsecs = (int)tvb_get_ntoh64(tvb, offset + 12);
proto_tree_add_time(tlv_tree, hfi_nflog_tlv_timestamp.id, proto_tree_add_time(tlv_tree, &hfi_nflog_tlv_timestamp,
tvb, offset + 4, value_len, &ts); tvb, offset + 4, value_len, &ts);
handled = TRUE; handled = TRUE;
} }
@ -377,7 +379,10 @@ proto_register_nflog(void)
module_t *pref; module_t *pref;
int proto_nflog;
proto_nflog = proto_register_protocol("Linux Netfilter NFLOG", "NFLOG", "nflog"); proto_nflog = proto_register_protocol("Linux Netfilter NFLOG", "NFLOG", "nflog");
hfi_nflog = proto_registrar_get_nth(proto_nflog);
pref = prefs_register_protocol(proto_nflog, NULL); pref = prefs_register_protocol(proto_nflog, NULL);
prefs_register_enum_preference(pref, "byte_order_type", "Byte Order", "Byte Order", prefs_register_enum_preference(pref, "byte_order_type", "Byte Order", "Byte Order",

View File

@ -42,7 +42,7 @@ static gboolean yami_desegment = TRUE;
static guint global_yami_config_tcp_port = 0; static guint global_yami_config_tcp_port = 0;
static guint global_yami_config_udp_port = 0; static guint global_yami_config_udp_port = 0;
static int proto_yami = -1; static dissector_handle_t yami_handle;
#define YAMI_TYPE_BOOLEAN 1 #define YAMI_TYPE_BOOLEAN 1
#define YAMI_TYPE_INTEGER 2 #define YAMI_TYPE_INTEGER 2
@ -75,57 +75,61 @@ static const value_string yami_param_type_vals[] = {
{ 0, NULL } { 0, NULL }
}; };
static header_field_info *hfi_yami = NULL;
#define YAMI_HFI_INIT HFI_INIT(proto_yami)
/* Header */ /* Header */
static header_field_info hfi_yami_message_id HFI_INIT(proto_yami) = static header_field_info hfi_yami_message_id YAMI_HFI_INIT =
{ "Message ID", "yami.message_id", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Message ID", "yami.message_id", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_yami_frame_number HFI_INIT(proto_yami) = static header_field_info hfi_yami_frame_number YAMI_HFI_INIT =
{ "Frame Number", "yami.frame_number", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Frame Number", "yami.frame_number", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_yami_message_header_size HFI_INIT(proto_yami) = 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 }; { "Message Header Size", "yami.message_header_size", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_yami_frame_payload_size HFI_INIT(proto_yami) = 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 }; { "Frame Payload Size", "yami.frame_payload_size", FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_yami_message_hdr HFI_INIT(proto_yami) = static header_field_info hfi_yami_message_hdr YAMI_HFI_INIT =
{ "Header message", "yami.msg_hdr", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Header message", "yami.msg_hdr", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_yami_message_data HFI_INIT(proto_yami) = static header_field_info hfi_yami_message_data YAMI_HFI_INIT =
{ "Data message", "yami.msg_data", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Data message", "yami.msg_data", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL };
/* Parameter */ /* Parameter */
static header_field_info hfi_yami_param HFI_INIT(proto_yami) = static header_field_info hfi_yami_param YAMI_HFI_INIT =
{ "Parameter", "yami.param", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }; { "Parameter", "yami.param", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_yami_param_name HFI_INIT(proto_yami) = static header_field_info hfi_yami_param_name YAMI_HFI_INIT =
{ "Name", "yami.param.name", FT_STRING, BASE_NONE, NULL, 0x00, "Parameter name", HFILL }; { "Name", "yami.param.name", FT_STRING, BASE_NONE, NULL, 0x00, "Parameter name", HFILL };
static header_field_info hfi_yami_param_type HFI_INIT(proto_yami) = 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 }; { "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 HFI_INIT(proto_yami) = 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 }; { "Value", "yami.param.value_bool", FT_BOOLEAN, BASE_NONE, NULL, 0x00, "Parameter value (bool)", HFILL };
static header_field_info hfi_yami_param_value_int HFI_INIT(proto_yami) = 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 }; { "Value", "yami.param.value_int", FT_INT32, BASE_DEC, NULL, 0x00, "Parameter value (int)", HFILL };
static header_field_info hfi_yami_param_value_long HFI_INIT(proto_yami) = 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 }; { "Value", "yami.param.value_long", FT_INT64, BASE_DEC, NULL, 0x00, "Parameter value (long)", HFILL };
static header_field_info hfi_yami_param_value_double HFI_INIT(proto_yami) = 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 }; { "Value", "yami.param.value_double", FT_DOUBLE, BASE_NONE, NULL, 0x00, "Parameter value (double)", HFILL };
static header_field_info hfi_yami_param_value_str HFI_INIT(proto_yami) = 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 }; { "Value", "yami.param.value_str", FT_STRING, BASE_NONE, NULL, 0x00, "Parameter value (string)", HFILL };
static header_field_info hfi_yami_param_value_bin HFI_INIT(proto_yami) = 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 }; { "Value", "yami.param.value_bin", FT_BYTES, BASE_NONE, NULL, 0x00, "Parameter value (binary)", HFILL };
static header_field_info hfi_yami_params_count HFI_INIT(proto_yami) = static header_field_info hfi_yami_params_count YAMI_HFI_INIT =
{ "Parameters count", "yami.params_count", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Parameters count", "yami.params_count", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static header_field_info hfi_yami_items_count HFI_INIT(proto_yami) = static header_field_info hfi_yami_items_count YAMI_HFI_INIT =
{ "Items count", "yami.items_count", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }; { "Items count", "yami.items_count", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL };
static int ett_yami = -1; static int ett_yami = -1;
@ -158,7 +162,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *
proto_item_append_text(ti, ": %s", name); proto_item_append_text(ti, ": %s", name);
proto_item_append_text(par_ti, "%s, ", name); proto_item_append_text(par_ti, "%s, ", name);
offset += (name_len + 3) & ~3; offset += (name_len + 3) & ~3;
proto_tree_add_string(yami_param, hfi_yami_param_name.id, tvb, name_offset, offset - name_offset, name); proto_tree_add_string(yami_param, &hfi_yami_param_name, tvb, name_offset, offset - name_offset, name);
type = tvb_get_letohl(tvb, offset); 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, &hfi_yami_param_type, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@ -214,7 +218,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *
proto_item_append_text(ti, ", Type: string, Value: \"%s\"", val); proto_item_append_text(ti, ", Type: string, Value: \"%s\"", val);
offset += (val_len + 3) & ~3; offset += (val_len + 3) & ~3;
proto_tree_add_string(yami_param, hfi_yami_param_value_str.id, tvb, val_offset, offset - val_offset, val); proto_tree_add_string(yami_param, &hfi_yami_param_value_str, tvb, val_offset, offset - val_offset, val);
break; break;
} }
@ -256,7 +260,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *
int r = !!(val & (1 << j)); int r = !!(val & (1 << j));
proto_item_append_text(ti, "%s, ", r ? "T" : "F"); proto_item_append_text(ti, "%s, ", r ? "T" : "F");
proto_tree_add_boolean(yami_param, hfi_yami_param_value_bool.id, tvb, offset+(j/8), 1, r); proto_tree_add_boolean(yami_param, &hfi_yami_param_value_bool, tvb, offset+(j/8), 1, r);
} }
offset += 4; offset += 4;
} }
@ -269,7 +273,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *
int r = !!(val & (1 << j)); int r = !!(val & (1 << j));
proto_item_append_text(ti, "%s, ", r ? "T" : "F"); proto_item_append_text(ti, "%s, ", r ? "T" : "F");
proto_tree_add_boolean(yami_param, hfi_yami_param_value_bool.id, tvb, offset+(j/8), 1, r); proto_tree_add_boolean(yami_param, &hfi_yami_param_value_bool, tvb, offset+(j/8), 1, r);
} }
offset += 4; offset += 4;
} }
@ -365,7 +369,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *
val = tvb_get_ephemeral_string_enc(tvb, offset, val_len, ENC_ASCII | ENC_NA); val = tvb_get_ephemeral_string_enc(tvb, offset, val_len, ENC_ASCII | ENC_NA);
proto_item_append_text(ti, "\"%s\", ", val); proto_item_append_text(ti, "\"%s\", ", val);
proto_tree_add_string(yami_param, hfi_yami_param_value_str.id, tvb, val_offset, offset - val_offset, val); proto_tree_add_string(yami_param, &hfi_yami_param_value_str, tvb, val_offset, offset - val_offset, val);
offset += (val_len + 3) & ~3; offset += (val_len + 3) & ~3;
} }
proto_item_append_text(ti, "}"); proto_item_append_text(ti, "}");
@ -480,7 +484,7 @@ dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
if (tree) { if (tree) {
ti = proto_tree_add_item_old(tree, proto_yami, tvb, 0, -1, ENC_NA); ti = proto_tree_add_item(tree, hfi_yami, tvb, 0, -1, ENC_NA);
yami_tree = proto_item_add_subtree(ti, ett_yami); yami_tree = proto_item_add_subtree(ti, ett_yami);
} }
@ -574,7 +578,10 @@ proto_register_yami(void)
module_t *yami_module; module_t *yami_module;
int proto_yami;
proto_yami = proto_register_protocol("YAMI Protocol", "YAMI", "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_fields(proto_yami, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett)); proto_register_subtree_array(ett, array_length(ett));
@ -587,17 +594,17 @@ proto_register_yami(void)
"Whether the YAMI dissector should reassemble messages spanning multiple TCP segments." "Whether the YAMI dissector should reassemble messages spanning multiple TCP segments."
"To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&yami_desegment); &yami_desegment);
yami_handle = new_create_dissector_handle(dissect_yami, proto_yami);
} }
void void
proto_reg_handoff_yami(void) proto_reg_handoff_yami(void)
{ {
static int yami_prefs_initialized = FALSE; static int yami_prefs_initialized = FALSE;
static dissector_handle_t yami_handle = NULL;
static guint yami_tcp_port, yami_udp_port; static guint yami_tcp_port, yami_udp_port;
if(yami_prefs_initialized == FALSE){ if(yami_prefs_initialized == FALSE){
yami_handle = new_create_dissector_handle(dissect_yami, proto_yami);
yami_prefs_initialized = TRUE; yami_prefs_initialized = TRUE;
yami_tcp_port = global_yami_config_tcp_port; yami_tcp_port = global_yami_config_tcp_port;
yami_udp_port = global_yami_config_udp_port; yami_udp_port = global_yami_config_udp_port;

View File

@ -22,8 +22,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#define NEW_PROTO_TREE_API
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
@ -1813,7 +1811,7 @@ test_length(header_field_info *hfinfo, proto_tree *tree, tvbuff_t *tvb,
/* Add an item to a proto_tree, using the text label registered to that item; /* Add an item to a proto_tree, using the text label registered to that item;
the item is extracted from the tvbuff handed to it. */ the item is extracted from the tvbuff handed to it. */
proto_item * proto_item *
proto_tree_add_item(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb, proto_tree_add_item_new(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
const gint start, gint length, const guint encoding) const gint start, gint length, const guint encoding)
{ {
field_info *new_fi; field_info *new_fi;
@ -1835,10 +1833,10 @@ proto_tree_add_item(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
} }
proto_item * proto_item *
proto_tree_add_item_old(proto_tree *tree, int hfindex, tvbuff_t *tvb, proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
const gint start, gint length, const guint encoding) const gint start, gint length, const guint encoding)
{ {
return proto_tree_add_item(tree, proto_registrar_get_nth(hfindex), tvb, start, length, encoding); return proto_tree_add_item_new(tree, proto_registrar_get_nth(hfindex), tvb, start, length, encoding);
} }
/* Add a FT_NONE to a proto_tree */ /* Add a FT_NONE to a proto_tree */
@ -1876,7 +1874,7 @@ ptvcursor_add_no_advance(ptvcursor_t* ptvc, int hf, gint length,
{ {
proto_item *item; proto_item *item;
item = proto_tree_add_item_old(ptvc->tree, hf, ptvc->tvb, ptvc->offset, item = proto_tree_add_item(ptvc->tree, hf, ptvc->tvb, ptvc->offset,
length, encoding); length, encoding);
return item; return item;
@ -6768,7 +6766,7 @@ proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset,
continue; continue;
} }
proto_tree_add_item_old(tree, **fields, tvb, offset, len, encoding); proto_tree_add_item(tree, **fields, tvb, offset, len, encoding);
if (flags & BMT_NO_APPEND) { if (flags & BMT_NO_APPEND) {
fields++; fields++;
continue; continue;
@ -6876,7 +6874,7 @@ proto_tree_add_bitmask(proto_tree *parent_tree, tvbuff_t *tvb,
len = ftype_length(hf->type); len = ftype_length(hf->type);
if (parent_tree) { if (parent_tree) {
item = proto_tree_add_item_old(parent_tree, hf_hdr, tvb, offset, len, encoding); item = proto_tree_add_item(parent_tree, hf_hdr, tvb, offset, len, encoding);
proto_item_add_bitmask_tree(item, tvb, offset, len, ett, fields, encoding, proto_item_add_bitmask_tree(item, tvb, offset, len, ett, fields, encoding,
BMT_NO_INT|BMT_NO_TFS, FALSE); BMT_NO_INT|BMT_NO_TFS, FALSE);
} }

View File

@ -763,16 +763,11 @@ WS_DLL_PUBLIC void proto_tree_set_appendix(proto_tree *tree, tvbuff_t *tvb, gint
@param encoding data encoding @param encoding data encoding
@return the newly created item */ @return the newly created item */
WS_DLL_PUBLIC proto_item * WS_DLL_PUBLIC proto_item *
proto_tree_add_item(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb, proto_tree_add_item_new(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
const gint start, gint length, const guint encoding); const gint start, gint length, const guint encoding);
#ifndef NEW_PROTO_TREE_API
#define proto_tree_add_item(tree, hfindex, tvb, start, length, encoding) \
proto_tree_add_item_old(tree, hfindex, tvb, start, length, encoding)
#endif
WS_DLL_PUBLIC proto_item * WS_DLL_PUBLIC proto_item *
proto_tree_add_item_old(proto_tree *tree, int hfindex, tvbuff_t *tvb, proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
const gint start, gint length, const guint encoding); const gint start, gint length, const guint encoding);
/** Add a text-only node to a proto_tree. /** Add a text-only node to a proto_tree.
@ -1671,8 +1666,6 @@ proto_register_prefix(const char *prefix, prefix_initializer_t initializer);
/** Initialize every remaining uninitialized prefix. */ /** Initialize every remaining uninitialized prefix. */
WS_DLL_PUBLIC void proto_initialize_all_prefixes(void); WS_DLL_PUBLIC void proto_initialize_all_prefixes(void);
#define HFI_INIT(proto)
WS_DLL_PUBLIC void proto_register_fields(const int parent, header_field_info **hfi, const int num_records); WS_DLL_PUBLIC void proto_register_fields(const int parent, header_field_info **hfi, const int num_records);
/** Register a header_field array. /** Register a header_field array.
@ -2114,6 +2107,25 @@ proto_custom_set(proto_tree* tree, const int field_id,
gchar *result, gchar *result,
gchar *expr, const int size ); gchar *expr, const int size );
#define HFI_INIT(proto)
#ifdef NEW_PROTO_TREE_API
#define proto_tree_add_item(tree, hfinfo, tvb, start, length, encoding) \
proto_tree_add_item_new(tree, hfinfo, tvb, start, length, encoding)
#define proto_tree_add_boolean(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_boolean(tree, (hfinfo)->id, tvb, start, length, value)
#define proto_tree_add_string(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_string(tree, (hfinfo)->id, tvb, start, length, value)
#define proto_tree_add_time(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_time(tree, (hfinfo)->id, tvb, start, length, value)
#define proto_tree_add_uint(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_uint(tree, (hfinfo)->id, tvb, start, length, value)
#endif
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus