diff options
author | Michael Mann <mmann78@netscape.net> | 2014-09-06 08:44:23 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-09-09 01:25:36 +0000 |
commit | 80407a46df538011c1dcea96714c401a4078a697 (patch) | |
tree | f62b063004ba6a8946c552c6a3180cb8f417cd83 /epan | |
parent | 124923b02f3113a1f2aeae205417a18828671850 (diff) |
Eliminate proto_tree_add_text from some of the dissectors.
Other minor cleanups while in the area.
Change-Id: I99096ade9c69a4c148962d45bb6b0bd775040ba1
Reviewed-on: https://code.wireshark.org/review/4020
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
25 files changed, 397 insertions, 287 deletions
diff --git a/epan/dissectors/packet-raw.c b/epan/dissectors/packet-raw.c index 572e02e945..1f81a69cc8 100644 --- a/epan/dissectors/packet-raw.c +++ b/epan/dissectors/packet-raw.c @@ -27,6 +27,7 @@ #include <string.h> #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <wiretap/wtap.h> #include "packet-raw.h" #include "packet-ip.h" @@ -38,6 +39,8 @@ void proto_reg_handoff_raw(void); static int proto_raw = -1; static gint ett_raw = -1; +static expert_field ei_raw_no_link = EI_INIT; + static const char zeroes[10] = {0,0,0,0,0,0,0,0,0,0}; static dissector_handle_t ip_handle; @@ -99,7 +102,6 @@ capture_raw(const guchar *pd, int len, packet_counts *ld) static void dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *fh_tree; proto_item *ti; tvbuff_t *next_tvb; @@ -112,11 +114,8 @@ dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* populate a tree in the second pane with the status of the link layer (ie none) */ - if (tree) { - ti = proto_tree_add_item(tree, proto_raw, tvb, 0, 0, ENC_NA); - fh_tree = proto_item_add_subtree(ti, ett_raw); - proto_tree_add_text(fh_tree, tvb, 0, 0, "No link information available"); - } + ti = proto_tree_add_item(tree, proto_raw, tvb, 0, 0, ENC_NA); + expert_add_info(pinfo, ti, &ei_raw_no_link); if (pinfo->fd->lnk_t == WTAP_ENCAP_RAW_IP4) { call_dissector(ip_handle, tvb, pinfo, tree); @@ -185,8 +184,16 @@ proto_register_raw(void) &ett_raw, }; + static ei_register_info ei[] = { + { &ei_raw_no_link, { "raw.no_link", PI_PROTOCOL, PI_NOTE, "No link information available", EXPFILL }}, + }; + + expert_module_t* expert_raw; + proto_raw = proto_register_protocol("Raw packet data", "Raw", "raw"); proto_register_subtree_array(ett, array_length(ett)); + expert_raw = expert_register_protocol(proto_raw); + expert_register_field_array(expert_raw, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-redback.c b/epan/dissectors/packet-redback.c index f873888f52..473899ed7b 100644 --- a/epan/dissectors/packet-redback.c +++ b/epan/dissectors/packet-redback.c @@ -28,6 +28,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <wiretap/wtap.h> #include "packet-ip.h" @@ -82,11 +83,13 @@ static header_field_info hfi_redback_padding REDBACK_HFI_INIT = static header_field_info hfi_redback_unknown REDBACK_HFI_INIT = { "Unknown", "redback.unknown", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }; +static expert_field ei_redback_protocol = EI_INIT; + static void dissect_redback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint16 l3off, dataoff, proto; - proto_item *ti; + proto_item *ti, *protocol_item; proto_tree *rbtree = NULL; tvbuff_t *next_tvb; @@ -95,21 +98,19 @@ dissect_redback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dataoff = tvb_get_ntohs(tvb, 20); l3off = tvb_get_ntohs(tvb, 22); - if (tree) { - ti = proto_tree_add_item(tree, hfi_redback, tvb, 0, -1, ENC_NA); - rbtree = proto_item_add_subtree(ti, ett_redback); + ti = proto_tree_add_item(tree, hfi_redback, tvb, 0, -1, ENC_NA); + rbtree = proto_item_add_subtree(ti, ett_redback); - proto_tree_add_item(rbtree, &hfi_redback_context, tvb, 0, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(rbtree, &hfi_redback_flags, tvb, 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(rbtree, &hfi_redback_circuit, tvb, 8, 8, ENC_BIG_ENDIAN); - proto_tree_add_item(rbtree, &hfi_redback_length, tvb, 16, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(rbtree, &hfi_redback_protocol, tvb, 18, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(rbtree, &hfi_redback_dataoffset, tvb, 20, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(rbtree, &hfi_redback_l3offset, tvb, 22, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(rbtree, &hfi_redback_context, tvb, 0, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(rbtree, &hfi_redback_flags, tvb, 4, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(rbtree, &hfi_redback_circuit, tvb, 8, 8, ENC_BIG_ENDIAN); + proto_tree_add_item(rbtree, &hfi_redback_length, tvb, 16, 2, ENC_BIG_ENDIAN); + protocol_item = proto_tree_add_item(rbtree, &hfi_redback_protocol, tvb, 18, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(rbtree, &hfi_redback_dataoffset, tvb, 20, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(rbtree, &hfi_redback_l3offset, tvb, 22, 2, ENC_BIG_ENDIAN); - if (dataoff > 24) { - proto_tree_add_item(rbtree, &hfi_redback_padding, tvb, 24, dataoff-24, ENC_NA); - } + if (dataoff > 24) { + proto_tree_add_item(rbtree, &hfi_redback_padding, tvb, 24, dataoff-24, ENC_NA); } proto = tvb_get_ntohs(tvb, 18); @@ -188,8 +189,7 @@ dissect_redback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(ethnofcs_handle, next_tvb, pinfo, tree); break; default: - if (tree) - proto_tree_add_text (rbtree, tvb, 24, -1, "Unknown Protocol Data %u", proto); + expert_add_info(pinfo, protocol_item, &ei_redback_protocol); break; } return; @@ -216,6 +216,11 @@ proto_register_redback(void) &ett_redback }; + static ei_register_info ei[] = { + { &ei_redback_protocol, { "redback.protocol.unknown", PI_PROTOCOL, PI_WARN, "Unknown Protocol Data", EXPFILL }}, + }; + + expert_module_t* expert_redback; int proto_redback; proto_redback = proto_register_protocol("Redback", "Redback", "redback"); @@ -223,6 +228,8 @@ proto_register_redback(void) proto_register_fields(proto_redback, hfi, array_length(hfi)); proto_register_subtree_array(ett, array_length(ett)); + expert_redback = expert_register_protocol(proto_redback); + expert_register_field_array(expert_redback, ei, array_length(ei)); redback_handle = create_dissector_handle(dissect_redback, proto_redback); } diff --git a/epan/dissectors/packet-redbackli.c b/epan/dissectors/packet-redbackli.c index f32bb0c121..013fd7d6da 100644 --- a/epan/dissectors/packet-redbackli.c +++ b/epan/dissectors/packet-redbackli.c @@ -36,6 +36,8 @@ void proto_reg_handoff_redbackli(void); static int proto_redbackli = -1; +static int hf_redbackli_avptype = -1; +static int hf_redbackli_avplen = -1; static int hf_redbackli_seqno = -1; /* Sequence No */ static int hf_redbackli_liid = -1; /* LI Id */ static int hf_redbackli_sessid = -1; /* Session Id */ @@ -78,8 +80,8 @@ redbackli_dissect_avp(guint8 avptype, guint8 avplen, tvbuff_t *tvb, gint offset, st = proto_tree_add_subtree_format(tree, tvb, offset, avplen+2, ett_redbackli, NULL, "%s AVP", avpname); - proto_tree_add_text(st, tvb, offset, 1, "AVP Type: %d", avptype); - proto_tree_add_text(st, tvb, offset+1, 1, "AVP Length: %d", avplen); + proto_tree_add_uint(st, hf_redbackli_avptype, tvb, offset, 1, avptype); + proto_tree_add_uint(st, hf_redbackli_avplen, tvb, offset+1, 1, avplen); if (!avplen) return; @@ -232,6 +234,12 @@ redbackli_dissect_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void } void proto_register_redbackli(void) { static hf_register_info hf[] = { + { &hf_redbackli_avptype, + { "AVP Type", "redbackli.avptype", FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + { &hf_redbackli_avplen, + { "AVP Length", "redbackli.avplen", FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, { &hf_redbackli_seqno, { "Sequence No", "redbackli.seqno", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-rlc-lte.c b/epan/dissectors/packet-rlc-lte.c index 423a244ecc..6c3b2c7404 100644 --- a/epan/dissectors/packet-rlc-lte.c +++ b/epan/dissectors/packet-rlc-lte.c @@ -222,6 +222,7 @@ static expert_field ei_rlc_lte_um_sn_missing = EI_INIT; static expert_field ei_rlc_lte_sequence_analysis_ack_out_of_range_opposite_frame = EI_INIT; static expert_field ei_rlc_lte_sequence_analysis_last_segment_not_continued = EI_INIT; static expert_field ei_rlc_lte_reserved_bits_not_zero = EI_INIT; +static expert_field ei_rlc_lte_no_per_frame_info = EI_INIT; /* Value-strings */ static const value_string direction_vals[] = @@ -2786,9 +2787,7 @@ static void dissect_rlc_lte_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* Can't dissect anything without it... */ if (p_rlc_lte_info == NULL) { - ti = proto_tree_add_text(rlc_lte_tree, tvb, offset, -1, - "Can't dissect LTE RLC frame because no per-frame info was attached!"); - PROTO_ITEM_SET_GENERATED(ti); + proto_tree_add_expert(rlc_lte_tree, pinfo, &ei_rlc_lte_no_per_frame_info, tvb, offset, -1); return; } @@ -3405,6 +3404,7 @@ void proto_register_rlc_lte(void) { &ei_rlc_lte_am_data_no_data_beyond_extensions, { "rlc-lte.am-data.no-data-beyond-extensions", PI_MALFORMED, PI_ERROR, "AM data PDU doesn't contain any data beyond extensions", EXPFILL }}, { &ei_rlc_lte_am_data_no_data, { "rlc-lte.am-data.no-data", PI_MALFORMED, PI_ERROR, "AM data PDU doesn't contain any data", EXPFILL }}, { &ei_rlc_lte_context_mode, { "rlc-lte.mode.invalid", PI_MALFORMED, PI_ERROR, "Unrecognised RLC Mode set", EXPFILL }}, + { &ei_rlc_lte_no_per_frame_info, { "rlc-lte.no_per_frame_info", PI_UNDECODED, PI_ERROR, "Can't dissect LTE RLC frame because no per-frame info was attached!", EXPFILL }}, }; static const enum_val_t sequence_analysis_vals[] = { diff --git a/epan/dissectors/packet-rlogin.c b/epan/dissectors/packet-rlogin.c index b24112cfa4..d5c157e500 100644 --- a/epan/dissectors/packet-rlogin.c +++ b/epan/dissectors/packet-rlogin.c @@ -58,6 +58,7 @@ static int hf_user_info_server_user_name = -1; static int hf_user_info_terminal_type = -1; static int hf_user_info_terminal_speed = -1; static int hf_control_message = -1; +static int hf_magic_cookie = -1; static int hf_window_info = -1; static int hf_window_info_ss = -1; static int hf_window_info_rows = -1; @@ -334,7 +335,7 @@ static void rlogin_display(rlogin_hash_entry_t *hash_info, window_tree = proto_item_add_subtree(window_info_item, ett_rlogin_window); /* Cookie */ - proto_tree_add_text(window_tree, tvb, offset, 2, "Magic Cookie: (0xff, 0xff)"); + proto_tree_add_item(window_tree, hf_magic_cookie, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* These bytes should be "ss" */ @@ -531,6 +532,11 @@ void proto_register_rlogin(void) VALS(control_message_vals), 0x0, NULL, HFILL } }, + { &hf_magic_cookie, + { "Magic Cookie", "rlogin.magic_cookie", FT_UINT16, BASE_HEX, + NULL, 0x0, NULL, HFILL + } + }, { &hf_window_info, { "Window Info", "rlogin.window_size", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL diff --git a/epan/dissectors/packet-rmcp.c b/epan/dissectors/packet-rmcp.c index 72882bf233..446a97e3bf 100644 --- a/epan/dissectors/packet-rmcp.c +++ b/epan/dissectors/packet-rmcp.c @@ -46,6 +46,7 @@ static int hf_rmcp_version = -1; static int hf_rmcp_sequence = -1; static int hf_rmcp_class = -1; static int hf_rmcp_type = -1; +static int hf_rmcp_trailer = -1; static int proto_rsp = -1; static int hf_rsp_session_id = -1; @@ -142,8 +143,7 @@ dissect_rmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ tree)) { len = call_dissector(data_handle, next_tvb, pinfo, tree); if (len < tvb_length(next_tvb)) { - proto_tree_add_text(tree, tvb, 4 + len, -1, - "RSP Trailer (%d bytes):", tvb_length(next_tvb) - len); + proto_tree_add_item(tree, hf_rmcp_trailer, tvb, 4 + len, -1, ENC_NA); } } } @@ -201,7 +201,11 @@ proto_register_rmcp(void) "Message Type", "rmcp.type", FT_UINT8, BASE_HEX, VALS(rmcp_type_vals), RMCP_TYPE_MASK, - "RMCP Message Type", HFILL }} + "RMCP Message Type", HFILL }}, + { &hf_rmcp_trailer, { + "RSP Trailer", "rmcp.trailer", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, }; static gint *ett[] = { &ett_rmcp, diff --git a/epan/dissectors/packet-rmp.c b/epan/dissectors/packet-rmp.c index cd58e4d275..549d520a8b 100644 --- a/epan/dissectors/packet-rmp.c +++ b/epan/dissectors/packet-rmp.c @@ -45,6 +45,7 @@ static int hf_rmp_machtype = -1; static int hf_rmp_filename = -1; static int hf_rmp_offset = -1; static int hf_rmp_size = -1; +static int hf_rmp_reserved = -1; static gint ett_rmp = -1; @@ -190,8 +191,8 @@ dissect_rmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case RMP_BOOT_DONE: proto_tree_add_item(rmp_tree, hf_rmp_retcode, tvb, 1, 1, ENC_BIG_ENDIAN); - proto_tree_add_text(rmp_tree, - tvb, 2, 4, "Reserved"); + proto_tree_add_item(rmp_tree, + hf_rmp_reserved, tvb, 2, 4, ENC_BIG_ENDIAN); proto_tree_add_item(rmp_tree, hf_rmp_sessionid, tvb, 6, 2, ENC_BIG_ENDIAN); if(tvb_offset_exists(tvb, 8)) @@ -237,7 +238,11 @@ proto_register_rmp(void) { &hf_rmp_size, { "Size", "rmp.size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_rmp_reserved, + { "Reserved", "rmp.reserved", FT_UINT32, BASE_HEX, + NULL, 0x0, NULL, HFILL }}, }; + static gint *ett[] = { &ett_rmp, }; diff --git a/epan/dissectors/packet-roofnet.c b/epan/dissectors/packet-roofnet.c index 91bbf2667d..aed70325b3 100644 --- a/epan/dissectors/packet-roofnet.c +++ b/epan/dissectors/packet-roofnet.c @@ -104,6 +104,7 @@ static gint ett_roofnet = -1; static gint ett_roofnet_link = -1; static expert_field ei_roofnet_too_many_links = EI_INIT; +static expert_field ei_roofnet_too_much_data = EI_INIT; /* * dissect the header of roofnet @@ -179,7 +180,7 @@ static void dissect_roofnet_data(proto_tree *tree, tvbuff_t *tvb, packet_info * /* dissect on remaining_datalen */ if (roofnet_datalen < remaining_datalen) - proto_tree_add_text(tree, tvb, offset, roofnet_datalen, + proto_tree_add_expert_format(tree, pinfo, &ei_roofnet_too_much_data, tvb, offset, roofnet_datalen, "[More payload data (%u) than told by Roofnet (%u)]", remaining_datalen, roofnet_datalen); @@ -333,6 +334,7 @@ void proto_register_roofnet(void) static ei_register_info ei[] = { { &ei_roofnet_too_many_links, { "roofnet.too_many_links", PI_MALFORMED, PI_ERROR, "Too many links", EXPFILL }}, + { &ei_roofnet_too_much_data, { "roofnet.too_much_data", PI_MALFORMED, PI_ERROR, "More payload data than told by Roofnet", EXPFILL }}, }; expert_module_t* expert_roofnet; diff --git a/epan/dissectors/packet-rpl.c b/epan/dissectors/packet-rpl.c index 9239d0fff7..d3545e8786 100644 --- a/epan/dissectors/packet-rpl.c +++ b/epan/dissectors/packet-rpl.c @@ -35,6 +35,7 @@ void proto_reg_handoff_rpl(void); static int proto_rpl = -1; static int hf_rpl_type = -1; +static int hf_rpl_len = -1; static int hf_rpl_corrval = -1; static int hf_rpl_respval = -1; static int hf_rpl_maxframe = -1; @@ -104,11 +105,10 @@ dissect_rpl_container(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint length, reported_length; len = tvb_get_ntohs(tvb, 0); - proto_tree_add_text(tree, tvb, 0, 2, "Length: %u", len); + proto_tree_add_item(tree, hf_rpl_len, tvb, 0, 2, ENC_BIG_ENDIAN); type = tvb_get_ntohs(tvb, 2); - proto_tree_add_text(tree, tvb, 2, 2, "Type: %s", - val_to_str_const(type, rpl_type_vals, "Unknown Type")); + proto_tree_add_item(tree, hf_rpl_type, tvb, 2, 2, ENC_BIG_ENDIAN); offset = 4; switch (type) { @@ -264,7 +264,7 @@ static void dissect_rpl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint16 rpl_len, rpl_type; - proto_item *ti, *hidden_item; + proto_item *ti; proto_tree *rpl_tree; tvbuff_t *next_tvb; @@ -276,22 +276,17 @@ dissect_rpl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(rpl_type, rpl_type_vals, "Unknown Type")); - if (tree) { - ti = proto_tree_add_item(tree, proto_rpl, tvb, 0, - rpl_len, ENC_NA); - rpl_tree = proto_item_add_subtree(ti, ett_rpl); - hidden_item = proto_tree_add_uint(rpl_tree, hf_rpl_type, tvb, 2, 2, - rpl_type); - PROTO_ITEM_SET_HIDDEN(hidden_item); - next_tvb = tvb_new_subset_remaining(tvb, 0); - set_actual_length(next_tvb, rpl_len); - dissect_rpl_container(next_tvb, pinfo, rpl_tree); - - if (tvb_reported_length(tvb) > rpl_len) - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, rpl_len), pinfo, - tree); - } + ti = proto_tree_add_item(tree, proto_rpl, tvb, 0, + rpl_len, ENC_NA); + rpl_tree = proto_item_add_subtree(ti, ett_rpl); + next_tvb = tvb_new_subset_remaining(tvb, 0); + set_actual_length(next_tvb, rpl_len); + dissect_rpl_container(next_tvb, pinfo, rpl_tree); + + if (tvb_reported_length(tvb) > rpl_len) + call_dissector(data_handle, + tvb_new_subset_remaining(tvb, rpl_len), pinfo, + tree); } void @@ -300,8 +295,12 @@ proto_register_rpl(void) static hf_register_info hf[] = { { &hf_rpl_type, { "Type", "rpl.type", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC, VALS(rpl_type_vals), 0x0, "RPL Packet Type", HFILL }}, + { &hf_rpl_len, + { "Length", "rpl.len", + FT_UINT16, BASE_DEC, NULL, 0x0, + "RPL Packet Length", HFILL }}, { &hf_rpl_corrval, { "Correlator Value", "rpl.corrval", FT_UINT32, BASE_HEX, NULL, 0x0, diff --git a/epan/dissectors/packet-rsh.c b/epan/dissectors/packet-rsh.c index c5436229fe..ccb2ee0286 100644 --- a/epan/dissectors/packet-rsh.c +++ b/epan/dissectors/packet-rsh.c @@ -56,6 +56,8 @@ static int hf_rsh_stderr_port = -1; static int hf_rsh_client_username = -1; static int hf_rsh_server_username = -1; static int hf_rsh_command = -1; +static int hf_rsh_client_server_data = -1; +static int hf_rsh_server_client_data = -1; /* Initialize the subtree pointers */ static gint ett_rsh = -1; @@ -344,13 +346,13 @@ dissect_rsh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(pinfo->destport == RSH_PORT){ /* Packet going to the server */ /* offset = 0 since the whole packet is data */ - proto_tree_add_text(rsh_tree, tvb, 0, -1, "Client -> Server Data"); + proto_tree_add_item(rsh_tree, hf_rsh_client_server_data, tvb, 0, -1, ENC_NA); col_append_str(pinfo->cinfo, COL_INFO, "Client -> Server data"); } else { /* This packet must be going back to the client */ /* offset = 0 since the whole packet is data */ - proto_tree_add_text(rsh_tree, tvb, 0, -1, "Server -> Client Data"); + proto_tree_add_item(rsh_tree, hf_rsh_server_client_data, tvb, 0, -1, ENC_NA); col_append_str(pinfo->cinfo, COL_INFO, "Server -> Client Data"); } @@ -380,7 +382,15 @@ proto_register_rsh(void) { &hf_rsh_command, { "Command to execute", "rsh.command", FT_STRINGZ, BASE_NONE, NULL, 0, - "Command client is requesting the server to run", HFILL } } + "Command client is requesting the server to run", HFILL } }, + + { &hf_rsh_client_server_data, { "Client -> Server Data", "rsh.client_server_data", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } }, + + { &hf_rsh_server_client_data, { "Server -> Client Data", "rsh.server_client_data", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } }, }; diff --git a/epan/dissectors/packet-rsip.c b/epan/dissectors/packet-rsip.c index cf8681b1b2..c5557dd7f8 100644 --- a/epan/dissectors/packet-rsip.c +++ b/epan/dissectors/packet-rsip.c @@ -341,8 +341,7 @@ rsip_parameter(tvbuff_t *tvb, proto_tree *rsip_tree, int off, int eoff) ": Any Fully Qualified Domain Name"); break; default: - proto_tree_add_text(p_tree, tvb, off + 4, - paramlen - 1, ": Unknown Address Type"); + proto_item_append_text(pti, ": Unknown Address Type"); break; } break; diff --git a/epan/dissectors/packet-s5066dts.c b/epan/dissectors/packet-s5066dts.c index d9151dd605..3dfc9ff3c8 100644 --- a/epan/dissectors/packet-s5066dts.c +++ b/epan/dissectors/packet-s5066dts.c @@ -93,6 +93,8 @@ static gint hf_s5066dts_header_size = -1; static gint hf_s5066dts_header_crc = -1; static gint hf_s5066dts_cpdu_crc = -1; static gint hf_s5066dts_segmented_cpdu = -1; +static gint hf_s5066dts_dest_addr = -1; +static gint hf_s5066dts_src_addr = -1; /* EOW TYPES */ /* { 1, "DRC_REQUEST"}, */ @@ -454,6 +456,16 @@ static guint dissect_s5066dts_eow(tvbuff_t *tvb, packet_info * pinfo, guint off return ++offset; } +static void +s5066dts_address_format( gchar *result, guint32 address_value ) +{ + g_snprintf( result, ITEM_LABEL_LENGTH, "%d.%d.%d.%d", + address_value >> 24, + (address_value >> 16) & 0xFF, + (address_value >> 8) & 0xFF, + address_value & 0xFF); +} + static guint dissect_s5066dts_address(tvbuff_t *tvb, guint offset, proto_tree *tree, packet_info *pinfo, guint addr_size) { @@ -473,22 +485,8 @@ static guint dissect_s5066dts_address(tvbuff_t *tvb, guint offset, proto_tree *t address_tree = proto_tree_add_subtree(tree, tvb, offset, addr_size, ett_s5066dts_address, NULL, "Destination & Source Addresses"); - proto_tree_add_text(address_tree, - tvb, - offset, - addr_size - addr_size / 2, - "Destination Address: %d.%d.%d.%d", - destination_address >> 24, (destination_address >> 16) & 0xFF, - (destination_address >> 8) & 0xFF, destination_address & 0xFF); - proto_tree_add_text(address_tree, - tvb, - offset + addr_size / 2, - addr_size - addr_size / 2, - "Source Address: %d.%d.%d.%d", - source_address >> 24, - (source_address >> 16) & 0xFF, - (source_address >> 8) & 0xFF, - source_address & 0xFF); + proto_tree_add_uint(address_tree, hf_s5066dts_dest_addr, tvb, offset, addr_size - addr_size / 2, destination_address); + proto_tree_add_uint(address_tree, hf_s5066dts_src_addr, tvb, offset + addr_size / 2, addr_size - addr_size / 2, source_address); col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "%d.%d.%d.%d", source_address >> 24, @@ -952,347 +950,353 @@ void proto_register_s5066dts (void) module_t *s5066dts_module; static hf_register_info hf[] = { { &hf_s5066dts_sync_word, - { "Sync preamble", "s5066dts.sync", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL } + { "Sync preamble", "s5066dts.sync", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_dpdu_type, - { "D_PDU type", "s5066dts.type", FT_UINT8, BASE_DEC, VALS(s5066dts_dpdu_type), 0xF0, "", HFILL } + { "D_PDU type", "s5066dts.type", FT_UINT8, BASE_DEC, VALS(s5066dts_dpdu_type), 0xF0, NULL, HFILL } }, { &hf_s5066dts_eow_type, - { "EOW type", "s5066dts.eow.type", FT_UINT8, BASE_DEC, VALS(s5066dts_eow_type), 0x0F, "", HFILL } + { "EOW type", "s5066dts.eow.type", FT_UINT8, BASE_DEC, VALS(s5066dts_eow_type), 0x0F, NULL, HFILL } }, { &hf_s5066dts_eow_data, - { "EOW data", "s5066dts.eow.data", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL } + { "EOW data", "s5066dts.eow.data", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_eot, - { "EOT", "s5066dts.eot", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } + { "EOT", "s5066dts.eot", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_address_size, - { "Address size (1/2 bytes)", "s5066dts.address.size", FT_UINT8, BASE_DEC, NULL, 0xE0, "", HFILL } + { "Address size (1/2 bytes)", "s5066dts.address.size", FT_UINT8, BASE_DEC, NULL, 0xE0, NULL, HFILL } }, { &hf_s5066dts_header_size, - { "Header size", "s5066dts.header_size", FT_UINT8, BASE_DEC, NULL, 0x1F, "", HFILL } + { "Header size", "s5066dts.header_size", FT_UINT8, BASE_DEC, NULL, 0x1F, NULL, HFILL } }, { &hf_s5066dts_segmented_cpdu, - { "C_PDU Segment", "s5066dts.segmented_cpdu", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL } + { "C_PDU Segment", "s5066dts.segmented_cpdu", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_s5066dts_dest_addr, + { "Destination Address", "s5066dts.dest_addr", FT_UINT32, BASE_CUSTOM, s5066dts_address_format, 0x0, NULL, HFILL } + }, + { &hf_s5066dts_src_addr, + { "Source Address", "s5066dts.src_addr", FT_UINT32, BASE_CUSTOM, s5066dts_address_format, 0x0, NULL, HFILL } }, { &hf_s5066dts_header_crc, - { "CRC on header", "s5066dts.header_crc", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL } + { "CRC on header", "s5066dts.header_crc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_cpdu_crc, - { "CRC on C_PDU segment", "s5066dts.cpdu_crc", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL } + { "CRC on C_PDU segment", "s5066dts.cpdu_crc", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* { 1, "DRC_REQUEST"}, */ { &hf_s5066dts_eow_drc_request_data_rate, { "Data Rate", "s5066dts.eow.drc_request.data_rate", FT_UINT8, BASE_DEC, VALS(s5066dts_eow_data_rate), - 0xF0, "", HFILL } + 0xF0, NULL, HFILL } }, { &hf_s5066dts_eow_drc_request_interleaving, { "Interleaver parameter", "s5066dts.eow.drc_request.interleaving", FT_UINT8, BASE_DEC, - VALS(s5066dts_eow_interleaving), 0x0C, "", HFILL } + VALS(s5066dts_eow_interleaving), 0x0C, NULL, HFILL } }, { &hf_s5066dts_eow_drc_request_others, { "Other parameters", "s5066dts.eow.drc_request.others", FT_UINT8, BASE_DEC, - VALS(s5066dts_eow_others), 0x03, "", HFILL } + VALS(s5066dts_eow_others), 0x03, NULL, HFILL } }, /* { 2, "DRC_RESPONSE"}, */ { &hf_s5066dts_eow_drc_response_response, { "Response for DRC", "s5066dts.eow.drc_response.response", FT_UINT8, BASE_DEC, - VALS(s5066dts_eow_response), 0xE0, "", HFILL } + VALS(s5066dts_eow_response), 0xE0, NULL, HFILL } }, { &hf_s5066dts_eow_drc_response_reason, { "Reason", "s5066dts.eow.drc_response.reason", FT_UINT8, BASE_DEC, - VALS(s5066dts_eow_reason), 0x1F, "", HFILL } + VALS(s5066dts_eow_reason), 0x1F, NULL, HFILL } }, /* { 3, "UNRECOGNIZED_TYPE"}, */ { &hf_s5066dts_eow_unrec_type_response, { "This value should be set to 0", "s5066dts.eow.unrec_type.response", FT_UINT8, BASE_DEC, - NULL, 0xE0, "", HFILL } + NULL, 0xE0, NULL, HFILL } }, { &hf_s5066dts_eow_unrec_type_reason, - { "Reason", "s5066dts.eow.unrec_type.reason", FT_UINT8, BASE_DEC, NULL, 0x1F, "", HFILL } + { "Reason", "s5066dts.eow.unrec_type.reason", FT_UINT8, BASE_DEC, NULL, 0x1F, NULL, HFILL } }, /* { 4, "CAPABILITY"}, */ { &hf_s5066dts_eow_capability_adaptive, - { "Adaptive modem parameters capable", "s5066dts.eow.capability.adaptive", FT_BOOLEAN, 8, NULL, 0x80, "", HFILL } + { "Adaptive modem parameters capable", "s5066dts.eow.capability.adaptive", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL } }, { &hf_s5066dts_eow_capability_stanag_4529, - { "STANAG 4529 available", "s5066dts.eow.capability.stanag_4529", FT_BOOLEAN, 8, NULL, 0x40, "", HFILL } + { "STANAG 4529 available", "s5066dts.eow.capability.stanag_4529", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL } }, { &hf_s5066dts_eow_capability_mil_std_188_110a, - { "MIL-STD-188-110A available", "s5066dts.eow.capability.mil_std_188_110a", FT_BOOLEAN, 8, NULL, 0x20, "", HFILL } + { "MIL-STD-188-110A available", "s5066dts.eow.capability.mil_std_188_110a", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } }, { &hf_s5066dts_eow_capability_extended, - { "Extended data rate available", "s5066dts.eow.capability.extended", FT_BOOLEAN, 8, NULL, 0x10, "", HFILL } + { "Extended data rate available", "s5066dts.eow.capability.extended", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL } }, { &hf_s5066dts_eow_capability_full_duplex, - { "Full duplex supported", "s5066dts.eow.capability.full_duplex", FT_BOOLEAN, 8, NULL, 0x08, "", HFILL } + { "Full duplex supported", "s5066dts.eow.capability.full_duplex", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL } }, { &hf_s5066dts_eow_capability_split_frequency, - { "Split frequency supported", "s5066dts.eow.capability.split_frequency", FT_BOOLEAN, 8, NULL, 0x04, "", HFILL } + { "Split frequency supported", "s5066dts.eow.capability.split_frequency", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } }, { &hf_s5066dts_eow_capability_non_arcs_ale, - { "Non-ARCS ALE capable", "s5066dts.eow.capability.non_arcs_ale", FT_BOOLEAN, 8, NULL, 0x02, "", HFILL } + { "Non-ARCS ALE capable", "s5066dts.eow.capability.non_arcs_ale", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL } }, { &hf_s5066dts_eow_capability_arcs, - { "ARCS capable", "s5066dts.eow.capability.arcs", FT_BOOLEAN, 8, NULL, 0x01, "", HFILL } + { "ARCS capable", "s5066dts.eow.capability.arcs", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL } }, /* { 5, "ALM_REQUEST"}, */ { &hf_s5066dts_eow_alm_request_data_rate, { "Data Rate", "s5066dts.eow.alm_request.data_rate", FT_UINT8, BASE_DEC, - VALS(s5066dts_eow_data_rate), 0xF0, "", HFILL } + VALS(s5066dts_eow_data_rate), 0xF0, NULL, HFILL } }, { &hf_s5066dts_eow_alm_request_interleaving, { "Interleaver parameter", "s5066dts.eow.alm_request.interleaving", FT_UINT8, BASE_DEC, - VALS(s5066dts_eow_interleaving), 0x0C, "", HFILL } + VALS(s5066dts_eow_interleaving), 0x0C, NULL, HFILL } }, { &hf_s5066dts_eow_alm_request_others, { "Other parameters", "s5066dts.eow.alm_request.others", FT_UINT8, BASE_DEC, - VALS(s5066dts_eow_others), 0x03, "", HFILL } + VALS(s5066dts_eow_others), 0x03, NULL, HFILL } }, /* { 6, "ALM_RESPONSE"}, */ { &hf_s5066dts_eow_alm_response_response, { "Response for DRC", "s5066dts.eow.alm_response.response", FT_UINT8, BASE_DEC, - VALS(s5066dts_eow_response), 0xE0, "", HFILL } + VALS(s5066dts_eow_response), 0xE0, NULL, HFILL } }, { &hf_s5066dts_eow_alm_response_reason, - { "Reason", "s5066dts.eow.alm_response.reason", FT_UINT8, BASE_DEC, VALS(s5066dts_alm_reason), 0x1F, "", HFILL } + { "Reason", "s5066dts.eow.alm_response.reason", FT_UINT8, BASE_DEC, VALS(s5066dts_alm_reason), 0x1F, NULL, HFILL } }, /* { 7, "HDR_DRC_REQUEST"}, */ { &hf_s5066dts_eow_hdr_drc_request_waveform, { "Modem waveform", "s5066dts.eow.hdr_drc_request.waveform", FT_UINT8, BASE_DEC, - VALS(s5066dts_eow_waveform), 0xF8, "", HFILL } + VALS(s5066dts_eow_waveform), 0xF8, NULL, HFILL } }, { &hf_s5066dts_eow_hdr_drc_request_num_channels, - { "Number of channels", "s5066dts.eow.hdr_drc_request.num_channels", FT_UINT8, BASE_DEC, NULL, 0x07, "", HFILL } + { "Number of channels", "s5066dts.eow.hdr_drc_request.num_channels", FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL } }, { &hf_s5066dts_eow_hdr_drc_request_data_rate, { "Requested data rate for each channel", "s5066dts.eow.hdr_drc_request.data_rate", - FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } + FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_eow_hdr_drc_request_interleaver_length, { "Interleaver length for each channel", "s5066dts.eow.hdr_drc_request.interleaver_length", - FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL } + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* { 15, "HFTRP FRAME CONTROL"}, */ { &hf_s5066dts_eow_hftrp_hftrp_token, - { "HFTRP Token Type", "s5066dts.eow.hftrp.token_type", FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL } + { "HFTRP Token Type", "s5066dts.eow.hftrp.token_type", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL } }, /* { 0, "DATA_ONLY"}, */ { &hf_s5066dts_data_only_cpdu_start, - { "C_PDU Start", "s5066dts.data_only.cpdu_start", FT_BOOLEAN, 8, NULL, 0x80, "", HFILL } + { "C_PDU Start", "s5066dts.data_only.cpdu_start", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL } }, { &hf_s5066dts_data_only_cpdu_end, - { "C_PDU End", "s5066dts.data_only.cpdu_end", FT_BOOLEAN, 8, NULL, 0x40, "", HFILL } + { "C_PDU End", "s5066dts.data_only.cpdu_end", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL } }, { &hf_s5066dts_data_only_deliver_in_order, - { "C_PDU Deliver-in-Order", "s5066dts.data_only.deliver_in_order", FT_BOOLEAN, 8, NULL, 0x20, "", HFILL } + { "C_PDU Deliver-in-Order", "s5066dts.data_only.deliver_in_order", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } }, { &hf_s5066dts_data_only_drop_cpdu, - { "Drop C_PDU", "s5066dts.data_only.drop_cpdu", FT_BOOLEAN, 8, NULL, 0x10, "", HFILL } + { "Drop C_PDU", "s5066dts.data_only.drop_cpdu", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL } }, { &hf_s5066dts_data_only_tx_win_uwe, - { "TX WIN UWE", "s5066dts.data_only.tx_win_uwe", FT_BOOLEAN, 8, NULL, 0x08, "", HFILL } + { "TX WIN UWE", "s5066dts.data_only.tx_win_uwe", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL } }, { &hf_s5066dts_data_only_tx_win_lwe, - { "TX WIN LWE", "s5066dts.data_only.tx_win_lwe", FT_BOOLEAN, 8, NULL, 0x04, "", HFILL } + { "TX WIN LWE", "s5066dts.data_only.tx_win_lwe", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } }, { &hf_s5066dts_data_only_segmented_cpdu_size, { "Size of segmented C_PDU", "s5066dts.data_only.segmented_cpdu_size", FT_UINT16, BASE_DEC, - NULL, 0x03FF, "", HFILL } + NULL, 0x03FF, NULL, HFILL } }, { &hf_s5066dts_data_only_transmit_sequence_number, { "TX Frame Sequence Number", "s5066dts.data_only.transmit_sequence_number", FT_UINT8, BASE_DEC, - NULL, 0x0, "", HFILL } + NULL, 0x0, NULL, HFILL } }, /* { 1, "ACK_ONLY"}, */ { &hf_s5066dts_ack_only_rx_lwe, - { "RX LWE", "s5066dts.ack_only.rx_lwe", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } + { "RX LWE", "s5066dts.ack_only.rx_lwe", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_ack_only_acks, - { "Selective ACK", "s5066dts.ack_only.acks", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL } + { "Selective ACK", "s5066dts.ack_only.acks", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, /* { 2, "DATA_ACK"}, */ { &hf_s5066dts_data_ack_cpdu_start, - { "C_PDU Start", "s5066dts.data_ack.cpdu_start", FT_BOOLEAN, 8, NULL, 0x80, "", HFILL } + { "C_PDU Start", "s5066dts.data_ack.cpdu_start", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL } }, { &hf_s5066dts_data_ack_cpdu_end, - { "C_PDU End", "s5066dts.data_ack.cpdu_end", FT_BOOLEAN, 8, NULL, 0x40, "", HFILL } + { "C_PDU End", "s5066dts.data_ack.cpdu_end", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL } }, { &hf_s5066dts_data_ack_deliver_in_order, - { "C_PDU Deliver-in-Order", "s5066dts.data_ack.deliver_in_order", FT_BOOLEAN, 8, NULL, 0x20, "", HFILL } + { "C_PDU Deliver-in-Order", "s5066dts.data_ack.deliver_in_order", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } }, { &hf_s5066dts_data_ack_drop_cpdu, - { "Drop C_PDU", "s5066dts.data_ack.drop_cpdu", FT_BOOLEAN, 8, NULL, 0x10, "", HFILL } + { "Drop C_PDU", "s5066dts.data_ack.drop_cpdu", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL } }, { &hf_s5066dts_data_ack_tx_win_uwe, - { "TX WIN UWE", "s5066dts.data_ack.tx_win_uwe", FT_BOOLEAN, 8, NULL, 0x08, "", HFILL } + { "TX WIN UWE", "s5066dts.data_ack.tx_win_uwe", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL } }, { &hf_s5066dts_data_ack_tx_win_lwe, - { "TX WIN LWE", "s5066dts.data_ack.tx_win_lwe", FT_BOOLEAN, 8, NULL, 0x04, "", HFILL } + { "TX WIN LWE", "s5066dts.data_ack.tx_win_lwe", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } }, { &hf_s5066dts_data_ack_segmented_cpdu_size, { "Size of segmented C_PDU", "s5066dts.data_ack.segmented_cpdu_size", FT_UINT16, BASE_DEC, - NULL, 0x03FF, "", HFILL } + NULL, 0x03FF, NULL, HFILL } }, { &hf_s5066dts_data_ack_transmit_sequence_number, { "TX frame sequence number", "s5066dts.data_ack.transmit_sequence_number", FT_UINT8, BASE_DEC, - NULL, 0x0, "", HFILL } + NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_data_ack_rx_lwe, - { "RX LWE", "s5066dts.data_ack.rx_lwe", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } + { "RX LWE", "s5066dts.data_ack.rx_lwe", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_data_ack_acks, - { "Selective ACK", "s5066dts.data_ack.acks", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL } + { "Selective ACK", "s5066dts.data_ack.acks", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, /* { 3, "RESET_WIN_RESYNC"}, */ { &hf_s5066dts_reset_win_resync_unused, - { "Unused", "s5066dts.reset_win_resync.unused", FT_UINT8, BASE_HEX, NULL, 0xF0, "", HFILL } + { "Unused", "s5066dts.reset_win_resync.unused", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL } }, { &hf_s5066dts_reset_win_resync_full_reset_command, - { "Full reset command", "s5066dts.reset_win_resync.full_reset", FT_BOOLEAN, 8, NULL, 0x08, "", HFILL } + { "Full reset command", "s5066dts.reset_win_resync.full_reset", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL } }, { &hf_s5066dts_reset_win_resync_reset_tx_win_rqst, - { "Reset TX-WIN request", "s5066dts.reset_win_resync.reset_tx_win", FT_BOOLEAN, 8, NULL, 0x04, "", HFILL } + { "Reset TX-WIN request", "s5066dts.reset_win_resync.reset_tx_win", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } }, { &hf_s5066dts_reset_win_resync_reset_rx_win_cmnd, - { "Reset RX-WIN command", "s5066dts.reset_win_resync.reset_rx_win", FT_BOOLEAN, 8, NULL, 0x02, "", HFILL } + { "Reset RX-WIN command", "s5066dts.reset_win_resync.reset_rx_win", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL } }, { &hf_s5066dts_reset_win_resync_reset_ack, - { "Reset acknowledgment", "s5066dts.reset_win_resync.reset_ack", FT_BOOLEAN, 8, NULL, 0x01, "", HFILL } + { "Reset acknowledgment", "s5066dts.reset_win_resync.reset_ack", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL } }, { &hf_s5066dts_reset_win_resync_new_rx_lwe, - { "New receiver ARQ RX-LWE", "s5066dts.reset_win_resync.new_rx_lwe", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } + { "New receiver ARQ RX-LWE", "s5066dts.reset_win_resync.new_rx_lwe", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_reset_win_resync_reset_frame_id_number, - { "Reset frame ID number", "s5066dts.reset_win_resync.reset_frame_id", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } + { "Reset frame ID number", "s5066dts.reset_win_resync.reset_frame_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* { 4, "EXP_DATA_ONLY"}, */ { &hf_s5066dts_exp_data_only_cpdu_start, - { "C_PDU Start", "s5066dts.exp_data_only.cpdu_start", FT_BOOLEAN, 8, NULL, 0x80, "", HFILL } + { "C_PDU Start", "s5066dts.exp_data_only.cpdu_start", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL } }, { &hf_s5066dts_exp_data_only_cpdu_end, - { "C_PDU End", "s5066dts.exp_data_only.cpdu_end", FT_BOOLEAN, 8, NULL, 0x40, "", HFILL } + { "C_PDU End", "s5066dts.exp_data_only.cpdu_end", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL } }, { &hf_s5066dts_exp_data_only_cpdu_id, - { "Segmented C_PDU ID", "s5066dts.exp_data_only.cpdu_id", FT_UINT8, BASE_DEC, NULL, 0x3C, "", HFILL } + { "Segmented C_PDU ID", "s5066dts.exp_data_only.cpdu_id", FT_UINT8, BASE_DEC, NULL, 0x3C, NULL, HFILL } }, { &hf_s5066dts_exp_data_only_segmented_cpdu_size, - { "Size of segmented C_PDU", "s5066dts.exp_data_only.segmented_cpdu_size", FT_UINT16, BASE_DEC, NULL, 0x03FF, "", HFILL } + { "Size of segmented C_PDU", "s5066dts.exp_data_only.segmented_cpdu_size", FT_UINT16, BASE_DEC, NULL, 0x03FF, NULL, HFILL } }, { &hf_s5066dts_exp_data_only_transmit_sequence_number, - { "TX frame sequence number", "s5066dts.exp_data_only.transmit_sequence_number", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } + { "TX frame sequence number", "s5066dts.exp_data_only.transmit_sequence_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* { 5, "EXP_ACK_ONLY"}, */ { &hf_s5066dts_exp_ack_only_rx_lwe, - { "RX LWE", "s5066dts.exp_ack_only.rx_lwe", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } + { "RX LWE", "s5066dts.exp_ack_only.rx_lwe", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_exp_ack_only_acks, - { "Selective ACK", "s5066dts.exp_ack_only.acks", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL } + { "Selective ACK", "s5066dts.exp_ack_only.acks", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, /* { 6, "MANAGEMENT"}, */ { &hf_s5066dts_management_unused, - { "Unused", "s5066dts.management.unused", FT_UINT8, BASE_HEX, NULL, 0xF8, "", HFILL } + { "Unused", "s5066dts.management.unused", FT_UINT8, BASE_HEX, NULL, 0xF8, NULL, HFILL } }, { &hf_s5066dts_management_extended_message_flag, - { "Extended message flag", "s5066dts.management.extended_message_flag", FT_BOOLEAN, 8, NULL, 0x04, "", HFILL } + { "Extended message flag", "s5066dts.management.extended_message_flag", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } }, { &hf_s5066dts_management_message, - { "Valid message", "s5066dts.management.message", FT_BOOLEAN, 8, NULL, 0x02, "", HFILL } + { "Valid message", "s5066dts.management.message", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL } }, { &hf_s5066dts_management_ack, - { "Acknowledgment", "s5066dts.management.ack", FT_BOOLEAN, 8, NULL, 0x01, "", HFILL } + { "Acknowledgment", "s5066dts.management.ack", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL } }, { &hf_s5066dts_management_management_frame_id, { "Management frame ID number", "s5066dts.management.manegement_frame_id", FT_UINT8, BASE_DEC, - NULL, 0x0, "", HFILL } + NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_management_extended_message, { "Extended management message", "s5066dts.management.extended_message", FT_BYTES, BASE_NONE, - NULL, 0x0, "", HFILL } + NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_management_extended_message_hftrp_payload_size, - { "Payload Size", "s5066dts.management.extended_message.reserved", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL } + { "Payload Size", "s5066dts.management.extended_message.reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_management_extended_message_hftrp_ra, - { "Ring Address", "s5066dts.management.extended_message.ring_address", FT_IPv4, BASE_NONE, NULL, 0x0, "", HFILL } + { "Ring Address", "s5066dts.management.extended_message.ring_address", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_management_extended_message_hftrp_seq_id, - { "Sequence ID", "s5066dts.management.extended_message.sequence_id", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } + { "Sequence ID", "s5066dts.management.extended_message.sequence_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_management_extended_message_hftrp_gen_seq_id, { "Generation Sequence ID", "s5066dts.management.extended_message.generation_sequence_id", - FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } + FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_management_extended_message_hftrp_new_successor_id, { "New Successor ID", "s5066dts.management.extended_message.new_successor_id", FT_UINT32, BASE_DEC, - NULL, 0x0, "", HFILL } + NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_management_extended_message_hftrp_number_of_nodes, { "Number of Nodes", "s5066dts.management.extended_message.number_of_nodes", FT_UINT16, BASE_DEC, - NULL, 0x0, "", HFILL } + NULL, 0x0, NULL, HFILL } }, /* { 7, "NON_ARQ_DATA"}, */ { &hf_s5066dts_non_arq_data_cpdu_id_1, - { "C_PDU ID number (field 1)", "s5066dts.non_arq_data.cpdu_id_1", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL } + { "C_PDU ID number (field 1)", "s5066dts.non_arq_data.cpdu_id_1", FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL } }, { &hf_s5066dts_non_arq_data_deliver_in_order, - { "C_PDU Deliver-in-Order", "s5066dts.non_arq_data.deliver_in_order", FT_BOOLEAN, 8, NULL, 0x08, "", HFILL } + { "C_PDU Deliver-in-Order", "s5066dts.non_arq_data.deliver_in_order", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL } }, { &hf_s5066dts_non_arq_data_group_address, - { "Group Address", "s5066dts.non_arq_data.group_address", FT_BOOLEAN, 8, NULL, 0x04, "", HFILL } + { "Group Address", "s5066dts.non_arq_data.group_address", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } }, { &hf_s5066dts_non_arq_data_cpdu_id_2, - { "C_PDU ID number (field 2)", "s5066dts.non_arq_data.cpdu_id_2", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } + { "C_PDU ID number (field 2)", "s5066dts.non_arq_data.cpdu_id_2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_non_arq_data_cpdu_size, - { "C_PDU size", "s5066dts.non_arq_data.cpdu_size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL } + { "C_PDU size", "s5066dts.non_arq_data.cpdu_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_non_arq_data_cpdu_segment_offset, { "Offset of segmented C_PDU", "s5066dts.non_arq_data.cpdu_segment_offset", FT_UINT16, BASE_DEC, - NULL, 0x0, "", HFILL } + NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_non_arq_data_cpdu_reception_window, { "C_PDU reception window", "s5066dts.non_arq_data.cpdu_reception_window", FT_UINT16, BASE_DEC, - NULL, 0x0, "", HFILL } + NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_non_arq_data_segmented_cpdu_size, { "Size of segmented C_PDU", "s5066dts.non_arq_data.segmented_cpdu_size", FT_UINT16, BASE_DEC, - NULL, 0x03FF, "", HFILL } + NULL, 0x03FF, NULL, HFILL } }, /* { 8, "EXP_NON_ARQ_DATA"}, */ { &hf_s5066dts_exp_non_arq_data_cpdu_id_1, - { "C_PDU ID number (field 1)", "s5066dts.exp_non_arq_data.cpdu_id_1", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL } + { "C_PDU ID number (field 1)", "s5066dts.exp_non_arq_data.cpdu_id_1", FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL } }, { &hf_s5066dts_exp_non_arq_data_deliver_in_order, - { "C_PDU Deliver-in-Order", "s5066dts.exp_non_arq_data.deliver_in_order", FT_BOOLEAN, 8, NULL, 0x08, "", HFILL } + { "C_PDU Deliver-in-Order", "s5066dts.exp_non_arq_data.deliver_in_order", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL } }, { &hf_s5066dts_exp_non_arq_data_group_address, - { "Group Address", "s5066dts.exp_non_arq_data.group_address", FT_BOOLEAN, 8, NULL, 0x04, "", HFILL } + { "Group Address", "s5066dts.exp_non_arq_data.group_address", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } }, { &hf_s5066dts_exp_non_arq_data_cpdu_id_2, - { "C_PDU ID number (field 2)", "s5066dts.exp_non_arq_data.cpdu_id_2", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } + { "C_PDU ID number (field 2)", "s5066dts.exp_non_arq_data.cpdu_id_2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_exp_non_arq_data_cpdu_size, - { "C_PDU size", "s5066dts.exp_non_arq_data.cpdu_size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL } + { "C_PDU size", "s5066dts.exp_non_arq_data.cpdu_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_exp_non_arq_data_cpdu_segment_offset, - { "Offset of segmented C_PDU ", "s5066dts.exp_non_arq_data.cpdu_segment_offset", FT_UINT16, BASE_DEC, - NULL, 0x0, "", HFILL } + { "Offset of segmented C_PDU", "s5066dts.exp_non_arq_data.cpdu_segment_offset", FT_UINT16, BASE_DEC, + NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_exp_non_arq_data_cpdu_reception_window, { "C_PDU reception window", "s5066dts.exp_non_arq_data.cpdu_reception_window", FT_UINT16, BASE_DEC, - NULL, 0x0, "", HFILL } + NULL, 0x0, NULL, HFILL } }, { &hf_s5066dts_exp_non_arq_data_segmented_cpdu_size, { "Size of segmented C_PDU", "s5066dts.exp_non_arq_data.segmented_cpdu_size", FT_UINT16, BASE_DEC, - NULL, 0x03FF, "", HFILL } + NULL, 0x03FF, NULL, HFILL } }, /* {15, "WARNING"}, */ { &hf_s5066dts_warning_frame_type, - { "Received frame type", "s5066dts.warning.frame_type", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL } + { "Received frame type", "s5066dts.warning.frame_type", FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL } }, { &hf_s5066dts_warning_reason, - { "Reason warning sent", "s5066dts.warning.reason", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL } + { "Reason warning sent", "s5066dts.warning.reason", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL } }, }; diff --git a/epan/dissectors/packet-sccpmg.c b/epan/dissectors/packet-sccpmg.c index 08df987828..0f604854a0 100644 --- a/epan/dissectors/packet-sccpmg.c +++ b/epan/dissectors/packet-sccpmg.c @@ -36,6 +36,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include "packet-mtp3.h" #define SCCPMG_SSN 1 @@ -122,17 +123,7 @@ static int hf_sccpmg_congestion_level = -1; static gint ett_sccpmg = -1; static gint ett_sccpmg_affected_pc = -1; -static void -dissect_sccpmg_unknown_message(tvbuff_t *message_tvb, proto_tree *sccpmg_tree) -{ - guint32 message_length; - - message_length = tvb_length(message_tvb); - - proto_tree_add_text(sccpmg_tree, message_tvb, 0, message_length, - "Unknown message (%u byte%s)", message_length, - plurality(message_length, "", "s")); -} +static expert_field ei_sccpmg_unknown_msg = EI_INIT; static void dissect_sccpmg_affected_ssn(tvbuff_t *tvb, proto_tree *sccpmg_tree) @@ -224,7 +215,7 @@ dissect_sccpmg_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccpmg_tre case SCCPMG_MESSAGE_TYPE_SRT: if (mtp3_standard != ANSI_STANDARD) { - dissect_sccpmg_unknown_message(tvb, sccpmg_tree); + proto_tree_add_expert(sccpmg_tree, pinfo, &ei_sccpmg_unknown_msg, tvb, 0, -1); break; } /* else fallthrough */ @@ -249,7 +240,7 @@ dissect_sccpmg_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccpmg_tre /* else fallthrough */ default: - dissect_sccpmg_unknown_message(tvb, sccpmg_tree); + proto_tree_add_expert(sccpmg_tree, pinfo, &ei_sccpmg_unknown_msg, tvb, 0, -1); } } @@ -343,6 +334,12 @@ proto_register_sccpmg(void) &ett_sccpmg_affected_pc }; + static ei_register_info ei[] = { + { &ei_sccpmg_unknown_msg, { "sccpmg.unknown_msg", PI_UNDECODED, PI_WARN, "Unknown message", EXPFILL }}, + }; + + expert_module_t* expert_sccpmg; + /* Register the protocol name and description */ proto_sccpmg = proto_register_protocol("Signalling Connection Control Part Management", "SCCPMG", "sccpmg"); @@ -351,6 +348,8 @@ proto_register_sccpmg(void) used */ proto_register_field_array(proto_sccpmg, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sccpmg = expert_register_protocol(proto_sccpmg); + expert_register_field_array(expert_sccpmg, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-sgsap.c b/epan/dissectors/packet-sgsap.c index 0a3df2d6c0..80d3cf5e89 100644 --- a/epan/dissectors/packet-sgsap.c +++ b/epan/dissectors/packet-sgsap.c @@ -68,6 +68,8 @@ static int hf_sgsap_lcs_indic = -1; static int hf_sgsap_mme_name = -1; static int hf_sgsap_vlr_name = -1; static int hf_sgsap_imeisv = -1; +static int hf_sgsap_unknown_msg = -1; +static int hf_sgsap_message_elements = -1; static int ett_sgsap = -1; @@ -1415,7 +1417,7 @@ dissect_sgsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (msg_str) { col_add_fstr(pinfo->cinfo, COL_INFO, "%s", msg_str); }else{ - proto_tree_add_text(tree, tvb, offset, 1, "Unknown message 0x%x", oct); + proto_tree_add_item(tree, hf_sgsap_unknown_msg, tvb, offset, 1, ENC_NA); return; } @@ -1431,8 +1433,7 @@ dissect_sgsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ if (msg_fcn_p == NULL) { - proto_tree_add_text(sgsap_tree, tvb, offset, len - offset, - "Message Elements"); + proto_tree_add_item(sgsap_tree, hf_sgsap_message_elements, tvb, offset, len - offset, ENC_NA); } else { @@ -1521,6 +1522,16 @@ void proto_register_sgsap(void) { FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL} }, + { &hf_sgsap_unknown_msg, + { "Unknown message", "sgsap.unknown_msg", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_sgsap_message_elements, + {"Message Elements", "sgsap.message_elements", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL} + }, }; /* Setup protocol subtree array */ diff --git a/epan/dissectors/packet-simulcrypt.c b/epan/dissectors/packet-simulcrypt.c index e4e34e5c14..5cbd1deebc 100644 --- a/epan/dissectors/packet-simulcrypt.c +++ b/epan/dissectors/packet-simulcrypt.c @@ -666,6 +666,7 @@ static gint hf_simulcrypt_repetition_rate = -1; static gint hf_simulcrypt_initial_bandwidth = -1; static gint hf_simulcrypt_asi_input_packet_id = -1; static gint hf_simulcrypt_psig_error_status = -1; +static gint hf_simulcrypt_parameter_value = -1; /* These are the ids of the subtrees that we may be creating */ static gint ett_simulcrypt = -1; @@ -898,7 +899,7 @@ dissect_ecmg_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf proto_tree_add_item(tree, hf_simulcrypt_error_information, tvb, offset, plen, ENC_NA); break; default: /* Unknown parameter type */ - proto_tree_add_text(tree, tvb, offset, plen, "Parameter Value: %s", pvalue_char); + proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char); break; } /* end parameter type switch */ } @@ -942,7 +943,7 @@ dissect_emmg_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf proto_tree_add_item(tree, hf_simulcrypt_error_information, tvb, offset, plen, ENC_NA); break; default: /* Unknown parameter type */ - proto_tree_add_text(tree, tvb, offset, plen, "Parameter Value: %s", pvalue_char); + proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char); break; } /* end parameter type switch */ } @@ -1084,7 +1085,7 @@ dissect_eis_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo break; default: /* Unknown parameter type */ - proto_tree_add_text(tree, tvb, offset, plen, "Parameter Value: %s", pvalue_char); + proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char); break; } /* end parameter type switch */ } @@ -1192,7 +1193,7 @@ dissect_psig_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf proto_tree_add_item(tree, hf_simulcrypt_error_information, tvb, offset, plen, ENC_NA); break; default: /* Unknown parameter type */ - proto_tree_add_text(tree, tvb, offset, plen, "Parameter Value: %s", pvalue_char); + proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char); break; } /* end parameter type switch */ } @@ -1371,7 +1372,7 @@ dissect_simulcrypt_data(proto_tree *simulcrypt_tree, proto_item *simulcrypt_item dissect_psig_parameter_value (simulcrypt_parameter_tree, tvb, pinfo, offset, plen, ptype, pvalue_char); break; default: - proto_tree_add_text(tree, tvb, offset, plen, "Parameter Value: %s", pvalue_char); + proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char); break; } offset += plen; @@ -1786,8 +1787,12 @@ proto_register_simulcrypt (void) { "ASI input packet ID", "simulcrypt.parameter.asi_input_packet_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_simulcrypt_psig_error_status, + { &hf_simulcrypt_psig_error_status, { "Error status", "simulcrypt.parameter.error_status", FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_simulcrypt_parameter_value, + { "Parameter Value", "simulcrypt.parameter.value", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }} }; diff --git a/epan/dissectors/packet-sita.c b/epan/dissectors/packet-sita.c index 2007993ea7..ada7174ce6 100644 --- a/epan/dissectors/packet-sita.c +++ b/epan/dissectors/packet-sita.c @@ -153,8 +153,8 @@ dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_boolean(sita_flags_tree, hf_dir, tvb, 0, 0, flags); signals_string = format_flags_string(signals, signals_str); - ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Signals: 0x%02x %s", signals, signals_string); - sita_signals_tree = proto_item_add_subtree(ti, ett_sita_signals); + sita_signals_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, + ett_sita_signals, NULL, "Signals: 0x%02x %s", signals, signals_string); proto_tree_add_boolean(sita_signals_tree, hf_dcd, tvb, 0, 0, signals); proto_tree_add_boolean(sita_signals_tree, hf_rts, tvb, 0, 0, signals); proto_tree_add_boolean(sita_signals_tree, hf_cts, tvb, 0, 0, signals); @@ -163,8 +163,8 @@ dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_RXED) { errors1_string = format_flags_string(errors1, rx_errors1_str); - ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Receive Status: 0x%02x %s", errors1, errors1_string); - sita_errors1_tree = proto_item_add_subtree(ti, ett_sita_errors1); + sita_errors1_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, + ett_sita_errors1, NULL, "Receive Status: 0x%02x %s", errors1, errors1_string); proto_tree_add_boolean(sita_errors1_tree, hf_shortframe, tvb, 0, 0, errors1); proto_tree_add_boolean(sita_errors1_tree, hf_longframe, tvb, 0, 0, errors1); proto_tree_add_boolean(sita_errors1_tree, hf_collision, tvb, 0, 0, errors1); @@ -172,8 +172,8 @@ dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_boolean(sita_errors1_tree, hf_framing, tvb, 0, 0, errors1); errors2_string = format_flags_string(errors2, rx_errors2_str); - ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Receive Status: 0x%02x %s", errors2, errors2_string); - sita_errors2_tree = proto_item_add_subtree(ti, ett_sita_errors2); + sita_errors2_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, + ett_sita_errors2, NULL, "Receive Status: 0x%02x %s", errors2, errors2_string); proto_tree_add_boolean(sita_errors2_tree, hf_break, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors2_tree, hf_crc, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors2_tree, hf_length, tvb, 0, 0, errors2); @@ -184,8 +184,8 @@ dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_boolean(sita_errors2_tree, hf_nonaligned, tvb, 0, 0, errors2); } else { errors2_string = format_flags_string(errors2, tx_errors2_str); - ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Transmit Status: 0x%02x %s", errors2, errors2_string); - sita_errors1_tree = proto_item_add_subtree(ti, ett_sita_errors1); + sita_errors1_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, + ett_sita_errors1, NULL, "Transmit Status: 0x%02x %s", errors2, errors2_string); proto_tree_add_boolean(sita_errors1_tree, hf_rtxlimit, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors1_tree, hf_uarterror, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors1_tree, hf_lostcts, tvb, 0, 0, errors2); diff --git a/epan/dissectors/packet-smb-browse.c b/epan/dissectors/packet-smb-browse.c index 474a03861a..5b7f910092 100644 --- a/epan/dissectors/packet-smb-browse.c +++ b/epan/dissectors/packet-smb-browse.c @@ -102,6 +102,8 @@ static int hf_backup_count = -1; static int hf_backup_token = -1; static int hf_backup_server = -1; static int hf_browser_to_promote = -1; +static int hf_windows_version = -1; +static int hf_mysterious_field = -1; static gint ett_browse = -1; static gint ett_browse_flags = -1; @@ -182,7 +184,7 @@ static const value_string server_types[] = { windows_version = "Windows 2000"; \ \ else \ - windows_version = NULL; + windows_version = ""; static const value_string resetbrowserstate_command_names[] = { { 0x01, "Stop being a master browser and become a backup browser"}, @@ -584,7 +586,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr gint namelen; guint8 server_count, reset_cmd; guint8 os_major_ver, os_minor_ver; - const gchar *windows_version = NULL; + const gchar *windows_version; int i; guint32 uptime; @@ -637,9 +639,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr os_minor_ver = tvb_get_guint8(tvb, offset+1); SET_WINDOWS_VERSION_STRING(os_major_ver, os_minor_ver, windows_version); - - if(windows_version) - proto_tree_add_text(tree, tvb, offset, 2, "Windows version: %s", windows_version); + proto_tree_add_string(tree, hf_windows_version, tvb, offset, 2, windows_version); /* OS major version */ proto_tree_add_item(tree, hf_os_major, tvb, offset, 1, ENC_LITTLE_ENDIAN); @@ -662,9 +662,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr * version number, and signature constant, * however. */ - proto_tree_add_text(tree, tvb, offset, 4, - "Mysterious Field: 0x%08x", - tvb_get_letohl(tvb, offset)); + proto_tree_add_item(tree, hf_mysterious_field, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; } else { /* browser protocol major version */ @@ -821,7 +819,7 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr guint32 periodicity; const guint8 *host_name; guint8 os_major_ver, os_minor_ver; - const gchar *windows_version = NULL; + const gchar *windows_version; guint namelen; col_set_str(pinfo->cinfo, COL_PROTOCOL, "BROWSER"); @@ -859,9 +857,7 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr os_minor_ver = tvb_get_guint8(tvb, offset+1); SET_WINDOWS_VERSION_STRING(os_major_ver, os_minor_ver, windows_version); - - if(windows_version) - proto_tree_add_text(tree, tvb, offset, 2, "Windows version: %s", windows_version); + proto_tree_add_string(tree, hf_windows_version, tvb, offset, 2, windows_version); /* OS major version */ proto_tree_add_item(tree, hf_os_major, tvb, offset, 1, ENC_LITTLE_ENDIAN); @@ -1148,6 +1144,13 @@ proto_register_smb_browse(void) { "Browser to Promote", "browser.browser_to_promote", FT_STRINGZ, BASE_NONE, NULL, 0, NULL, HFILL }}, + { &hf_windows_version, + { "Windows version", "browser.windows_version", FT_STRING, BASE_NONE, + NULL, 0, NULL, HFILL }}, + + { &hf_mysterious_field, + { "Mysterious Field", "browser.mysterious_field", FT_UINT32, BASE_HEX, + NULL, 0, NULL, HFILL }}, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-smb-logon.c b/epan/dissectors/packet-smb-logon.c index 3cf9e9d762..f3cd09f9dd 100644 --- a/epan/dissectors/packet-smb-logon.c +++ b/epan/dissectors/packet-smb-logon.c @@ -53,9 +53,11 @@ static int hf_lm_token = -1; static int hf_major_version = -1; static int hf_minor_version = -1; static int hf_os_version = -1; +static int hf_signature = -1; static int hf_date_time = -1; static int hf_update_type = -1; static int hf_request_count = -1; +static int hf_account_control = -1; static int hf_flags_autolock = -1; static int hf_flags_expire = -1; static int hf_flags_server_trust = -1; @@ -84,6 +86,7 @@ static int hf_server_ip = -1; static int hf_server_site_name = -1; static int hf_client_site_name = -1; +static int hf_data = -1; static int ett_smb_logon = -1; static int ett_smb_account_flags = -1; @@ -152,34 +155,24 @@ static int dissect_account_control(tvbuff_t *tvb, proto_tree *tree, int offset) { /* display the Allowable Account control bits */ + static const int * flags[] = { + &hf_flags_autolock, + &hf_flags_expire, + &hf_flags_server_trust, + &hf_flags_workstation_trust, + &hf_flags_interdomain_trust, + &hf_flags_mns_user, + &hf_flags_normal_user, + &hf_flags_temp_dup_user, + &hf_flags_password_required, + &hf_flags_homedir_required, + &hf_flags_enabled, + NULL + }; - proto_item *ti = NULL; - proto_tree *flags_tree = NULL; - guint32 flags; - - flags = tvb_get_letohl(tvb, offset); - - if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, 4, - "Account control = 0x%04x", flags); - - flags_tree = proto_item_add_subtree(ti, ett_smb_account_flags); - } - - proto_tree_add_boolean(flags_tree, hf_flags_autolock, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_expire, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_server_trust, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_workstation_trust, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_interdomain_trust, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_mns_user, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_normal_user, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_temp_dup_user, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_password_required, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_homedir_required, tvb, offset, 4, flags); - proto_tree_add_boolean(flags_tree, hf_flags_enabled, tvb, offset, 4, flags); + proto_tree_add_bitmask(tree, tvb, offset, hf_account_control, ett_smb_account_flags, flags, ENC_LITTLE_ENDIAN); offset += 4; - return offset; } @@ -635,14 +628,8 @@ dissect_smb_acc_update(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { /*** 0x11 LM2.1 Announce Acc updates ***/ - guint32 Temp1, Temp2; - - Temp1 = tvb_get_letohl(tvb, offset); - Temp2 = tvb_get_letohl(tvb, offset + 4); - /* signature */ - proto_tree_add_text(tree, tvb, offset, 8, "Signature: 0x%08x%08x", - Temp1, Temp2); + proto_tree_add_item(tree, hf_signature, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; /* date/time */ @@ -813,10 +800,9 @@ dissect_smb_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int { /* display data as unknown */ - proto_tree_add_text(tree, tvb, offset, -1, "Data (%u bytes)", - tvb_reported_length_remaining(tvb, offset)); + proto_tree_add_item(tree, hf_data, tvb, offset, -1, ENC_NA); - return offset+tvb_length_remaining(tvb, offset); + return offset+tvb_reported_length_remaining(tvb, offset); } #define LOGON_LM10_LOGON_REQUEST 0x00 @@ -1029,6 +1015,10 @@ proto_register_smb_logon( void) { "Workstation OS Version", "smb_netlogon.os_version", FT_UINT8, BASE_DEC, NULL, 0, "SMB NETLOGON Workstation OS Version", HFILL }}, + { &hf_signature, + { "Signature", "smb_netlogon.signature", FT_UINT64, BASE_HEX, + NULL, 0, NULL, HFILL }}, + { &hf_date_time, { "Date/Time", "smb_netlogon.date_time", FT_UINT32, BASE_DEC, NULL, 0, "SMB NETLOGON Date/Time", HFILL }}, @@ -1041,6 +1031,10 @@ proto_register_smb_logon( void) { "Request Count", "smb_netlogon.request_count", FT_UINT16, BASE_DEC, NULL, 0, "SMB NETLOGON Request Count", HFILL }}, + { &hf_account_control, + { "Account control", "smb_netlogon.flags", FT_UINT32, BASE_HEX, + NULL, 0, NULL, HFILL }}, + { &hf_flags_autolock, { "Autolock", "smb_netlogon.flags.autolock", FT_BOOLEAN, 32, TFS(&tfs_flags_autolock), ACC_FLAG_AUTO_LOCKED, "SMB NETLOGON Account Autolock", HFILL}}, @@ -1140,6 +1134,10 @@ proto_register_smb_logon( void) { &hf_client_site_name, { "Client Site Name", "smb_netlogon.client_site_name", FT_STRING, BASE_NONE, NULL, 0, "SMB NETLOGON Client Site Name", HFILL }}, + + { &hf_data, + { "Data", "smb_netlogon.data", FT_BYTES, BASE_NONE, + NULL, 0, NULL, HFILL }}, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c index 8a3d6ef63a..ab340467b5 100644 --- a/epan/dissectors/packet-smtp.c +++ b/epan/dissectors/packet-smtp.c @@ -64,6 +64,7 @@ static int hf_smtp_rsp_code = -1; static int hf_smtp_rsp_parameter = -1; static int hf_smtp_username = -1; static int hf_smtp_password = -1; +static int hf_smtp_eom = -1; static int hf_smtp_data_fragments = -1; static int hf_smtp_data_fragment = -1; @@ -788,7 +789,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ col_set_str(pinfo->cinfo, COL_INFO, "C: ."); - proto_tree_add_text(smtp_tree, tvb, offset, linelen, "C: ."); + proto_tree_add_none_format(smtp_tree, hf_smtp_eom, tvb, offset, linelen, "C: ."); if (smtp_data_desegment) { /* add final data segment */ @@ -1193,6 +1194,10 @@ proto_register_smtp(void) { "Password", "smtp.auth.password", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_smtp_eom, + { "EOM", "smtp.eom", + FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + /* Fragment entries */ { &hf_smtp_data_fragments, { "DATA fragments", "smtp.data.fragments", diff --git a/epan/dissectors/packet-snaeth.c b/epan/dissectors/packet-snaeth.c index 77a08ee9f0..6dfc7ab528 100644 --- a/epan/dissectors/packet-snaeth.c +++ b/epan/dissectors/packet-snaeth.c @@ -36,6 +36,7 @@ void proto_reg_handoff_snaeth(void); static int proto_snaeth = -1; static int hf_snaeth_len = -1; +static int hf_snaeth_padding = -1; static gint ett_snaeth = -1; @@ -60,7 +61,7 @@ dissect_snaeth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ENC_NA); snaeth_tree = proto_item_add_subtree(snaeth_ti, ett_snaeth); proto_tree_add_uint(snaeth_tree, hf_snaeth_len, tvb, 0, 2, len); - proto_tree_add_text(snaeth_tree, tvb, 2, 1, "Padding"); + proto_tree_add_item(snaeth_tree, hf_snaeth_padding, tvb, 2, 1, ENC_NA); } /* @@ -83,6 +84,9 @@ proto_register_snaeth(void) { &hf_snaeth_len, { "Length", "snaeth.len", FT_UINT16, BASE_DEC, NULL, 0x0, "Length of LLC payload", HFILL }}, + { &hf_snaeth_padding, + { "Padding", "snaeth.padding", FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { &ett_snaeth, diff --git a/epan/dissectors/packet-sndcp.c b/epan/dissectors/packet-sndcp.c index ac8c9b0b85..bc793de974 100644 --- a/epan/dissectors/packet-sndcp.c +++ b/epan/dissectors/packet-sndcp.c @@ -52,6 +52,7 @@ static int hf_sndcp_pcomp = -1; static int hf_sndcp_segment = -1; static int hf_sndcp_npdu1 = -1; static int hf_sndcp_npdu2 = -1; +static int hf_sndcp_payload = -1; /* These fields are used when reassembling N-PDU fragments */ @@ -350,9 +351,7 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr(pinfo->cinfo, COL_INFO, " (N-PDU payload reassembled in packet %u)", fd_npdu->reassembled_in); - if (tree) { - proto_tree_add_text(sndcp_tree, tvb, offset, -1, "Payload"); - } + proto_tree_add_item(sndcp_tree, hf_sndcp_payload, tvb, offset, -1, ENC_NA); } } else { /* Not reassembled yet, or not reassembled at all @@ -362,9 +361,7 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else col_append_str(pinfo->cinfo, COL_INFO, " (Unreassembled fragment)"); - if (tree) { - proto_tree_add_text(sndcp_tree, tvb, offset, -1, "Payload"); - } + proto_tree_add_item(sndcp_tree, hf_sndcp_payload, tvb, offset, -1, ENC_NA); } /* Now reset fragmentation information in pinfo */ @@ -461,6 +458,13 @@ proto_register_sndcp(void) NULL, HFILL } }, + { &hf_sndcp_payload, + { "Payload", + "sndcp.payload", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL + } + }, /* Fragment fields */ @@ -533,7 +537,7 @@ proto_register_sndcp(void) FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } - } + }, }; /* Setup protocol subtree array */ diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c index 0226f6e7d1..e685dcd881 100644 --- a/epan/dissectors/packet-socks.c +++ b/epan/dissectors/packet-socks.c @@ -126,6 +126,10 @@ static int hf_socks_password = -1; static int hf_socks_remote_name = -1; static int hf_socks_address_type = -1; static int hf_socks_fragment_number = -1; +static int hf_socks_ping_end_command = -1; +static int hf_socks_ping_results = -1; +static int hf_socks_traceroute_end_command = -1; +static int hf_socks_traceroute_results = -1; /************* Dissector handles ***********/ @@ -890,20 +894,13 @@ display_ping_and_tracert(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr if ( pinfo->destport == TCP_PORT_SOCKS){ col_append_str(pinfo->cinfo, COL_INFO, ", Terminate Request"); - if ( tree) - proto_tree_add_text(tree, tvb, offset, 1, - (hash_info->command == PING_COMMAND) ? - "Ping: End command" : - "Traceroute: End command"); + proto_tree_add_item(tree, (hash_info->command == PING_COMMAND) ? hf_socks_ping_end_command : hf_socks_traceroute_end_command, tvb, offset, 1, ENC_NA); } else { /* display the PING or Traceroute results */ col_append_str(pinfo->cinfo, COL_INFO, ", Results"); if ( tree){ - proto_tree_add_text(tree, tvb, offset, -1, - (hash_info->command == PING_COMMAND) ? - "Ping Results:" : - "Traceroute Results"); + proto_tree_add_item(tree, (hash_info->command == PING_COMMAND) ? hf_socks_ping_results : hf_socks_traceroute_results, tvb, offset, -1, ENC_NA); data = tvb_get_ptr(tvb, offset, -1); dataend = data + tvb_length_remaining(tvb, offset); @@ -913,8 +910,7 @@ display_ping_and_tracert(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr lineend = find_line_end(data, dataend, &eol); linelen = (int)(lineend - data); - proto_tree_add_text( tree, tvb, offset, linelen, - "%s", format_text(data, linelen)); + proto_tree_add_format_text( tree, tvb, offset, linelen); offset += linelen; data = lineend; } @@ -1280,6 +1276,26 @@ proto_register_socks( void){ BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_socks_ping_end_command, + { "Ping: End command", "socks.ping_end_command", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL + } + }, + { &hf_socks_ping_results, + { "Ping Results", "socks.ping_results", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL + } + }, + { &hf_socks_traceroute_end_command, + { "Traceroute: End command", "socks.traceroute_end_command", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL + } + }, + { &hf_socks_traceroute_results, + { "Traceroute Results", "socks.traceroute_results", FT_NONE, + BASE_NONE, NULL, 0x0, NULL, HFILL + } + }, }; proto_socks = proto_register_protocol ( "Socks Protocol", "Socks", "socks"); diff --git a/epan/dissectors/packet-sscop.c b/epan/dissectors/packet-sscop.c index 88ef48d759..2f12e93b6a 100644 --- a/epan/dissectors/packet-sscop.c +++ b/epan/dissectors/packet-sscop.c @@ -41,6 +41,8 @@ static int hf_sscop_s = -1; static int hf_sscop_ps = -1; static int hf_sscop_r = -1; static int hf_sscop_stat_s = -1; +static int hf_sscop_pad_length = -1; +static int hf_sscop_source = -1; /* static int hf_sscop_stat_count = -1; */ static gint ett_sscop = -1; @@ -246,8 +248,8 @@ dissect_sscop_and_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, d break; case SSCOP_END: - proto_tree_add_text(sscop_tree, tvb, SSCOP_PDU_TYPE, 1, - "Source: %s", (sscop_pdu_type & SSCOP_S) ? "SSCOP" : "User"); + proto_tree_add_string(sscop_tree, hf_sscop_source, tvb, SSCOP_PDU_TYPE, 1, + (sscop_pdu_type & SSCOP_S) ? "SSCOP" : "User"); break; case SSCOP_BGAK: @@ -304,8 +306,7 @@ dissect_sscop_and_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, d case SSCOP_SDP: #endif if (tree) { - proto_tree_add_text(sscop_tree, tvb, SSCOP_PDU_TYPE, 1, - "Pad length: %u", pad_len); + proto_tree_add_uint(sscop_tree, hf_sscop_pad_length, tvb, SSCOP_PDU_TYPE, 1, pad_len); } /* @@ -416,6 +417,8 @@ proto_register_sscop(void) { &hf_sscop_ps, { "N(PS)", "sscop.ps", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_sscop_r, { "N(R)", "sscop.r", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_sscop_stat_s, { "N(S)", "sscop.stat.s", FT_UINT24, BASE_DEC, NULL, 0x0,NULL, HFILL }}, + { &hf_sscop_pad_length, { "Pad length", "sscop.pad_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_sscop_source, { "Source", "sscop.source", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, #if 0 { &hf_sscop_stat_count, { "Number of NACKed pdus", "sscop.stat.count", FT_UINT32, BASE_DEC, NULL, 0x0,NULL, HFILL }} #endif diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index bc92c9653c..fd5cbb9154 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -5272,12 +5272,12 @@ ssl_dissect_hnd_cli_hello(ssl_common_dissect_t *hf, tvbuff_t *tvb, proto_tree_add_uint(cs_tree, hf->hf.hs_comp_method, tvb, offset, 1, compression_method); else if (compression_method > 63 && compression_method < 193) - proto_tree_add_text(cs_tree, tvb, offset, 1, - "Compression Method: Reserved - to be assigned by IANA (%u)", + proto_tree_add_uint_format_value(cs_tree, hf->hf.hs_comp_method, tvb, offset, 1, + compression_method, "Reserved - to be assigned by IANA (%u)", compression_method); else - proto_tree_add_text(cs_tree, tvb, offset, 1, - "Compression Method: Private use range (%u)", + proto_tree_add_uint_format_value(cs_tree, hf->hf.hs_comp_method, tvb, offset, 1, + compression_method, "Private use range (%u)", compression_method); offset++; compression_methods_length--; diff --git a/epan/dissectors/packet-sync.c b/epan/dissectors/packet-sync.c index 3497462d8c..df2913b40c 100644 --- a/epan/dissectors/packet-sync.c +++ b/epan/dissectors/packet-sync.c @@ -28,6 +28,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/crc6-tvb.h> #define TYPE_0_LEN 17 @@ -54,6 +55,9 @@ static int hf_sync_length_of_packet = -1; /* Initialize the subtree pointers */ static gint ett_sync = -1; +static expert_field ei_sync_pdu_type2 = EI_INIT; +static expert_field ei_sync_type = EI_INIT; + static dissector_handle_t sync_handle; static dissector_handle_t ip_handle; @@ -69,7 +73,7 @@ static const value_string sync_type_vals[] = { static int dissect_sync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - proto_item *ti, *item; + proto_item *ti, *item, *type_item; proto_tree *sync_tree; guint8 type, spare; guint16 packet_nr, packet_len1, packet_len2; @@ -103,7 +107,6 @@ dissect_sync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ /* Ugly, but necessary to get the correct length for type 3 */ packet_nr = tvb_get_ntohs(tvb, offset+3); - if (tree) { /* The length varies depending on PDU type */ switch (type) { case 0: @@ -129,7 +132,7 @@ dissect_sync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ sync_tree = proto_item_add_subtree(ti, ett_sync); /* Octet 1 - PDU Type */ - proto_tree_add_item(sync_tree, hf_sync_type, tvb, offset, 1, ENC_BIG_ENDIAN); + type_item = proto_tree_add_item(sync_tree, hf_sync_type, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(sync_tree, hf_sync_spare4, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; @@ -173,7 +176,7 @@ dissect_sync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ break; case 2: /* SYNC PDU Type 2 */ - proto_tree_add_text(tree, tvb, offset, -1, "SYNC PDU type 2 unsupported"); + expert_add_info(pinfo, ti, &ei_sync_pdu_type2); break; case 3: /* SYNC PDU Type 3 */ @@ -214,10 +217,9 @@ dissect_sync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ } break; default: - proto_tree_add_text(tree, tvb, offset, -1, "Unknown SYNC PDU type"); + expert_add_info(pinfo, type_item, &ei_sync_type); break; } - } return tvb_length(tvb); @@ -283,10 +285,19 @@ proto_register_sync(void) &ett_sync }; + static ei_register_info ei[] = { + { &ei_sync_pdu_type2, { "sync.pdu_type2", PI_UNDECODED, PI_WARN, "SYNC PDU type 2 unsupported", EXPFILL }}, + { &ei_sync_type, { "sync.type.unknown", PI_PROTOCOL, PI_WARN, "Unknown SYNC PDU type", EXPFILL }}, + }; + + expert_module_t* expert_sync; + proto_sync = proto_register_protocol("MBMS synchronisation protocol", "SYNC", "sync"); proto_register_field_array(proto_sync, hf_sync, array_length(hf_sync)); proto_register_subtree_array(ett_sync_array, array_length(ett_sync_array)); + expert_sync = expert_register_protocol(proto_sync); + expert_register_field_array(expert_sync, ei, array_length(ei)); sync_handle = new_register_dissector("sync", dissect_sync, proto_sync); } |