2 * Routines for ASF packet dissection
4 * Duncan Laurie <duncan@sun.com>
6 * $Id: packet-asf.c,v 1.2 2003/06/04 08:51:36 guy Exp $
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@ethereal.com>
10 * Copyright 1998 Gerald Combs
12 * Copied from packet-rmcp.c
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
35 #include <epan/packet.h>
40 * http://www.dmtf.org/standards/standard_alert.php
43 #define RMCP_CLASS_ASF 0x06
45 static int proto_asf = -1;
46 static int hf_asf_iana = -1;
47 static int hf_asf_type = -1;
48 static int hf_asf_tag = -1;
49 static int hf_asf_len = -1;
51 static dissector_handle_t data_handle;
52 static gint ett_asf = -1;
54 static const value_string asf_type_vals[] = {
57 { 0x12, "Unconditional Power-down" },
58 { 0x13, "Power Cycle" },
59 { 0x40, "Presence Pong" },
60 { 0x41, "Capabilities Response" },
61 { 0x42, "System State Response" },
62 { 0x80, "Presence Ping" },
63 { 0x81, "Capabilities Request" },
64 { 0x82, "System State Request" },
69 dissect_asf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
71 proto_tree *asf_tree = NULL;
77 if (check_col(pinfo->cinfo, COL_PROTOCOL))
78 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ASF");
80 if (check_col(pinfo->cinfo, COL_INFO))
81 col_clear(pinfo->cinfo, COL_INFO);
83 type = tvb_get_guint8(tvb, 4);
84 len = tvb_get_guint8(tvb, 7);
86 if (check_col(pinfo->cinfo, COL_INFO))
87 col_add_fstr(pinfo->cinfo, COL_INFO, "%s",
88 val_to_str(type, asf_type_vals, "Unknown (0x%02x)"));
91 ti = proto_tree_add_item(tree, proto_asf, tvb, 0, 8, TRUE);
92 asf_tree = proto_item_add_subtree(ti, ett_asf);
93 proto_tree_add_item(asf_tree, hf_asf_iana, tvb, 0, 4, TRUE);
94 proto_tree_add_item(asf_tree, hf_asf_type, tvb, 4, 1, TRUE);
95 proto_tree_add_item(asf_tree, hf_asf_tag, tvb, 5, 1, TRUE);
96 proto_tree_add_item(asf_tree, hf_asf_len, tvb, 7, 1, TRUE);
100 next_tvb = tvb_new_subset(tvb, 8, -1, len);
101 call_dissector(data_handle, next_tvb, pinfo, tree);
106 proto_register_asf(void)
108 static hf_register_info hf[] = {
110 "IANA Enterprise Number", "asf.iana",
111 FT_UINT32, BASE_HEX, NULL, 0,
112 "ASF IANA Enterprise Number", HFILL }},
114 "Message Type", "asf.type",
115 FT_UINT8, BASE_HEX, VALS(asf_type_vals), 0,
116 "ASF Message Type", HFILL }},
118 "Message Tag", "asf.tag",
119 FT_UINT8, BASE_HEX, NULL, 0,
120 "ASF Message Tag", HFILL }},
122 "Data Length", "asf.len",
123 FT_UINT8, BASE_DEC, NULL, 0,
124 "ASF Data Length", HFILL }},
126 static gint *ett[] = {
130 proto_asf = proto_register_protocol(
131 "Alert Standard Forum", "ASF", "asf");
133 proto_register_field_array(proto_asf, hf, array_length(hf));
134 proto_register_subtree_array(ett, array_length(ett));
138 proto_reg_handoff_asf(void)
140 dissector_handle_t asf_handle;
142 data_handle = find_dissector("data");
144 asf_handle = create_dissector_handle(dissect_asf, proto_asf);
145 dissector_add("rmcp.class", RMCP_CLASS_ASF, asf_handle);