diff options
author | Michael Mann <mmann78@netscape.net> | 2014-08-01 10:08:57 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-08-03 16:30:10 +0000 |
commit | 5db1352526e71727091ff0e1c0e97821eec4e4cb (patch) | |
tree | 01f836967616b7ae8b2840c488b500c7ff13d55c /epan/dissectors/packet-cups.c | |
parent | 3fa5625ea074908d5617111a7edfcf6d95e6108a (diff) |
Eliminate proto_tree_add_text from some dissectors.
Change-Id: I398e9cf4f6882e76644aa758e12c39a39159e95f
Reviewed-on: https://code.wireshark.org/review/3319
Petri-Dish: Michael Mann <mmann78@netscape.net>
Petri-Dish: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-cups.c')
-rw-r--r-- | epan/dissectors/packet-cups.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/epan/dissectors/packet-cups.c b/epan/dissectors/packet-cups.c index b99c586d8d..190541e3e3 100644 --- a/epan/dissectors/packet-cups.c +++ b/epan/dissectors/packet-cups.c @@ -97,6 +97,10 @@ static int hf_cups_ptype_bw = -1; static int hf_cups_ptype_remote = -1; static int hf_cups_ptype_class = -1; static int hf_cups_state = -1; +static int hf_cups_uri = -1; +static int hf_cups_location = -1; +static int hf_cups_information = -1; +static int hf_cups_make_model = -1; static gint ett_cups = -1; static gint ett_cups_ptype = -1; @@ -182,8 +186,7 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (str == NULL) return; /* separator/terminator not found */ - proto_tree_add_text(cups_tree, tvb, offset, len, - "URI: %.*s", (guint16) len, str); + proto_tree_add_string(cups_tree, hf_cups_uri, tvb, offset, len, str); col_add_fstr(pinfo->cinfo, COL_INFO, "%.*s (%s)", (guint16) len, str, val_to_str(state, cups_state_values, "0x%x")); offset = next_offset; @@ -198,8 +201,7 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) str = get_quoted_string(tvb, offset, &next_offset, &len); if (str == NULL) return; /* separator/terminator not found */ - proto_tree_add_text(cups_tree, tvb, offset+1, len, - "Location: \"%.*s\"", (guint16) len, str); + proto_tree_add_string(cups_tree, hf_cups_location, tvb, offset+1, len, str); offset = next_offset; if (!skip_space(tvb, offset, &next_offset)) @@ -209,8 +211,7 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) str = get_quoted_string(tvb, offset, &next_offset, &len); if (str == NULL) return; /* separator/terminator not found */ - proto_tree_add_text(cups_tree, tvb, offset+1, len, - "Information: \"%.*s\"", (guint16) len, str); + proto_tree_add_string(cups_tree, hf_cups_information, tvb, offset+1, len, str); offset = next_offset; if (!skip_space(tvb, offset, &next_offset)) @@ -220,8 +221,7 @@ dissect_cups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) str = get_quoted_string(tvb, offset, &next_offset, &len); if (str == NULL) return; /* separator/terminator not found */ - proto_tree_add_text(cups_tree, tvb, offset+1, len, - "Make and model: \"%.*s\"", (guint16) len, str); + proto_tree_add_string(cups_tree, hf_cups_make_model, tvb, offset+1, len, str); } static guint @@ -375,7 +375,19 @@ proto_register_cups(void) TFS(&tfs_printer_class), CUPS_PRINTER_CLASS, NULL, HFILL }}, { &hf_cups_state, { "State", "cups.state", FT_UINT8, BASE_HEX, - VALS(cups_state_values), 0x0, NULL, HFILL }} + VALS(cups_state_values), 0x0, NULL, HFILL }}, + { &hf_cups_uri, + { "URI", "cups.uri", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + { &hf_cups_location, + { "Location", "cups.location", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + { &hf_cups_information, + { "Information", "cups.information", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + { &hf_cups_make_model, + { "Make and model", "cups.make_model", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { |