diff options
author | Michael Mann <mmann78@netscape.net> | 2014-11-05 23:07:35 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-11-13 05:17:36 +0000 |
commit | f8e24c9fdc550cd5fa52e39615230cc8fe91ec03 (patch) | |
tree | e96d22834e5e7d10e2815443f213f52bbfbb9bed | |
parent | 0515087b46e845374efd2b4d24eeecf269878902 (diff) |
Eliminate proto_tree_add_text for some dissectors.
Change-Id: Ide14bcac0b1563bee4260ac9c1a280ba99e97e71
Reviewed-on: https://code.wireshark.org/review/5261
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-msproxy.c | 111 | ||||
-rw-r--r-- | epan/dissectors/packet-multipart.c | 57 | ||||
-rw-r--r-- | epan/dissectors/packet-omapi.c | 29 | ||||
-rw-r--r-- | epan/dissectors/packet-radius.c | 92 | ||||
-rw-r--r-- | epan/dissectors/packet-rdt.c | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-rip.c | 60 | ||||
-rw-r--r-- | epan/dissectors/packet-rlc.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-rmt-lct.c | 27 | ||||
-rw-r--r-- | epan/dissectors/packet-rohc.c | 98 | ||||
-rw-r--r-- | epan/dissectors/packet-rpc.c | 86 | ||||
-rw-r--r-- | epan/dissectors/packet-sccp.c | 54 |
11 files changed, 389 insertions, 252 deletions
diff --git a/epan/dissectors/packet-msproxy.c b/epan/dissectors/packet-msproxy.c index 642f029b9d..681ad2813c 100644 --- a/epan/dissectors/packet-msproxy.c +++ b/epan/dissectors/packet-msproxy.c @@ -91,6 +91,16 @@ static int hf_msproxy_server_int_port = -1; static int hf_msproxy_server_ext_addr = -1; static int hf_msproxy_server_ext_port = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_msproxy_host_name = -1; +static int hf_msproxy_address_offset = -1; +static int hf_msproxy_client_computer_name = -1; +static int hf_msproxy_nt_domain = -1; +static int hf_msproxy_req_resolve_length = -1; +static int hf_msproxy_application_name = -1; +static int hf_msproxy_user_name = -1; +static int hf_msproxy_application = -1; + static expert_field ei_msproxy_unknown = EI_INIT; static expert_field ei_msproxy_unhandled = EI_INIT; @@ -187,8 +197,6 @@ typedef struct { /************** negotiated conversation hash stuff ***************/ -static guint32 last_row= 0; /* used to see if packet is new */ - static void msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -311,8 +319,7 @@ static int display_application_name(tvbuff_t *tvb, int offset, int length; length = tvb_strnlen( tvb, offset, 255); - proto_tree_add_text( tree, tvb, offset, length, "Application: %.*s", - length, tvb_get_string_enc( wmem_packet_scope(), tvb, offset, length, ENC_ASCII)); + proto_tree_add_item(tree, hf_msproxy_application, tvb, offset, length, ENC_ASCII|ENC_NA); return length; } @@ -373,25 +380,19 @@ static void dissect_user_info_2(tvbuff_t *tvb, int offset, length = tvb_strnlen( tvb, offset, 255); if (length == -1) return; - proto_tree_add_text( tree, tvb, offset, length + 1, - "User name: %.*s", length, - tvb_get_string_enc( wmem_packet_scope(), tvb, offset, length, ENC_ASCII)); + proto_tree_add_item(tree, hf_msproxy_user_name, tvb, offset, length + 1, ENC_ASCII|ENC_NA); offset += length + 2; length = tvb_strnlen( tvb, offset, 255); if (length == -1) return; - proto_tree_add_text( tree, tvb, offset, length + 1, - "Application name: %.*s", length, - tvb_get_string_enc( wmem_packet_scope(), tvb, offset, length, ENC_ASCII)); + proto_tree_add_item(tree, hf_msproxy_application_name, tvb, offset, length + 1, ENC_ASCII|ENC_NA); offset += length + 1; length = tvb_strnlen( tvb, offset, 255); if (length == -1) return; - proto_tree_add_text( tree, tvb, offset, length + 1, - "Client computer name: %.*s", length, - tvb_get_string_enc( wmem_packet_scope(), tvb, offset, length, ENC_ASCII)); + proto_tree_add_item(tree, hf_msproxy_client_computer_name, tvb, offset, length + 1, ENC_ASCII|ENC_NA); } } @@ -581,14 +582,12 @@ static void dissect_request_resolve(tvbuff_t *tvb, int offset, ett_msproxy_name, NULL, "Host Name: %.*s", length, tvb_get_string_enc( wmem_packet_scope(), tvb, offset + 18, length, ENC_ASCII)); - proto_tree_add_text( name_tree, tvb, offset, 1, "Length: %d", - length); + proto_tree_add_item(name_tree, hf_msproxy_req_resolve_length, tvb, offset, 1, ENC_NA); ++offset; offset += 17; - proto_tree_add_text( name_tree, tvb, offset, length, "String: %s", - tvb_get_string_enc( wmem_packet_scope(), tvb, offset, length, ENC_ASCII)); + proto_tree_add_item(name_tree, hf_msproxy_host_name, tvb, offset, length, ENC_ASCII|ENC_NA); } } @@ -650,38 +649,34 @@ static void dissect_udp_assoc(tvbuff_t *tvb, int offset, } -static void dissect_msproxy_request(tvbuff_t *tvb, +static void dissect_msproxy_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, hash_entry_t *conv_info) { int offset = 0; int cmd; + proto_item* cmd_item; - if ( tree) { - proto_tree_add_item( tree, hf_msproxy_client_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset += 4; + proto_tree_add_item( tree, hf_msproxy_client_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; - proto_tree_add_item( tree, hf_msproxy_version, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset += 4; + proto_tree_add_item( tree, hf_msproxy_version, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; - proto_tree_add_item( tree, hf_msproxy_server_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset += 4; + proto_tree_add_item( tree, hf_msproxy_server_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; - proto_tree_add_item( tree, hf_msproxy_server_ack, tvb, offset, 1, ENC_LITTLE_ENDIAN); - offset += 4; + proto_tree_add_item( tree, hf_msproxy_server_ack, tvb, offset, 1, ENC_LITTLE_ENDIAN); + offset += 4; - proto_tree_add_item( tree, hf_msproxy_seq_num, tvb, offset, 1, ENC_LITTLE_ENDIAN); - offset += 8; + proto_tree_add_item( tree, hf_msproxy_seq_num, tvb, offset, 1, ENC_LITTLE_ENDIAN); + offset += 8; - proto_tree_add_item( tree, hf_msproxy_rwsp_signature, tvb, offset, 4, ENC_NA|ENC_ASCII); - offset += 12; - } - else /* no tree */ - offset += 36; + proto_tree_add_item( tree, hf_msproxy_rwsp_signature, tvb, offset, 4, ENC_NA|ENC_ASCII); + offset += 12; cmd = tvb_get_ntohs( tvb, offset); - if ( tree) - proto_tree_add_uint_format_value( tree, hf_msproxy_cmd, tvb, offset, 2, + cmd_item = proto_tree_add_uint_format_value( tree, hf_msproxy_cmd, tvb, offset, 2, cmd, "%s (0x%02x)", get_msproxy_cmd_name( cmd, FROM_CLIENT), cmd); @@ -729,8 +724,7 @@ static void dissect_msproxy_request(tvbuff_t *tvb, dissect_udp_assoc( tvb, offset, tree, conv_info); break; default: - if ( tree) - proto_tree_add_text( tree, tvb, offset, 0, + expert_add_info_format(pinfo, cmd_item, &ei_msproxy_unhandled, "Unhandled request command (report this, please)"); } } @@ -743,15 +737,9 @@ static int dissect_hello_ack(tvbuff_t *tvb, int offset, proto_tree *tree) { offset += 60; - if ( tree) { - proto_tree_add_item( tree, hf_msproxy_serverport, tvb, offset, 2, - ENC_BIG_ENDIAN); - } + proto_tree_add_item( tree, hf_msproxy_serverport, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - if ( tree) { - proto_tree_add_item( tree, hf_msproxy_serveraddr, tvb, offset, 4, - ENC_BIG_ENDIAN); - } + proto_tree_add_item( tree, hf_msproxy_serveraddr, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; return offset; @@ -807,8 +795,7 @@ static void dissect_auth_1_ack(tvbuff_t *tvb, int offset, offset += 48; /* XXX - always 255? */ - proto_tree_add_text( tree, tvb, offset, 255, "NT domain: %.255s", - tvb_get_string_enc( wmem_packet_scope(), tvb, offset, 255, ENC_ASCII)); + proto_tree_add_item(tree, hf_msproxy_nt_domain, tvb, offset, 255, ENC_ASCII|ENC_NA); } } @@ -954,8 +941,7 @@ static void dissect_resolve(tvbuff_t *tvb, int offset, proto_tree *tree) { addr_offset = tvb_get_guint8( tvb, offset); - proto_tree_add_text( tree, tvb, offset, 1, "Address offset: %d", - addr_offset); + proto_tree_add_item(tree, hf_msproxy_address_offset, tvb, offset, 1, ENC_NA); ++offset; @@ -1104,21 +1090,10 @@ static void dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ( pinfo->srcport == UDP_PORT_MSPROXY) dissect_msproxy_response( tvb, pinfo, msproxy_tree, hash_info); else - dissect_msproxy_request( tvb, msproxy_tree, hash_info); + dissect_msproxy_request( tvb, pinfo, msproxy_tree, hash_info); } - -static void msproxy_reinit( void){ - -/* Do the cleanup work when a new pass through the packet list is */ -/* performed. Reset the highest row seen counter */ - - last_row = 0; -} - - - void proto_register_msproxy( void){ @@ -1257,6 +1232,16 @@ proto_register_msproxy( void){ 0x0, NULL, HFILL } }, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_msproxy_application, { "Application", "msproxy.application", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_msproxy_user_name, { "User name", "msproxy.user_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_msproxy_application_name, { "Application name", "msproxy.application_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_msproxy_client_computer_name, { "Client computer name", "msproxy.client_computer_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_msproxy_req_resolve_length, { "Length", "msproxy.req_resolve.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_msproxy_host_name, { "Host Name", "msproxy.host_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_msproxy_nt_domain, { "NT domain", "msproxy.nt_domain", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_msproxy_address_offset, { "Address offset", "msproxy.address_offset", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; static ei_register_info ei[] = { @@ -1275,8 +1260,6 @@ proto_register_msproxy( void){ expert_msproxy = expert_register_protocol(proto_msproxy); expert_register_field_array(expert_msproxy, ei, array_length(ei)); - register_init_routine( &msproxy_reinit); /* register re-init routine */ - msproxy_sub_handle = create_dissector_handle(msproxy_sub_dissector, proto_msproxy); } diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c index 112a8e59c6..1a6fe60e54 100644 --- a/epan/dissectors/packet-multipart.c +++ b/epan/dissectors/packet-multipart.c @@ -61,6 +61,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/prefs.h> #include <epan/wmem/wmem.h> @@ -76,11 +77,21 @@ static dissector_table_t multipart_media_subdissector_table; /* Initialize the protocol and registered fields */ static int proto_multipart = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_multipart_trailer = -1; +static int hf_multipart_boundary = -1; +static int hf_multipart_first_boundary = -1; +static int hf_multipart_last_boundary = -1; +static int hf_multipart_preamble = -1; + /* Initialize the subtree pointers */ static gint ett_multipart = -1; static gint ett_multipart_main = -1; static gint ett_multipart_body = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static expert_field ei_multipart_no_required_boundary_parameter = EI_INIT; + /* Not sure that compact_name exists for multipart, but choose to keep * the structure from SIP dissector, all the content- is also from SIP */ @@ -538,22 +549,16 @@ process_preamble(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary, boundary_start = find_first_boundary(tvb, 0, boundary, boundary_len, &boundary_line_len, last_boundary); if (boundary_start == 0) { - proto_tree_add_text(tree, tvb, boundary_start, boundary_line_len, - "First boundary: %s", - tvb_format_text(tvb, boundary_start, boundary_line_len)); + proto_tree_add_item(tree, hf_multipart_first_boundary, tvb, boundary_start, boundary_line_len, ENC_NA|ENC_ASCII); return boundary_start + boundary_line_len; } else if (boundary_start > 0) { if (boundary_line_len > 0) { gint body_part_start = boundary_start + boundary_line_len; if (body_part_start > 0) { - proto_tree_add_text(tree, tvb, 0, body_part_start, - "Preamble"); + proto_tree_add_item(tree, hf_multipart_preamble, tvb, 0, body_part_start, ENC_NA); } - proto_tree_add_text(tree, tvb, boundary_start, - boundary_line_len, "First boundary: %s", - tvb_format_text(tvb, boundary_start, - boundary_line_len)); + proto_tree_add_item(tree, hf_multipart_first_boundary, tvb, boundary_start, boundary_line_len, ENC_NA|ENC_ASCII); return body_part_start; } } @@ -746,17 +751,9 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary, } proto_item_set_len(ti, boundary_start - start); if (*last_boundary == TRUE) { - proto_tree_add_text(tree, tvb, - boundary_start, boundary_line_len, - "Last boundary: %s", - tvb_format_text(tvb, boundary_start, - boundary_line_len)); + proto_tree_add_item(tree, hf_multipart_last_boundary, tvb, boundary_start, boundary_line_len, ENC_NA|ENC_ASCII); } else { - proto_tree_add_text(tree, tvb, - boundary_start, boundary_line_len, - "Boundary: %s", - tvb_format_text(tvb, boundary_start, - boundary_line_len)); + proto_tree_add_item(tree, hf_multipart_boundary, tvb, boundary_start, boundary_line_len, ENC_NA|ENC_ASCII); } g_free(filename); @@ -790,9 +787,7 @@ static int dissect_multipart(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* * We can't get the required multipart information */ - proto_tree_add_text(tree, tvb, 0, -1, - "The multipart dissector could not find " - "the required boundary parameter."); + proto_tree_add_expert(tree, pinfo, &ei_multipart_no_required_boundary_parameter, tvb, 0, -1); call_dissector(data_handle, tvb, pinfo, tree); return tvb_length(tvb); } @@ -846,7 +841,7 @@ static int dissect_multipart(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree * Process the multipart trailer */ if (tvb_length_remaining(tvb, header_start) > 0) { - proto_tree_add_text(subtree, tvb, header_start, -1, "Trailer"); + proto_tree_add_item(subtree, hf_multipart_trailer, tvb, header_start, -1, ENC_NA); } /* Clean up the dynamically allocated memory */ cleanup_multipart_info(m_info); @@ -948,12 +943,22 @@ proto_register_multipart(void) "Content-Type Header", HFILL } }, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_multipart_first_boundary, { "First boundary", "mime_multipart.first_boundary", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_multipart_preamble, { "Preamble", "mime_multipart.preamble", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_multipart_last_boundary, { "Last boundary", "mime_multipart.last_boundary", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_multipart_boundary, { "Boundary", "mime_multipart.boundary", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_multipart_trailer, { "Trailer", "mime_multipart.trailer", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + }; /* * Preferences */ module_t *multipart_module; + expert_module_t* expert_multipart; + /* * Setup protocol subtree array @@ -964,6 +969,10 @@ proto_register_multipart(void) &ett_multipart_body, }; + static ei_register_info ei[] = { + { &ei_multipart_no_required_boundary_parameter, { "mime_multipart.no_required_boundary_parameter", PI_PROTOCOL, PI_ERROR, "The multipart dissector could not find the required boundary parameter.", EXPFILL }}, + }; + /* * Register the protocol name and description */ @@ -978,6 +987,8 @@ proto_register_multipart(void) */ proto_register_field_array(proto_multipart, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_multipart = expert_register_protocol(proto_multipart); + expert_register_field_array(expert_multipart, ei, array_length(ei)); multipart_module = prefs_register_protocol(proto_multipart, NULL); diff --git a/epan/dissectors/packet-omapi.c b/epan/dissectors/packet-omapi.c index a47f35ed90..b9151d7a94 100644 --- a/epan/dissectors/packet-omapi.c +++ b/epan/dissectors/packet-omapi.c @@ -70,6 +70,12 @@ static int hf_omapi_obj_value_len = -1; static int hf_omapi_obj_value = -1; static int hf_omapi_signature = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_omapi_empty_string = -1; +static int hf_omapi_object_end_tag = -1; +static int hf_omapi_message_end_tag = -1; +static int hf_omapi_no_value = -1; + static gint ett_omapi = -1; #define OMAPI_PORT 7911 @@ -169,11 +175,11 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (msglength == 0) { - proto_tree_add_text(omapi_tree, tvb, 0, 0, "Empty string"); + proto_tree_add_item(omapi_tree, hf_omapi_empty_string, tvb, 0, 0, ENC_NA); } else if (msglength == (guint32)~0) { - proto_tree_add_text(omapi_tree, tvb, 0, 0, "No value"); + proto_tree_add_item(omapi_tree, hf_omapi_no_value, tvb, 0, 0, ENC_NA); } else { @@ -183,8 +189,7 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) msglength = tvb_get_ntohs(tvb, ptvcursor_current_offset(cursor)); } - proto_tree_add_text(omapi_tree, tvb, ptvcursor_current_offset(cursor), 2, "Message end tag"); - ptvcursor_advance(cursor, 2); + ptvcursor_add(cursor, hf_omapi_message_end_tag, 2, ENC_NA); objlength = tvb_get_ntohs(tvb, ptvcursor_current_offset(cursor)); while (objlength) @@ -196,11 +201,11 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (objlength == 0) { - proto_tree_add_text(omapi_tree, tvb, 0, 0, "Empty string"); + proto_tree_add_item(omapi_tree, hf_omapi_empty_string, tvb, 0, 0, ENC_NA); } else if (objlength == (guint32)~0) { - proto_tree_add_text(omapi_tree, tvb, 0, 0, "No value"); + proto_tree_add_item(omapi_tree, hf_omapi_no_value, tvb, 0, 0, ENC_NA); } else { @@ -210,8 +215,7 @@ dissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) objlength = tvb_get_ntohs(tvb, ptvcursor_current_offset(cursor)); } - proto_tree_add_text(omapi_tree, tvb, ptvcursor_current_offset(cursor), 2, "Object end tag"); - ptvcursor_advance(cursor, 2); + ptvcursor_add(cursor, hf_omapi_object_end_tag, 2, ENC_NA); if (authlength > 0) { ptvcursor_add(cursor, hf_omapi_signature, authlength, ENC_NA); @@ -291,7 +295,14 @@ proto_register_omapi(void) { &hf_omapi_signature, { "Signature", "omapi.signature", FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }} + NULL, HFILL }}, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_omapi_empty_string, { "Empty string", "omapi.empty_string", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_omapi_no_value, { "No value", "omapi.no_value", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_omapi_message_end_tag, { "Message end tag", "omapi.message_end_tag", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_omapi_object_end_tag, { "Object end tag", "omapi.object_end_tag", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + }; static gint *ett[] = { diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index 814dfc079c..ec19f51c1d 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -64,6 +64,7 @@ #include <epan/packet.h> #include <epan/exceptions.h> +#include <epan/expert.h> #include <epan/prefs.h> #include <epan/sminmpec.h> #include <wsutil/filesystem.h> @@ -132,11 +133,18 @@ static int hf_radius_cosine_vpi = -1; static int hf_radius_cosine_vci = -1; static int hf_radius_ascend_data_filter = -1; +static int hf_radius_vsa_fragment = -1; +static int hf_radius_eap_fragment = -1; +static int hf_radius_avp = -1; +static int hf_radius_3gpp_ms_tmime_zone = -1; static gint ett_radius = -1; static gint ett_radius_avp = -1; static gint ett_eap = -1; static gint ett_chap = -1; + +static expert_field ei_radius_invalid_length = EI_INIT; + /* * Define the tap for radius */ @@ -528,12 +536,12 @@ dissect_radius_3gpp_ms_tmime_zone(proto_tree* tree, tvbuff_t* tvb, packet_info* oct = tvb_get_guint8(tvb, offset); sign = (oct & 0x08) ? '-' : '+'; oct = (oct >> 4) + (oct & 0x07) * 10; + daylight_saving_time = tvb_get_guint8(tvb, offset+1) & 0x3; - proto_tree_add_text(tree, tvb, offset, 1, "Timezone: GMT %c%d hours %d minutes", sign, oct / 4, oct % 4 * 15); - offset++; - - daylight_saving_time = tvb_get_guint8(tvb, offset) & 0x3; - proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_const(daylight_saving_time, daylight_saving_time_vals, "Unknown")); + proto_tree_add_bytes_format_value(tree, hf_radius_3gpp_ms_tmime_zone, tvb, offset, 2, NULL, + "GMT %c%d hours %d minutes %s", sign, oct / 4, oct % 4 * 15, + val_to_str_const(daylight_saving_time, daylight_saving_time_vals, "Unknown")); + offset += 2; return wmem_strdup_printf(wmem_packet_scope(), "Timezone: GMT %c%d hours %d minutes %s ", sign, oct / 4, oct % 4 * 15, val_to_str_const(daylight_saving_time, daylight_saving_time_vals, "Unknown")); @@ -853,7 +861,6 @@ static void add_tlv_to_tree(proto_tree* tlv_tree, proto_item* tlv_item, packet_i } void radius_tlv(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) { - proto_item* item; gint tlv_num = 0; while (len > 0) { @@ -866,25 +873,22 @@ void radius_tlv(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, proto_tree* tlv_tree; if (len < 2) { - item = proto_tree_add_text(tree, tvb, offset, 0, + proto_tree_add_expert_format(tree, pinfo, &ei_radius_invalid_length, tvb, offset, 0, "Not enough room in packet for TLV header"); - PROTO_ITEM_SET_GENERATED(item); return; } tlv_type = tvb_get_guint8(tvb,offset); tlv_length = tvb_get_guint8(tvb,offset+1); if (tlv_length < 2) { - item = proto_tree_add_text(tree, tvb, offset, 0, + proto_tree_add_expert_format(tree, pinfo, &ei_radius_invalid_length, tvb, offset, 0, "TLV too short: length %u < 2", tlv_length); - PROTO_ITEM_SET_GENERATED(item); return; } if (len < (gint)tlv_length) { - item = proto_tree_add_text(tree, tvb, offset, 0, + proto_tree_add_expert_format(tree, pinfo, &ei_radius_invalid_length, tvb, offset, 0, "Not enough room in packet for TLV"); - PROTO_ITEM_SET_GENERATED(item); return; } @@ -920,15 +924,13 @@ void radius_tlv(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, } static void add_avp_to_tree(proto_tree* avp_tree, proto_item* avp_item, packet_info* pinfo, tvbuff_t* tvb, radius_attr_info_t* dictionary_entry, guint32 avp_length, guint32 offset) { - proto_item* pi; if (dictionary_entry->tagged) { guint tag; if (avp_length == 0) { - pi = proto_tree_add_text(avp_tree, tvb, offset, + proto_tree_add_expert_format(avp_tree, pinfo, &ei_radius_invalid_length, tvb, offset, 0, "AVP too short for tag"); - PROTO_ITEM_SET_GENERATED(pi); return; } @@ -979,7 +981,6 @@ static void vsa_buffer_table_destroy(void *table) { void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, guint length) { - proto_item* item; gboolean last_eap = FALSE; guint8* eap_buffer = NULL; guint eap_seg_num = 0; @@ -1012,25 +1013,22 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_ proto_tree* avp_tree; if (length < 2) { - item = proto_tree_add_text(tree, tvb, offset, 0, + proto_tree_add_expert_format(tree, pinfo, &ei_radius_invalid_length, tvb, offset, 0, "Not enough room in packet for AVP header"); - PROTO_ITEM_SET_GENERATED(item); break; /* exit outer loop, then cleanup & return */ } avp_type = tvb_get_guint8(tvb,offset); avp_length = tvb_get_guint8(tvb,offset+1); if (avp_length < 2) { - item = proto_tree_add_text(tree, tvb, offset, 0, + proto_tree_add_expert_format(tree, pinfo, &ei_radius_invalid_length, tvb, offset, 0, "AVP too short: length %u < 2", avp_length); - PROTO_ITEM_SET_GENERATED(item); break; /* exit outer loop, then cleanup & return */ } if (length < avp_length) { - item = proto_tree_add_text(tree, tvb, offset, 0, + proto_tree_add_expert_format(tree, pinfo, &ei_radius_invalid_length, tvb, offset, 0, "Not enough room in packet for AVP"); - PROTO_ITEM_SET_GENERATED(item); break; /* exit outer loop, then cleanup & return */ } @@ -1042,8 +1040,8 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_ dictionary_entry = &no_dictionary_entry; } - avp_item = proto_tree_add_text(tree, tvb, offset, avp_length, - "AVP: l=%u t=%s(%u)", avp_length, + avp_item = proto_tree_add_bytes_format_value(tree, hf_radius_avp, tvb, offset, avp_length, + NULL, "l=%u t=%s(%u)", avp_length, dictionary_entry->name, avp_type); avp_length -= 2; @@ -1058,7 +1056,7 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_ /* XXX TODO: handle 2 byte codes for USR */ if (avp_length < 4) { - proto_item_append_text(avp_item, " [AVP too short; no room for vendor ID]"); + expert_add_info_format(pinfo, avp_item, &ei_radius_invalid_length, "AVP too short; no room for vendor ID"); offset += avp_length; continue; /* while (length > 0) */ } @@ -1119,8 +1117,8 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_ } if (avp_vsa_len < avp_vsa_header_len) { - proto_tree_add_text(tree, tvb, offset+1, 1, - "[VSA too short]"); + proto_tree_add_expert_format(tree, pinfo, &ei_radius_invalid_length, tvb, offset+1, 1, + "VSA too short"); break; /* exit while (offset < max_offset) loop */ } @@ -1133,17 +1131,15 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_ } if (vendor->has_flags){ - avp_item = proto_tree_add_text(vendor_tree,tvb,offset-avp_vsa_header_len,avp_vsa_len+avp_vsa_header_len, - "VSA: l=%u t=%s(%u) C=0x%02x", + avp_tree = proto_tree_add_subtree_format(vendor_tree,tvb,offset-avp_vsa_header_len,avp_vsa_len+avp_vsa_header_len, + dictionary_entry->ett, &avp_item, "VSA: l=%u t=%s(%u) C=0x%02x", avp_vsa_len+avp_vsa_header_len, dictionary_entry->name, avp_vsa_type, avp_vsa_flags); } else { - avp_item = proto_tree_add_text(vendor_tree,tvb,offset-avp_vsa_header_len,avp_vsa_len+avp_vsa_header_len, - "VSA: l=%u t=%s(%u)", + avp_tree = proto_tree_add_subtree_format(vendor_tree,tvb,offset-avp_vsa_header_len,avp_vsa_len+avp_vsa_header_len, + dictionary_entry->ett, &avp_item, "VSA: l=%u t=%s(%u)", avp_vsa_len+avp_vsa_header_len, dictionary_entry->name, avp_vsa_type); } - avp_tree = proto_item_add_subtree(avp_item,dictionary_entry->ett); - if (show_length) { avp_len_item = proto_tree_add_uint(avp_tree, dictionary_entry->hf_len, @@ -1180,12 +1176,12 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_ tvb_memcpy(tvb, vsa_buffer->data, offset, avp_vsa_len); g_hash_table_insert(vsa_buffer_table, &(vsa_buffer->key), vsa_buffer); } - proto_tree_add_text(avp_tree, tvb, offset, avp_vsa_len, "VSA fragment"); + proto_tree_add_item(avp_tree, hf_radius_vsa_fragment, tvb, offset, avp_vsa_len, ENC_NA); proto_item_append_text(avp_item, ": VSA fragment[%u]", vsa_buffer->seg_num); } else { if (vsa_buffer) { tvbuff_t* vsa_tvb = NULL; - proto_tree_add_text(avp_tree, tvb, offset, avp_vsa_len, "VSA fragment"); + proto_tree_add_item(avp_tree, hf_radius_vsa_fragment, tvb, offset, avp_vsa_len, ENC_NA); proto_item_append_text(avp_item, ": Last VSA fragment[%u]", vsa_buffer->seg_num); vsa_tvb = tvb_new_child_real_data(tvb, vsa_buffer->data, vsa_buffer->len, vsa_buffer->len); tvb_set_free_cb(vsa_tvb, g_free); @@ -1225,9 +1221,7 @@ void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_ eap_seg_num++; /* Show this as an EAP fragment. */ - if (tree) - proto_tree_add_text(avp_tree, tvb, offset, tvb_len, - "EAP fragment"); + proto_tree_add_item(avp_tree, hf_radius_eap_fragment, tvb, offset, tvb_len, ENC_NA); if (eap_tvb != NULL) { /* @@ -2014,7 +2008,19 @@ static void register_radius_fields(const char* unused _U_) { NULL, HFILL }}, { &hf_radius_ascend_data_filter, { "Ascend Data Filter", "radius.ascenddatafilter", FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }} + NULL, HFILL }}, + { &hf_radius_vsa_fragment, + { "VSA fragment", "radius.vsa_fragment", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_radius_eap_fragment, + { "EAP fragment", "radius.eap_fragment", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_radius_avp, + { "AVP", "radius.avp", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_radius_3gpp_ms_tmime_zone, + { "Timezone", "radius.3gpp_ms_tmime_zone", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; gint *base_ett[] = { @@ -2026,6 +2032,12 @@ static void register_radius_fields(const char* unused _U_) { &(no_vendor.ett), }; + static ei_register_info ei[] = { + { + &ei_radius_invalid_length, { "radius.invalid_length", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }}, + }; + + expert_module_t* expert_radius; hfett_t ri; char* dir = NULL; gchar* dict_err_str = NULL; @@ -2067,6 +2079,8 @@ static void register_radius_fields(const char* unused _U_) { proto_register_field_array(proto_radius,(hf_register_info*)wmem_array_get_raw(ri.hf),wmem_array_get_count(ri.hf)); proto_register_subtree_array((gint**)wmem_array_get_raw(ri.ett), wmem_array_get_count(ri.ett)); + expert_radius = expert_register_protocol(proto_radius); + expert_register_field_array(expert_radius, ei, array_length(ei)); no_vendor.attrs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal); diff --git a/epan/dissectors/packet-rdt.c b/epan/dissectors/packet-rdt.c index 09460c0233..a3031afde3 100644 --- a/epan/dissectors/packet-rdt.c +++ b/epan/dissectors/packet-rdt.c @@ -35,6 +35,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/conversation.h> #include <epan/prefs.h> #include <epan/strutil.h> @@ -164,6 +165,8 @@ static gint ett_rdt_tirp_flags = -1; static gint ett_rdt_tirp_buffer_info = -1; static gint ett_rdt_bw_probing_flags = -1; +static expert_field ei_rdt_packet_length = EI_INIT; + /* Port preference settings */ static gboolean global_rdt_register_udp_port = FALSE; static guint global_rdt_udp_port = 6970; @@ -529,7 +532,7 @@ guint dissect_rdt_data_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre if (packet_length < (offset - start_offset) || packet_length > tvb_length_remaining(tvb, start_offset)) { - proto_tree_add_text(tree, tvb, 0, 0, "Packet length invalid"); + proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0); packet_length = tvb_length_remaining(tvb, start_offset); } @@ -610,7 +613,7 @@ guint dissect_rdt_asm_action_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tre if (packet_length < (offset - start_offset) || packet_length > tvb_length_remaining(tvb, start_offset)) { - proto_tree_add_text(tree, tvb, 0, 0, "Packet length invalid"); + proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0); packet_length = tvb_length_remaining(tvb, start_offset); } @@ -675,7 +678,7 @@ guint dissect_rdt_bandwidth_report_packet(tvbuff_t *tvb, packet_info *pinfo, pro if (packet_length < (offset - start_offset) || packet_length > tvb_length_remaining(tvb, start_offset)) { - proto_tree_add_text(tree, tvb, 0, 0, "Packet length invalid"); + proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0); packet_length = tvb_length_remaining(tvb, start_offset); } @@ -740,7 +743,7 @@ guint dissect_rdt_ack_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree if (packet_length < (offset - start_offset) || packet_length > tvb_length_remaining(tvb, start_offset)) { - proto_tree_add_text(tree, tvb, 0, 0, "Packet length invalid"); + proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0); packet_length = tvb_length_remaining(tvb, start_offset); } @@ -934,7 +937,7 @@ guint dissect_rdt_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if (packet_length < (offset - start_offset) || packet_length > tvb_length_remaining(tvb, start_offset)) { - proto_tree_add_text(tree, tvb, 0, 0, "Packet length invalid"); + proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0); packet_length = tvb_length_remaining(tvb, start_offset); } @@ -997,7 +1000,7 @@ guint dissect_rdt_latency_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto if (packet_length < (offset - start_offset) || packet_length > tvb_length_remaining(tvb, start_offset)) { - proto_tree_add_text(tree, tvb, 0, 0, "Packet length invalid"); + proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0); packet_length = tvb_length_remaining(tvb, start_offset); } @@ -1196,7 +1199,7 @@ guint dissect_rdt_bw_probing_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tre if (packet_length < (offset - start_offset) || packet_length > tvb_length_remaining(tvb, start_offset)) { - proto_tree_add_text(tree, tvb, 0, 0, "Packet length invalid"); + proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0); packet_length = tvb_length_remaining(tvb, start_offset); } @@ -2151,12 +2154,19 @@ void proto_register_rdt(void) &ett_rdt_bw_probing_flags }; + static ei_register_info ei[] = { + { &ei_rdt_packet_length, { "rdt.invalid_packet_length", PI_MALFORMED, PI_ERROR, "Packet length invalid", EXPFILL }}, + }; + module_t *rdt_module; + expert_module_t* expert_rdt; /* Register protocol and fields */ proto_rdt = proto_register_protocol("Real Data Transport", "RDT", "rdt"); proto_register_field_array(proto_rdt, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_rdt = expert_register_protocol(proto_rdt); + expert_register_field_array(expert_rdt, ei, array_length(ei)); register_dissector("rdt", dissect_rdt, proto_rdt); /* Preference settings */ diff --git a/epan/dissectors/packet-rip.c b/epan/dissectors/packet-rip.c index 410b2ac27b..88674a4b8c 100644 --- a/epan/dissectors/packet-rip.c +++ b/epan/dissectors/packet-rip.c @@ -31,6 +31,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/emem.h> #include <epan/prefs.h> #include <epan/to_str.h> @@ -140,10 +141,32 @@ static header_field_info hfi_rip_zero_padding RIP_HFI_INIT = { "Zero adding", "rip.zero_padding", FT_STRING, BASE_NONE, NULL, 0, "Authentication password", HFILL }; +static header_field_info hfi_rip_digest_offset RIP_HFI_INIT = { + "Digest Offset", "rip.digest_offset", FT_UINT16, BASE_DEC, + NULL, 0, NULL, HFILL }; + +static header_field_info hfi_rip_key_id RIP_HFI_INIT = { + "Key ID", "rip.key_id", FT_UINT8, BASE_DEC, + NULL, 0, NULL, HFILL }; + +static header_field_info hfi_rip_auth_data_len RIP_HFI_INIT = { + "Auth Data Len", "rip.auth_data_len", FT_UINT8, BASE_DEC, + NULL, 0, NULL, HFILL }; + +static header_field_info hfi_rip_auth_seq_num RIP_HFI_INIT = { + "Seq num", "rip.seq_num", FT_UINT32, BASE_DEC, + NULL, 0, NULL, HFILL }; + +static header_field_info hfi_rip_authentication_data RIP_HFI_INIT = { + "Authentication Data", "rip.authentication_data", FT_BYTES, BASE_NONE, + NULL, 0, NULL, HFILL }; + static gint ett_rip = -1; static gint ett_rip_vec = -1; static gint ett_auth_vec = -1; +static expert_field ei_rip_unknown_address_family = EI_INIT; + static void dissect_unspec_rip_vektor(tvbuff_t *tvb, int offset, guint8 version, proto_tree *tree); static void dissect_ip_rip_vektor(tvbuff_t *tvb, int offset, guint8 version, @@ -211,9 +234,8 @@ dissect_rip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; /* Intentional fall through: auth Entry MUST be the first! */ default: - proto_tree_add_text(rip_tree, tvb, offset, - RIP_ENTRY_LENGTH, "Unknown address family %u", - family); + proto_tree_add_expert_format(rip_tree, pinfo, &ei_rip_unknown_address_family, tvb, offset, + RIP_ENTRY_LENGTH, "Unknown address family %u", family); break; } @@ -282,7 +304,7 @@ dissect_rip_authentication(tvbuff_t *tvb, int offset, proto_tree *tree) { proto_tree *rip_authentication_tree; guint16 authtype; - guint32 val, digest_off, auth_data_len; + guint32 digest_off, auth_data_len; auth_data_len = 0; authtype = tvb_get_ntohs(tvb, offset + 2); @@ -302,24 +324,16 @@ dissect_rip_authentication(tvbuff_t *tvb, int offset, proto_tree *tree) case AUTH_KEYED_MSG_DIGEST: /* Keyed MD5 rfc 2082 */ digest_off = tvb_get_ntohs( tvb, offset+4 ); - proto_tree_add_text( rip_authentication_tree, tvb, offset+4, 2, - "Digest Offset: %u" , digest_off ); - val = tvb_get_guint8( tvb, offset+6 ); - proto_tree_add_text( rip_authentication_tree, tvb, offset+6, 1, - "Key ID: %u" , val ); + proto_tree_add_item( rip_authentication_tree, &hfi_rip_digest_offset, tvb, offset+4, 2, ENC_BIG_ENDIAN); + proto_tree_add_item( rip_authentication_tree, &hfi_rip_key_id, tvb, offset+6, 1, ENC_NA); auth_data_len = tvb_get_guint8( tvb, offset+7 ); - proto_tree_add_text( rip_authentication_tree, tvb, offset+7, 1, - "Auth Data Len: %u" , auth_data_len ); - val = tvb_get_ntohl( tvb, offset+8 ); - proto_tree_add_text( rip_authentication_tree, tvb, offset+8, 4, - "Seq num: %u" , val ); + proto_tree_add_item( rip_authentication_tree, &hfi_rip_auth_data_len, tvb, offset+7, 1, ENC_NA); + proto_tree_add_item( rip_authentication_tree, &hfi_rip_auth_seq_num, tvb, offset+8, 4, ENC_BIG_ENDIAN); proto_tree_add_item( rip_authentication_tree, &hfi_rip_zero_padding, tvb, offset+12, 8, ENC_NA); rip_authentication_tree = proto_tree_add_subtree( rip_authentication_tree, tvb, offset-4+digest_off, MD5_AUTH_DATA_LEN+4, ett_auth_vec, NULL, "Authentication Data Trailer" ); - proto_tree_add_text( rip_authentication_tree, tvb, offset-4+digest_off+4, - MD5_AUTH_DATA_LEN, "Authentication Data: %s", - tvb_bytes_to_ep_str_punct(tvb, offset-4+digest_off+4, - MD5_AUTH_DATA_LEN, ' ')); + proto_tree_add_item( rip_authentication_tree, &hfi_rip_authentication_data, tvb, offset-4+digest_off+4, + MD5_AUTH_DATA_LEN, ENC_NA); break; } return auth_data_len; @@ -351,15 +365,21 @@ proto_register_rip(void) &ett_auth_vec, }; + static ei_register_info ei[] = { + { &ei_rip_unknown_address_family, { "rip.unknown_address_family", PI_PROTOCOL, PI_WARN, "Unknown address family", EXPFILL }}, + }; + + expert_module_t* expert_rip; module_t *rip_module; int proto_rip; - proto_rip = proto_register_protocol("Routing Information Protocol", - "RIP", "rip"); + proto_rip = proto_register_protocol("Routing Information Protocol", "RIP", "rip"); hfi_rip = proto_registrar_get_nth(proto_rip); proto_register_fields(proto_rip, hfi, array_length(hfi)); proto_register_subtree_array(ett, array_length(ett)); + expert_rip = expert_register_protocol(proto_rip); + expert_register_field_array(expert_rip, ei, array_length(ei)); rip_module = prefs_register_protocol(proto_rip, proto_reg_handoff_rip); diff --git a/epan/dissectors/packet-rlc.c b/epan/dissectors/packet-rlc.c index d9e83eefd3..f4d77a6ada 100644 --- a/epan/dissectors/packet-rlc.c +++ b/epan/dissectors/packet-rlc.c @@ -1,4 +1,5 @@ -/* Routines for UMTS RLC (Radio Link Control) v9.3.0 disassembly +/* packet-rlc.c + * Routines for UMTS RLC (Radio Link Control) v9.3.0 disassembly * http://www.3gpp.org/ftp/Specs/archive/25_series/25.322/ * * Wireshark - Network traffic analyzer diff --git a/epan/dissectors/packet-rmt-lct.c b/epan/dissectors/packet-rmt-lct.c index 666517bbf0..b562212998 100644 --- a/epan/dissectors/packet-rmt-lct.c +++ b/epan/dissectors/packet-rmt-lct.c @@ -90,6 +90,12 @@ static int hf_send_rate = -1; static int hf_cenc = -1; static int hf_flute_version = -1; static int hf_fdt_instance_id = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_cc_rate = -1; +static int hf_cc_rtt = -1; +static int hf_cc_flags = -1; +static int hf_cc_loss = -1; +static int hf_cc_sequence = -1; static int ett_main = -1; static int ett_fsize = -1; @@ -210,16 +216,11 @@ int lct_ext_decode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, guint of break; case 3: /* EXT_CC RATE */ - proto_tree_add_text(ext_tree, tvb, offset+2, 2, - "CC Sequence: %u", tvb_get_ntohs(tvb, offset+2)); - proto_tree_add_text(ext_tree, tvb, offset+4, 1, - "CC Flags: 0x%x", tvb_get_guint8(tvb, offset+4)); - proto_tree_add_text(ext_tree, tvb, offset+5, 1, - "CC RTT: %u", tvb_get_guint8(tvb, offset+5)); - proto_tree_add_text(ext_tree, tvb, offset+6, 2, - "CC Loss: %g", tvb_get_ntohs(tvb, offset+6)/65535.0); - proto_tree_add_text(ext_tree, tvb, offset+8, 2, - "CC Rate: %u", tvb_get_ntohs(tvb, offset+8)); + proto_tree_add_item(ext_tree, hf_cc_sequence, tvb, offset+2, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_cc_flags, tvb, offset+4, 1, ENC_NA); + proto_tree_add_item(ext_tree, hf_cc_rtt, tvb, offset+5, 1, ENC_NA); + proto_tree_add_item(ext_tree, hf_cc_loss, tvb, offset+6, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_cc_rate, tvb, offset+8, 2, ENC_BIG_ENDIAN); break; case 64: /* EXT_FTI */ @@ -658,6 +659,12 @@ proto_register_rmt_lct(void) FT_UINT32, BASE_DEC, NULL, 0x000FFFFF, NULL, HFILL } }, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_cc_sequence, { "CC Sequence", "rmt-lct.cc_sequence", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_cc_flags, { "CC Flags", "rmt-lct.cc_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_cc_rtt, { "CC RTT", "rmt-lct.cc_rtt", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_cc_loss, { "CC Loss", "rmt-lct.cc_loss", FT_UINT16, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_cc_rate, { "CC Rate", "rmt-lct.cc_rate", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; /* Setup protocol subtree array */ diff --git a/epan/dissectors/packet-rohc.c b/epan/dissectors/packet-rohc.c index d1fb39c10b..1491565e12 100644 --- a/epan/dissectors/packet-rohc.c +++ b/epan/dissectors/packet-rohc.c @@ -118,6 +118,9 @@ static int hf_rohc_ipv6_tc = -1; static int hf_rohc_ipv6_hop_limit = -1; static int hf_rohc_ir_pkt_frame = -1; static int hf_rohc_ir_previous_frame = -1; +static int hf_rohc_ir_profile = -1; +static int hf_rohc_ir_ip_version = -1; +static int hf_rohc_ir_mode = -1; static int hf_rohc_comp_sn = -1; static int hf_rohc_r_0_crc = -1; static int hf_rohc_x = -1; @@ -141,6 +144,11 @@ static int hf_rohc_compressed_list_rem_bit_mask = -1; static int hf_rohc_spare_bits = -1; static int hf_rohc_ip_id = -1; static int hf_rohc_udp_checksum = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_rohc_no_configuration_info = -1; +static int hf_rohc_unknown_option_data = -1; +static int hf_rohc_error_packet = -1; +static int hf_rohc_configured_by_ir_packet = -1; static int ett_rohc = -1; static int ett_rohc_conf = -1; @@ -163,6 +171,11 @@ static expert_field ei_rohc_profile_spec_octet = EI_INIT; static expert_field ei_rohc_rohc_opt_clock = EI_INIT; static expert_field ei_rohc_opt_jitter = EI_INIT; static expert_field ei_rohc_feedback_type_2_is_not_applicable_for_uncompressed_profile = EI_INIT; +static expert_field ei_rohc_not_dissected_yet = EI_INIT; +static expert_field ei_rohc_profile_specific = EI_INIT; +static expert_field ei_rohc_profile_not_supported = EI_INIT; +static expert_field ei_rohc_ip_version = EI_INIT; +static expert_field ei_rohc_desegmentation_not_implemented = EI_INIT; static dissector_handle_t rohc_handle; @@ -416,7 +429,7 @@ dissect_rohc_pkt_type_0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int /* 5.7.5. Extension formats */ static int -dissect_rohc_ext_format(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 t, rohc_cid_context_t *rohc_cid_context) +dissect_rohc_ext_format(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint8 t, rohc_cid_context_t *rohc_cid_context) { guint8 ext_type = tvb_get_guint8(tvb, offset) & 0xc0; @@ -491,7 +504,7 @@ dissect_rohc_ext_format(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 t, r } offset++; } else { - proto_tree_add_text(tree, tvb, offset, -1, "extension 3[Not dissected yet]"); + proto_tree_add_expert_format(tree, pinfo, &ei_rohc_not_dissected_yet, tvb, offset, -1, "extension 3 [Not dissected yet]"); if (tvb_length_remaining(tvb, offset) > 0) offset += tvb_length_remaining(tvb, offset); } @@ -595,7 +608,7 @@ dissect_rohc_pkt_type_1_r_mode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr offset++; } if (x) { - offset = dissect_rohc_ext_format(tvb, pkt_tree, offset, t, rohc_cid_context); + offset = dissect_rohc_ext_format(tvb, pinfo, pkt_tree, offset, t, rohc_cid_context); } proto_item_set_len(ti, offset-start_offset); @@ -699,7 +712,7 @@ dissect_rohc_pkt_type_1_u_o_mode(tvbuff_t *tvb, packet_info *pinfo, proto_tree * offset++; } if (x) { - offset = dissect_rohc_ext_format(tvb, pkt_tree, offset, t, rohc_cid_context); + offset = dissect_rohc_ext_format(tvb, pinfo, pkt_tree, offset, t, rohc_cid_context); } proto_item_set_len(ti, offset-start_offset); @@ -819,7 +832,7 @@ dissect_rohc_pkt_type_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset++; } if (x) { - offset = dissect_rohc_ext_format(tvb, pkt_tree, offset, t, rohc_cid_context); + offset = dissect_rohc_ext_format(tvb, pinfo, pkt_tree, offset, t, rohc_cid_context); } proto_item_set_len(ti, offset-start_offset); @@ -862,7 +875,7 @@ dissect_rohc_feedback_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, } else { /* No context info, not much we can do */ proto_item_append_text(p_rohc_info->last_created_item, " (type %d)", (feedback_data_len==1) ? 1 : 2); - proto_tree_add_text(tree, tvb, offset, feedback_data_len, "profile-specific information[Profile not known]"); + proto_tree_add_expert_format(tree, pinfo, &ei_rohc_profile_not_supported, tvb, offset, feedback_data_len, "profile-specific information [Profile not known]"); return; } } @@ -892,7 +905,7 @@ dissect_rohc_feedback_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, col_append_fstr(pinfo->cinfo, COL_INFO, " (sn=%u)", oct); break; default: - proto_tree_add_text(tree, tvb, offset, feedback_data_len, "profile-specific information[Not dissected yet]"); + proto_tree_add_expert(tree, pinfo, &ei_rohc_profile_specific, tvb, offset, feedback_data_len); break; } return; @@ -976,7 +989,7 @@ dissect_rohc_feedback_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, col_append_fstr(pinfo->cinfo, COL_INFO, "Loss=%u ", oct); break; default: - proto_tree_add_text(rohc_feedback_tree, tvb, offset, opt_len, "Unknown Option data"); + proto_tree_add_item(rohc_feedback_tree, hf_rohc_unknown_option_data, tvb, offset, opt_len, ENC_NA); break; } feedback_data_len = feedback_data_len - opt_len; @@ -1358,7 +1371,7 @@ dissect_rohc_ir_rtp_profile_dynamic(tvbuff_t *tvb, packet_info *pinfo, proto_tre break; default: - proto_tree_add_text(tree, tvb, offset, 0, "Profile not supported"); + proto_tree_add_expert(tree, pinfo, &ei_rohc_profile_not_supported, tvb, offset, 0); return -1; } @@ -1430,7 +1443,7 @@ dissect_rohc_ir_rtp_profile_dynamic(tvbuff_t *tvb, packet_info *pinfo, proto_tre proto_tree_add_item(sub_tree, hf_rohc_ipv6_hop_limit, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* XXX TODO: use the IPv6 dissector to dissect Generic extension header list ?*/ - proto_tree_add_text(sub_tree, tvb, offset, -1, "Not dissected yet"); + proto_tree_add_expert(sub_tree, pinfo, &ei_rohc_not_dissected_yet, tvb, offset, -1); return -1; default: break; @@ -1574,7 +1587,7 @@ dissect_rohc_ir_rtp_profile_dynamic(tvbuff_t *tvb, packet_info *pinfo, proto_tre static int dissect_rohc_ir_rtp_udp_ip_profile_static(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, int offset, gboolean d, guint8 profile, rohc_cid_context_t *rohc_cid_context){ - proto_item *item, *ipv4_item, *udp_item, *rtp_item; + proto_item *item, *ipv4_item, *udp_item, *rtp_item, *ver_item; proto_tree *sub_tree = NULL, *static_ipv4_tree, *static_udp_tree, *static_rtp_tree; guint8 version, protocol; int start_offset, tree_start_offset; @@ -1599,7 +1612,7 @@ dissect_rohc_ir_rtp_udp_ip_profile_static(tvbuff_t *tvb, proto_tree *tree, packe break; default: - proto_tree_add_text(tree, tvb, offset, 0, "Profile not supported"); + proto_tree_add_expert(tree, pinfo, &ei_rohc_profile_not_supported, tvb, offset, 0); return -1; } @@ -1607,7 +1620,7 @@ dissect_rohc_ir_rtp_udp_ip_profile_static(tvbuff_t *tvb, proto_tree *tree, packe /* for all profiles except uncompressed */ if (profile != ROHC_PROFILE_UNCOMPRESSED) { version = tvb_get_guint8(tvb,offset)>>4; - proto_tree_add_item(sub_tree, hf_rohc_ip_version, tvb, offset, 1, ENC_BIG_ENDIAN); + ver_item = proto_tree_add_item(sub_tree, hf_rohc_ip_version, tvb, offset, 1, ENC_BIG_ENDIAN); rohc_cid_context->rohc_ip_version = version; switch(version) { @@ -1683,7 +1696,7 @@ dissect_rohc_ir_rtp_udp_ip_profile_static(tvbuff_t *tvb, proto_tree *tree, packe break; } default: - proto_tree_add_text(sub_tree, tvb, offset, -1, "Error unknown version, only 4 or 6 allowed"); + expert_add_info(pinfo, ver_item, &ei_rohc_ip_version); return -1; } } else { @@ -1752,7 +1765,7 @@ dissect_rohc_ir_rtp_udp_ip_profile_static(tvbuff_t *tvb, proto_tree *tree, packe } return offset; } else { - proto_tree_add_text(sub_tree, tvb, offset, -1, "[Not dissected yet]"); + proto_tree_add_expert(sub_tree, pinfo, &ei_rohc_not_dissected_yet, tvb, offset, -1); } return offset; } @@ -1911,7 +1924,7 @@ dissect_rohc_ir_packet(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, offset = dissect_rohc_ir_rtp_udp_ip_profile_static(tvb, ir_tree, pinfo, offset, d, profile, rohc_cid_context); break; default: - proto_tree_add_text(ir_tree, tvb, offset, feedback_data_len, "profile-specific information[Not dissected yet]"); + proto_tree_add_expert(ir_tree, pinfo, &ei_rohc_profile_specific, tvb, offset, feedback_data_len); offset = -1; break; } @@ -2016,7 +2029,7 @@ dissect_rohc_ir_dyn_packet(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, offset = dissect_rohc_ir_rtp_profile_dynamic(tvb, pinfo, ir_tree, offset, profile, rohc_cid_context); break; default: - proto_tree_add_text(ir_tree, tvb, offset, feedback_data_len, "profile-specific information[Not dissected yet]"); + proto_tree_add_expert(ir_tree, pinfo, &ei_rohc_profile_specific, tvb, offset, feedback_data_len); break; } @@ -2081,7 +2094,7 @@ dissect_rohc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) if(rohc_cid_context){ /* Do we have info from an IR frame? */ if(rohc_cid_context->ir_frame_number>0){ - conf_item = proto_tree_add_text(conf_tree, tvb, offset, 0, "Configured by IR packet"); + conf_item = proto_tree_add_item(conf_tree, hf_rohc_configured_by_ir_packet, tvb, offset, 0, ENC_NA); PROTO_ITEM_SET_GENERATED(conf_item); conf_item = proto_tree_add_uint(conf_tree, hf_rohc_ir_pkt_frame, tvb, 0, 0, rohc_cid_context->ir_frame_number); PROTO_ITEM_SET_GENERATED(conf_item); @@ -2089,20 +2102,20 @@ dissect_rohc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) conf_item = proto_tree_add_uint(conf_tree, hf_rohc_ir_previous_frame, tvb, 0, 0, rohc_cid_context->prev_ir_frame_number); PROTO_ITEM_SET_GENERATED(conf_item); } - conf_item = proto_tree_add_text(conf_tree, tvb, offset, 0, "Profile:(%s)", val_to_str_const(rohc_cid_context->profile, rohc_profile_vals, "Unknown")); + conf_item = proto_tree_add_uint(conf_tree, hf_rohc_ir_profile, tvb, offset, 0, rohc_cid_context->profile); PROTO_ITEM_SET_GENERATED(conf_item); - conf_item = proto_tree_add_text(conf_tree, tvb, offset, 0, "IP version:(%s)", val_to_str_const(rohc_cid_context->rohc_ip_version, rohc_ip_version_vals, "Unknown")); + conf_item = proto_tree_add_uint(conf_tree, hf_rohc_ir_ip_version, tvb, offset, 0, rohc_cid_context->rohc_ip_version); PROTO_ITEM_SET_GENERATED(conf_item); if(rohc_cid_context->mode == 0){ - conf_item = proto_tree_add_text(conf_tree, tvb, offset, 0, "Mode not known"); + conf_item = proto_tree_add_uint_format_value(conf_tree, hf_rohc_ir_mode, tvb, offset, 0, 0, "not known"); PROTO_ITEM_SET_GENERATED(conf_item); }else{ - conf_item = proto_tree_add_text(conf_tree, tvb, offset, 0, "Mode:(%s)", val_to_str_const(rohc_cid_context->mode, rohc_mode_vals, "Unknown")); + conf_item = proto_tree_add_uint(conf_tree, hf_rohc_ir_mode, tvb, offset, 0, rohc_cid_context->mode); PROTO_ITEM_SET_GENERATED(conf_item); } }else{ - conf_item = proto_tree_add_text(conf_tree, tvb, offset, 0, "No configuration info"); + conf_item = proto_tree_add_item(conf_tree, hf_rohc_no_configuration_info, tvb, offset, 0, ENC_NA); PROTO_ITEM_SET_GENERATED(conf_item); } } @@ -2143,7 +2156,7 @@ start_over: if(is_add_cid){ p_rohc_info->last_created_item = proto_tree_add_item(rohc_tree, hf_rohc_feedback, tvb, offset, 1, ENC_BIG_ENDIAN); col_append_str(pinfo->cinfo, COL_INFO, "Error packet"); - proto_tree_add_text(rohc_tree, tvb, offset, -1, "Error packet"); + proto_tree_add_item(rohc_tree, hf_rohc_error_packet, tvb, offset, -1, ENC_NA); return tvb_length(tvb); }else{ col_append_str(pinfo->cinfo, COL_INFO, "Feedback "); @@ -2209,7 +2222,7 @@ start_over: item = proto_tree_add_uint(rohc_tree, hf_rohc_small_cid, tvb, 0, 0, cid); PROTO_ITEM_SET_GENERATED(item); } - proto_tree_add_text(rohc_tree, tvb, offset, -1, "Segment [Desegmentation not implemented yet]"); + proto_tree_add_expert(rohc_tree, pinfo, &ei_rohc_desegmentation_not_implemented, tvb, offset, -1); return tvb_length(tvb); } /* 6) Here, it is known that the rest is forward information (unless the @@ -2222,7 +2235,7 @@ start_over: /* Could not parse header */ return tvb_length(tvb); } - /*proto_tree_add_text(rohc_tree, tvb, offset, -1, "Data");*/ + payload_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector_only(data_handle, payload_tvb, pinfo, rohc_tree, NULL); return tvb_length(tvb); @@ -2234,7 +2247,7 @@ start_over: /* Could not parse header */ return tvb_length(tvb); } - /*proto_tree_add_text(rohc_tree, tvb, offset, -1, "Data");*/ + payload_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector_only(data_handle, payload_tvb, pinfo, rohc_tree, NULL); return tvb_length(tvb); @@ -2762,6 +2775,26 @@ proto_register_rohc(void) { &hf_rohc_ir_previous_frame, { "Previous IR frame","rohc.ir.prev.frame_num", FT_FRAMENUM, BASE_NONE, NULL, 0x0, + NULL , HFILL, + } + }, + { &hf_rohc_ir_profile, + { "Mode","rohc.ir_profile", + FT_UINT16, BASE_DEC, VALS(rohc_profile_vals), 0x0, + NULL , HFILL + } + }, + + { &hf_rohc_ir_ip_version, + { "Mode","rohc.ir_ip_version", + FT_UINT16, BASE_DEC, VALS(rohc_ip_version_vals), 0x0, + NULL , HFILL + } + }, + + { &hf_rohc_ir_mode, + { "Mode","rohc.ir_mode", + FT_UINT32, BASE_DEC, VALS(rohc_mode_vals), 0x0, NULL , HFILL } }, @@ -2903,7 +2936,11 @@ proto_register_rohc(void) NULL, HFILL } }, - + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_rohc_unknown_option_data, { "Unknown Option data", "rohc.unknown_option_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_rohc_configured_by_ir_packet, { "Configured by IR packet", "rohc.configured_by_ir_packet", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_rohc_no_configuration_info, { "No configuration info", "rohc.no_configuration_info", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_rohc_error_packet, { "Error packet", "rohc.error_packet", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; /* Setup protocol subtree array */ @@ -2931,6 +2968,11 @@ proto_register_rohc(void) { &ei_rohc_feedback_type_2_is_not_applicable_for_uncompressed_profile, { "rohc.feedback.type_2_is_not_applicable_for_uncompressed_profile", PI_PROTOCOL, PI_WARN, "Feedback type 2 is not applicable for uncompressed profile", EXPFILL }}, { &ei_rohc_rohc_opt_clock, { "rohc.opt.clock.udp", PI_MALFORMED, PI_ERROR, "CLOCK option should not be used for UDP", EXPFILL }}, { &ei_rohc_opt_jitter, { "rohc.opt.jitter.udp", PI_MALFORMED, PI_ERROR, "JITTER option should not be used for UDP", EXPFILL }}, + { &ei_rohc_not_dissected_yet, { "rohc.not_dissected_yet", PI_UNDECODED, PI_WARN, "Not dissected yet", EXPFILL }}, + { &ei_rohc_profile_specific, { "rohc.profile_specific", PI_UNDECODED, PI_WARN, "profile-specific information [Not dissected yet]", EXPFILL }}, + { &ei_rohc_profile_not_supported, { "rohc.profile_not_supported", PI_PROTOCOL, PI_WARN, "Profile not supported", EXPFILL }}, + { &ei_rohc_ip_version, { "rohc.ip.version.unknown", PI_PROTOCOL, PI_WARN, "Error unknown version, only 4 or 6 allowed", EXPFILL }}, + { &ei_rohc_desegmentation_not_implemented, { "rohc.desegmentation_not_implemented", PI_UNDECODED, PI_WARN, "Segment [Desegmentation not implemented yet]", EXPFILL }}, }; expert_module_t* expert_rohc; diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c index c2ab8dde2b..1aaeacb120 100644 --- a/epan/dissectors/packet-rpc.c +++ b/epan/dissectors/packet-rpc.c @@ -30,6 +30,7 @@ #include <string.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/exceptions.h> #include <wsutil/pint.h> #include <epan/conversation.h> @@ -252,6 +253,15 @@ static int hf_rpc_fragment_error = -1; static int hf_rpc_fragment_count = -1; static int hf_rpc_reassembled_length = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_rpc_opaque_data = -1; +static int hf_rpc_no_values = -1; +static int hf_rpc_continuation_data = -1; +static int hf_rpc_fill_bytes = -1; +static int hf_rpc_argument_length = -1; +static int hf_rpc_fragment_data = -1; +static int hf_rpc_opaque_length = -1; + static gint ett_rpc = -1; static gint ett_rpc_unknown_program = -1; static gint ett_rpc_fragments = -1; @@ -268,6 +278,8 @@ static gint ett_rpc_authgssapi_msg = -1; static gint ett_gss_context = -1; static gint ett_gss_wrap = -1; +static expert_field ei_rpc_cannot_dissect = EI_INIT; + static dissector_handle_t rpc_tcp_handle; static dissector_handle_t rpc_handle; static dissector_handle_t gssapi_handle; @@ -686,8 +698,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, string_buffer_print); } if (!fixed_length) { - proto_tree_add_text(string_tree, tvb,offset,4, - "length: %u", string_length); + proto_tree_add_uint(string_tree, hf_rpc_opaque_length, tvb,offset, 4, string_length); offset += 4; } @@ -710,14 +721,12 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, if (fill_length) { if (string_tree) { if (fill_truncated) { - proto_tree_add_text(string_tree, tvb, - offset,fill_length_copy, - "fill bytes: opaque data<TRUNCATED>"); + proto_tree_add_bytes_format_value(string_tree, hf_rpc_fill_bytes, tvb, + offset, fill_length_copy, NULL, "opaque data<TRUNCATED>"); } else { - proto_tree_add_text(string_tree, tvb, - offset,fill_length_copy, - "fill bytes: opaque data"); + proto_tree_add_bytes_format_value(string_tree, hf_rpc_fill_bytes, tvb, + offset, fill_length_copy, NULL, "opaque data"); } } offset += fill_length_copy; @@ -809,7 +818,7 @@ dissect_rpc_array(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, lock_tree = proto_item_add_subtree(lock_item, ett_rpc_array); if(num == 0) { - proto_tree_add_text(lock_tree, tvb, offset, 4, "no values"); + proto_tree_add_item(lock_tree, hf_rpc_no_values, tvb, offset, 4, ENC_NA); offset += 4; proto_item_set_end(lock_item, tvb, offset); @@ -1021,17 +1030,7 @@ static int dissect_rpc_authdes_desblock(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset) { - guint32 value_low; - guint32 value_high; - - value_high = tvb_get_ntohl(tvb, offset); - value_low = tvb_get_ntohl(tvb, offset + 4); - - if (tree) { - proto_tree_add_text(tree, tvb, offset, 8, - "%s: 0x%x%08x", proto_registrar_get_name(hfindex), value_high, - value_low); - } + proto_tree_add_item(tree, hfindex, tvb, offset, 8, ENC_BIG_ENDIAN); return offset + 8; } @@ -1182,8 +1181,7 @@ dissect_rpc_cred(tvbuff_t* tvb, proto_tree* tree, int offset, default: if (length) - proto_tree_add_text(ctree, tvb, offset+8, - length,"opaque data"); + proto_tree_add_item(ctree, hf_rpc_opaque_data, tvb, offset+8, length, ENC_NA); break; } } @@ -1296,8 +1294,7 @@ dissect_rpc_verf(tvbuff_t* tvb, proto_tree* tree, int offset, int msg_type, proto_tree_add_uint(vtree, hf_rpc_auth_length, tvb, offset+4, 4, length); if (length) - proto_tree_add_text(vtree, tvb, offset+8, - length, "opaque data"); + proto_tree_add_item(vtree, hf_rpc_opaque_data, tvb, offset+8, length, ENC_NA); break; } } @@ -1642,9 +1639,7 @@ dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if ( tree ) { - proto_tree_add_text(tree, tvb, offset, 4, - "Argument length: %u", - tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rpc_argument_length, tvb, offset, 4, ENC_BIG_ENDIAN); } offset += 4; @@ -1780,8 +1775,7 @@ dissect_rpc_indir_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* Put the length of the reply value into the tree. */ - proto_tree_add_text(tree, tvb, offset, 4, "Argument length: %u", - tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rpc_argument_length, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; /* Dissect the return value */ @@ -1805,7 +1799,7 @@ dissect_rpc_continuation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { rpc_item = proto_tree_add_item(tree, proto_rpc, tvb, 0, -1, ENC_NA); rpc_tree = proto_item_add_subtree(rpc_item, ett_rpc); - proto_tree_add_text(rpc_tree, tvb, 0, -1, "Continuation data"); + proto_tree_add_item(rpc_tree, hf_rpc_continuation_data, tvb, 0, -1, ENC_NA); } } @@ -2709,7 +2703,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * We don't know the authentication flavor, so we can't * dissect the payload. */ - proto_tree_add_text(ptree, tvb, offset, -1, + proto_tree_add_expert_format(ptree, pinfo, &ei_rpc_cannot_dissect, tvb, offset, -1, "Unknown authentication flavor - cannot dissect"); return TRUE; @@ -2728,7 +2722,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * procedure and service information, so we can't dissect * the payload. */ - proto_tree_add_text(ptree, tvb, offset, -1, + proto_tree_add_expert_format(ptree, pinfo, &ei_rpc_cannot_dissect, tvb, offset, -1, "GSS-API authentication, but procedure and service unknown - cannot dissect"); return TRUE; @@ -2952,7 +2946,7 @@ show_rpc_fragment(tvbuff_t *tvb, proto_tree *tree, guint32 rpc_rm) * Show the fragment header and the data for the fragment. */ show_rpc_fragheader(tvb, tree, rpc_rm); - proto_tree_add_text(tree, tvb, 4, -1, "Fragment Data"); + proto_tree_add_item(tree, hf_rpc_fragment_data, tvb, 4, -1, ENC_NA); } } @@ -3888,7 +3882,7 @@ proto_register_rpc(void) "Netname", "rpc.authdes.netname", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_rpc_authdes_convkey, { - "Conversation Key (encrypted)", "rpc.authdes.convkey", FT_UINT32, + "Conversation Key (encrypted)", "rpc.authdes.convkey", FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_rpc_authdes_window, { "Window (encrypted)", "rpc.authdes.window", FT_UINT32, @@ -3897,13 +3891,13 @@ proto_register_rpc(void) "Nickname", "rpc.authdes.nickname", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_rpc_authdes_timestamp, { - "Timestamp (encrypted)", "rpc.authdes.timestamp", FT_UINT32, + "Timestamp (encrypted)", "rpc.authdes.timestamp", FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_rpc_authdes_windowverf, { "Window verifier (encrypted)", "rpc.authdes.windowverf", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_rpc_authdes_timeverf, { - "Timestamp verifier (encrypted)", "rpc.authdes.timeverf", FT_UINT32, + "Timestamp verifier (encrypted)", "rpc.authdes.timeverf", FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_rpc_auth_machinename, { "Machine Name", "rpc.auth.machinename", FT_STRING, @@ -3924,6 +3918,15 @@ proto_register_rpc(void) "num", "rpc.array.len", FT_UINT32, BASE_DEC, NULL, 0, "Length of RPC array", HFILL }}, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_rpc_opaque_length, { "length", "rpc.opaque_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_rpc_fill_bytes, { "fill bytes", "rpc.fill_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_rpc_no_values, { "no values", "rpc.array_no_values", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_rpc_opaque_data, { "opaque data", "rpc.opaque_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_rpc_argument_length, { "Argument length", "rpc.argument_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_rpc_continuation_data, { "Continuation data", "rpc.continuation_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_rpc_fragment_data, { "Fragment Data", "rpc.fragment_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_rpc_time, { "Time from request", "rpc.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0, "Time between Request and Reply for ONC-RPC calls", HFILL }}, @@ -3982,13 +3985,20 @@ proto_register_rpc(void) &ett_gss_context, &ett_gss_wrap, }; + static ei_register_info ei[] = { + { &ei_rpc_cannot_dissect, { "rpc.cannot_dissect", PI_UNDECODED, PI_WARN, "Cannot dissect", EXPFILL }}, + }; + module_t *rpc_module; + expert_module_t* expert_rpc; + + proto_rpc = proto_register_protocol("Remote Procedure Call", "RPC", "rpc"); - proto_rpc = proto_register_protocol("Remote Procedure Call", - "RPC", "rpc"); /* this is a dummy dissector for all those unknown rpc programs */ proto_register_field_array(proto_rpc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_rpc = expert_register_protocol(proto_rpc); + expert_register_field_array(expert_rpc, ei, array_length(ei)); register_init_routine(&rpc_init_protocol); rpc_module = prefs_register_protocol(proto_rpc, NULL); diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c index 9cb66b9cb0..bd40b7065c 100644 --- a/epan/dissectors/packet-sccp.c +++ b/epan/dissectors/packet-sccp.c @@ -689,6 +689,11 @@ static int hf_sccp_xudt_msg_reassembled_in = -1; static int hf_sccp_xudt_msg_reassembled_length = -1; static int hf_sccp_assoc_msg = -1; static int hf_sccp_assoc_id = -1; +static int hf_sccp_segmented_data = -1; +static int hf_sccp_linked_dissector = -1; +static int hf_sccp_end_optional_param = -1; +static int hf_sccp_unknown_message = -1; +static int hf_sccp_unknown_parameter = -1; /* Initialize the subtree pointers */ static gint ett_sccp = -1; @@ -1572,16 +1577,16 @@ dissect_sccp_unknown_message(tvbuff_t *message_tvb, proto_tree *sccp_tree) message_length = tvb_length(message_tvb); - proto_tree_add_text(sccp_tree, message_tvb, 0, message_length, - "Unknown message (%u byte%s)", + proto_tree_add_bytes_format(sccp_tree, hf_sccp_unknown_message, message_tvb, 0, message_length, + NULL, "Unknown message (%u byte%s)", message_length, plurality(message_length, "", "s")); } static void dissect_sccp_unknown_param(tvbuff_t *tvb, proto_tree *tree, guint8 type, guint length) { - proto_tree_add_text(tree, tvb, 0, length, "Unknown parameter 0x%x (%u byte%s)", - type, length, plurality(length, "", "s")); + proto_tree_add_bytes_format(tree, hf_sccp_unknown_parameter, tvb, 0, length, NULL, + "Unknown parameter 0x%x (%u byte%s)", type, length, plurality(length, "", "s")); } static void @@ -1981,8 +1986,8 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * ssn_dissector_short_name = dissector_handle_get_short_name(ssn_dissector); if (ssn_dissector_short_name) { - item = proto_tree_add_text(call_tree, tvb, offset - 1, ADDRESS_SSN_LENGTH, - "Linked to %s", ssn_dissector_short_name); + item = proto_tree_add_string_format(call_tree, hf_sccp_linked_dissector, tvb, offset - 1, ADDRESS_SSN_LENGTH, + ssn_dissector_short_name, "Linked to %s", ssn_dissector_short_name); PROTO_ITEM_SET_GENERATED(item); if (g_ascii_strncasecmp("TCAP", ssn_dissector_short_name, 4)== 0) { @@ -2514,8 +2519,7 @@ dissect_sccp_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccp_tree, switch (parameter_type) { case PARAMETER_END_OF_OPTIONAL_PARAMETERS: - proto_tree_add_text(sccp_tree, tvb, offset, parameter_length, - "End of Optional"); + proto_tree_add_item(sccp_tree, hf_sccp_end_optional_param, tvb, offset, parameter_length, ENC_NA); break; case PARAMETER_DESTINATION_LOCAL_REFERENCE: @@ -2892,9 +2896,8 @@ dissect_sccp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccp_tree, /* Reassemble */ if (!sccp_reassemble) { - proto_tree_add_text(sccp_tree, tvb, variable_pointer1, - tvb_get_guint8(tvb, variable_pointer1)+1, - "Segmented Data"); + proto_tree_add_item(sccp_tree, hf_sccp_segmented_data, tvb, variable_pointer1, + tvb_get_guint8(tvb, variable_pointer1)+1, ENC_NA); dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree, PARAMETER_DATA, variable_pointer1); @@ -3118,7 +3121,7 @@ dissect_sccp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccp_tree, if (tvb_get_guint8(tvb, optional_pointer) == PARAMETER_SEGMENTATION) { if (!sccp_reassemble) { - proto_tree_add_text(sccp_tree, tvb, variable_pointer3, tvb_get_guint8(tvb, variable_pointer3)+1, "Segmented Data"); + proto_tree_add_item(sccp_tree, hf_sccp_segmented_data, tvb, variable_pointer3, tvb_get_guint8(tvb, variable_pointer3)+1, ENC_NA); } else { guint8 octet; gboolean more_frag = TRUE; @@ -3205,7 +3208,7 @@ dissect_sccp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccp_tree, if (tvb_get_guint8(tvb, optional_pointer) == PARAMETER_SEGMENTATION) { if (!sccp_reassemble) { - proto_tree_add_text(sccp_tree, tvb, variable_pointer3, tvb_get_guint8(tvb, variable_pointer3)+1, "Segmented Data"); + proto_tree_add_item(sccp_tree, hf_sccp_segmented_data, tvb, variable_pointer3, tvb_get_guint8(tvb, variable_pointer3)+1, ENC_NA); } else { guint8 octet; @@ -4015,6 +4018,31 @@ proto_register_sccp(void) FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + {&hf_sccp_segmented_data, + { "Segmented Data", "sccp.segmented_data", + FT_BYTES, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + {&hf_sccp_linked_dissector, + { "Linked dissector", "sccp.linked_dissector", + FT_STRING, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + {&hf_sccp_end_optional_param, + { "End of Optional", "sccp.end_optional_param", + FT_NONE, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + {&hf_sccp_unknown_message, + { "Unknown message", "sccp.unknown_message", + FT_BYTES, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + {&hf_sccp_unknown_parameter, + { "Unknown parameter", "sccp.unknown_parameter", + FT_BYTES, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, }; /* Setup protocol subtree array */ |