http://www.wireshark.org/lists/wireshark-dev/200803/msg00308.html
[metze/wireshark/wip.git] / epan / dissectors / packet-radius.h
1 /*
2  * packet-radius.h
3  *
4  * Definitions for RADIUS packet disassembly
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
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.
15  *
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.
20  *
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #define RADIUS_ACCESS_REQUEST                   1
27 #define RADIUS_ACCESS_ACCEPT                    2
28 #define RADIUS_ACCESS_REJECT                    3
29 #define RADIUS_ACCOUNTING_REQUEST               4
30 #define RADIUS_ACCOUNTING_RESPONSE              5
31 #define RADIUS_ACCOUNTING_STATUS                6
32 #define RADIUS_ACCESS_PASSWORD_REQUEST          7
33 #define RADIUS_ACCESS_PASSWORD_ACK              8
34 #define RADIUS_ACCESS_PASSWORD_REJECT           9
35 #define RADIUS_ACCOUNTING_MESSAGE               10
36 #define RADIUS_ACCESS_CHALLENGE                 11
37 #define RADIUS_STATUS_SERVER                    12
38 #define RADIUS_STATUS_CLIENT                    13
39
40 #define RADIUS_VENDOR_SPECIFIC_CODE             26
41 #define RADIUS_ASCEND_ACCESS_NEXT_CODE          29
42 #define RADIUS_ASCEND_ACCESS_NEW_PIN            30
43 #define RADIUS_ASCEND_PASSWORD_EXPIRED          32
44 #define RADIUS_ASCEND_ACCESS_EVENT_REQUEST      33
45 #define RADIUS_ASCEND_ACCESS_EVENT_RESPONSE     34
46 #define RADIUS_DISCONNECT_REQUEST               40
47 #define RADIUS_DISCONNECT_REQUEST_ACK           41
48 #define RADIUS_DISCONNECT_REQUEST_NAK           42
49 #define RADIUS_CHANGE_FILTER_REQUEST            43
50 #define RADIUS_CHANGE_FILTER_REQUEST_ACK        44
51 #define RADIUS_CHANGE_FILTER_REQUEST_NAK        45
52 #define RADIUS_EAP_MESSAGE_CODE                 79
53 #define RADIUS_MESSAGE_AUTHENTICATOR            80
54 #define RADIUS_RESERVED                         255
55
56 typedef struct _radius_vendor_info_t {
57         const gchar *name;
58         guint code;
59         GHashTable* attrs_by_id;
60     gint ett;
61 } radius_vendor_info_t;
62
63 typedef struct _radius_attr_info_t radius_attr_info_t;
64 typedef void (radius_attr_dissector_t)(radius_attr_info_t*, proto_tree*, packet_info*, tvbuff_t*, int, int, proto_item* );
65
66 typedef const gchar* (radius_avp_dissector_t)(proto_tree*,tvbuff_t*);
67
68 struct _radius_attr_info_t {
69         const gchar *name;
70         guint code;
71         gboolean encrypt;
72         gboolean tagged;
73         radius_attr_dissector_t* type;
74         radius_avp_dissector_t* dissector;
75         const value_string *vs;
76         gint ett;
77         int hf;
78         int hf64;
79         int hf_tag;
80         int hf_len;
81 };
82
83 typedef struct _radius_dictionary_t {
84         GHashTable* attrs_by_id;
85         GHashTable* attrs_by_name;
86         GHashTable* vendors_by_id;
87         GHashTable* vendors_by_name;
88 } radius_dictionary_t;
89
90 radius_attr_dissector_t radius_integer;
91 radius_attr_dissector_t radius_string;
92 radius_attr_dissector_t radius_octets;
93 radius_attr_dissector_t radius_ipaddr;
94 radius_attr_dissector_t radius_ipv6addr;
95 radius_attr_dissector_t radius_ipxnet;
96 radius_attr_dissector_t radius_date;
97 radius_attr_dissector_t radius_abinary;
98 radius_attr_dissector_t radius_ifid;
99
100 extern void radius_register_avp_dissector(guint32 vendor_id, guint32 attribute_id, radius_avp_dissector_t dissector);
101
102 /* from radius_dict.l */
103 gboolean radius_load_dictionary (radius_dictionary_t* dict, gchar* directory, const gchar* filename, gchar** err_str);
104
105 /* Item of request list */
106 typedef struct _radius_call_t
107 {
108         guint code;
109         guint ident;
110
111         guint32 req_num; /* frame number request seen */
112         guint32 rsp_num; /* frame number response seen */
113         guint32 rspcode;
114         nstime_t req_time;
115         gboolean responded;
116 } radius_call_t;
117
118 /* Container for tapping relevant data */
119 typedef struct _radius_info_t
120 {
121         guint code;
122         guint ident;
123         nstime_t req_time;
124         gboolean is_duplicate;
125         gboolean request_available;
126         guint32 req_num; /* frame number request seen */
127         guint32 rspcode;
128 } radius_info_t;
129