4 * Definitions for RADIUS packet disassembly
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <epan/proto.h>
28 /* radius packet-type codes */
29 /* 09/12/2011: Updated from IANA:
30 * http://www.iana.org/assignments/radius-types/radius-types.xml#radius-types-27
32 #define RADIUS_PKT_TYPE_ACCESS_REQUEST 1
33 #define RADIUS_PKT_TYPE_ACCESS_ACCEPT 2
34 #define RADIUS_PKT_TYPE_ACCESS_REJECT 3
35 #define RADIUS_PKT_TYPE_ACCOUNTING_REQUEST 4
36 #define RADIUS_PKT_TYPE_ACCOUNTING_RESPONSE 5
37 #define RADIUS_PKT_TYPE_ACCOUNTING_STATUS 6
38 #define RADIUS_PKT_TYPE_PASSWORD_REQUEST 7
39 #define RADIUS_PKT_TYPE_PASSWORD_ACK 8
40 #define RADIUS_PKT_TYPE_PASSWORD_REJECT 9
41 #define RADIUS_PKT_TYPE_ACCOUNTING_MESSAGE 10
42 #define RADIUS_PKT_TYPE_ACCESS_CHALLENGE 11
43 #define RADIUS_PKT_TYPE_STATUS_SERVER 12
44 #define RADIUS_PKT_TYPE_STATUS_CLIENT 13
46 #define RADIUS_PKT_TYPE_RESOURCE_FREE_REQUEST 21
47 #define RADIUS_PKT_TYPE_RESOURCE_FREE_RESPONSE 22
48 #define RADIUS_PKT_TYPE_RESOURCE_QUERY_REQUEST 23
49 #define RADIUS_PKT_TYPE_RESOURCE_QUERY_RESPONSE 24
50 #define RADIUS_PKT_TYPE_ALTERNATE_RESOURCE_RECLAIM_REQUEST 25
51 #define RADIUS_PKT_TYPE_NAS_REBOOT_REQUEST 26
52 #define RADIUS_PKT_TYPE_NAS_REBOOT_RESPONSE 27
54 #define RADIUS_PKT_TYPE_NEXT_PASSCODE 29
55 #define RADIUS_PKT_TYPE_NEW_PIN 30
56 #define RADIUS_PKT_TYPE_TERMINATE_SESSION 31
57 #define RADIUS_PKT_TYPE_PASSWORD_EXPIRED 32
58 #define RADIUS_PKT_TYPE_EVENT_REQUEST 33
59 #define RADIUS_PKT_TYPE_EVENT_RESPONSE 34
61 #define RADIUS_PKT_TYPE_DISCONNECT_REQUEST 40
62 #define RADIUS_PKT_TYPE_DISCONNECT_ACK 41
63 #define RADIUS_PKT_TYPE_DISCONNECT_NAK 42
64 #define RADIUS_PKT_TYPE_COA_REQUEST 43
65 #define RADIUS_PKT_TYPE_COA_ACK 44
66 #define RADIUS_PKT_TYPE_COA_NAK 45
68 #define RADIUS_PKT_TYPE_IP_ADDRESS_ALLOCATE 50
69 #define RADIUS_PKT_TYPE_IP_ADDRESS_RELEASE 51
71 /* ALU proprietary packet type codes */
72 #define RADIUS_PKT_TYPE_ALU_STATE_REQUEST 129
73 #define RADIUS_PKT_TYPE_ALU_STATE_ACCEPT 130
74 #define RADIUS_PKT_TYPE_ALU_STATE_REJECT 131
75 #define RADIUS_PKT_TYPE_ALU_STATE_ERROR 132
77 /* Radius Attribute Types*/
78 /* 09/12/2011: Updated from IANA:
79 * http://www.iana.org/assignments/radius-types/radius-types.xml#radius-types-1
81 #define RADIUS_ATTR_TYPE_VENDOR_SPECIFIC 26
82 #define RADIUS_ATTR_TYPE_EAP_MESSAGE 79
85 typedef struct _radius_vendor_info_t {
88 GHashTable* attrs_by_id;
93 } radius_vendor_info_t;
95 typedef struct _radius_attr_info_t radius_attr_info_t;
96 typedef void (radius_attr_dissector_t)(radius_attr_info_t*, proto_tree*, packet_info*, tvbuff_t*, int, int, proto_item* );
98 typedef const gchar* (radius_avp_dissector_t)(proto_tree*,tvbuff_t*, packet_info*);
100 struct _radius_attr_info_t {
103 guint encrypt; /* 0 or value for "encrypt=" option */
105 radius_attr_dissector_t* type;
106 radius_avp_dissector_t* dissector;
107 const value_string *vs;
110 int hf_alt; /* 64-bit version for integers, encrypted version for strings, IPv6 for radius_combo_ip */
113 GHashTable* tlvs_by_id;
116 typedef struct _radius_dictionary_t {
117 GHashTable* attrs_by_id;
118 GHashTable* attrs_by_name;
119 GHashTable* vendors_by_id;
120 GHashTable* vendors_by_name;
121 GHashTable* tlvs_by_name;
122 } radius_dictionary_t;
124 radius_attr_dissector_t radius_integer;
125 radius_attr_dissector_t radius_string;
126 radius_attr_dissector_t radius_octets;
127 radius_attr_dissector_t radius_ipaddr;
128 radius_attr_dissector_t radius_ipv6addr;
129 radius_attr_dissector_t radius_ipv6prefix;
130 radius_attr_dissector_t radius_ipxnet;
131 radius_attr_dissector_t radius_date;
132 radius_attr_dissector_t radius_abinary;
133 radius_attr_dissector_t radius_ether;
134 radius_attr_dissector_t radius_ifid;
135 radius_attr_dissector_t radius_byte;
136 radius_attr_dissector_t radius_short;
137 radius_attr_dissector_t radius_signed;
138 radius_attr_dissector_t radius_combo_ip;
139 radius_attr_dissector_t radius_tlv;
141 extern void radius_register_avp_dissector(guint32 vendor_id, guint32 attribute_id, radius_avp_dissector_t dissector);
142 void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, guint length);
144 /* from radius_dict.l */
145 gboolean radius_load_dictionary (radius_dictionary_t* dict, gchar* directory, const gchar* filename, gchar** err_str);
147 /* Item of request list */
148 typedef struct _radius_call_t
153 guint32 req_num; /* frame number request seen */
154 guint32 rsp_num; /* frame number response seen */
160 /* Container for tapping relevant data */
161 typedef struct _radius_info_t
166 gboolean is_duplicate;
167 gboolean request_available;
168 guint32 req_num; /* frame number request seen */