2 * Routines for cisco tacacs/tacplus/AAA packet dissection
4 * $Id: packet-tacacs.c,v 1.2 2000/01/07 22:05:41 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
8 * Copyright 1998 Gerald Combs
10 * Copied from packet-tftp.c
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #ifdef HAVE_SYS_TYPES_H
34 # include <sys/types.h>
37 #ifdef HAVE_NETINET_IN_H
38 # include <netinet/in.h>
45 static int proto_tacacs = -1;
46 static int hf_tacacs_request = -1;
47 static int hf_tacacs_response = -1;
48 static int hf_tacacs_version = -1;
50 static gint ett_tacacs = -1;
53 dissect_tacacs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
55 proto_tree *tacacs_tree, *ti;
57 if (check_col(fd, COL_PROTOCOL))
58 col_add_str(fd, COL_PROTOCOL, "TACACS");
60 if (check_col(fd, COL_INFO))
62 col_add_fstr(fd, COL_INFO, "%s",
63 (pi.match_port == pi.destport) ? "Request" : "Response");
68 ti = proto_tree_add_item(tree, proto_tacacs, offset, END_OF_FRAME, NULL);
69 tacacs_tree = proto_item_add_subtree(ti, ett_tacacs);
71 proto_tree_add_item(tacacs_tree, hf_tacacs_version, 0, 0, "XTacacs");
73 if (pi.match_port == pi.destport)
75 proto_tree_add_item_hidden(tacacs_tree, hf_tacacs_request,
76 offset, END_OF_FRAME, TRUE);
77 proto_tree_add_text(tacacs_tree, offset,
78 END_OF_FRAME, "Request: <opaque data>" );
82 proto_tree_add_item_hidden(tacacs_tree, hf_tacacs_response,
83 offset, END_OF_FRAME, TRUE);
84 proto_tree_add_text(tacacs_tree, offset,
85 END_OF_FRAME, "Response: <opaque data>");
91 dissect_tacplus(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
93 proto_tree *tacacs_tree, *ti;
95 if (check_col(fd, COL_PROTOCOL))
96 col_add_str(fd, COL_PROTOCOL, "TACACS");
98 if (check_col(fd, COL_INFO))
100 col_add_fstr(fd, COL_INFO, "%s",
101 (pi.match_port == pi.destport) ? "Request" : "Response");
106 ti = proto_tree_add_item(tree, proto_tacacs, offset, END_OF_FRAME, NULL);
107 tacacs_tree = proto_item_add_subtree(ti, ett_tacacs);
109 proto_tree_add_item(tacacs_tree, hf_tacacs_version, 0, 0, "Tacacs+");
111 if (pi.match_port == pi.destport)
113 proto_tree_add_item_hidden(tacacs_tree, hf_tacacs_request,
114 offset, END_OF_FRAME, TRUE);
115 proto_tree_add_text(tacacs_tree, offset,
116 END_OF_FRAME, "Request: <opaque data>" );
120 proto_tree_add_item_hidden(tacacs_tree, hf_tacacs_response,
121 offset, END_OF_FRAME, TRUE);
122 proto_tree_add_text(tacacs_tree, offset,
123 END_OF_FRAME, "Response: <opaque data>");
129 proto_register_tacacs(void)
131 static hf_register_info hf[] = {
132 { &hf_tacacs_version,
133 { "Tacacs Version", "tacacs.version",
134 FT_STRING, BASE_NONE, NULL, 0x0,
135 "xtacacs or tacplus" }},
136 { &hf_tacacs_response,
137 { "Response", "tacacs.response",
138 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
139 "TRUE if TACACS response" }},
140 { &hf_tacacs_request,
141 { "Request", "tacacs.request",
142 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
143 "TRUE if TACACS request" }}
146 static gint *ett[] = {
149 proto_tacacs = proto_register_protocol("TACACS", "tacacs");
150 proto_register_field_array(proto_tacacs, hf, array_length(hf));
151 proto_register_subtree_array(ett, array_length(ett));