Change the signature of elem_fcn():ns to include pinfo.
[obnox/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         guint type_octets;
62         guint length_octets;
63         gboolean has_flags; 
64 } radius_vendor_info_t;
65
66 typedef struct _radius_attr_info_t radius_attr_info_t;
67 typedef void (radius_attr_dissector_t)(radius_attr_info_t*, proto_tree*, packet_info*, tvbuff_t*, int, int, proto_item* );
68
69 typedef const gchar* (radius_avp_dissector_t)(proto_tree*,tvbuff_t*, packet_info*);
70
71 struct _radius_attr_info_t {
72         const gchar *name;
73         guint code;
74         gboolean encrypt;  /* True if attribute has "encrypt=1" option */
75         gboolean tagged;
76         radius_attr_dissector_t* type;
77         radius_avp_dissector_t* dissector;
78         const value_string *vs;
79         gint ett;
80         int hf;
81         int hf64;
82         int hf_tag;
83         int hf_len;
84         GHashTable* tlvs_by_id;
85 };
86
87 typedef struct _radius_dictionary_t {
88         GHashTable* attrs_by_id;
89         GHashTable* attrs_by_name;
90         GHashTable* vendors_by_id;
91         GHashTable* vendors_by_name;
92         GHashTable* tlvs_by_name;
93 } radius_dictionary_t;
94
95 radius_attr_dissector_t radius_integer;
96 radius_attr_dissector_t radius_string;
97 radius_attr_dissector_t radius_octets;
98 radius_attr_dissector_t radius_ipaddr;
99 radius_attr_dissector_t radius_ipv6addr;
100 radius_attr_dissector_t radius_ipv6prefix;
101 radius_attr_dissector_t radius_ipxnet;
102 radius_attr_dissector_t radius_date;
103 radius_attr_dissector_t radius_abinary;
104 radius_attr_dissector_t radius_ether;
105 radius_attr_dissector_t radius_ifid;
106 radius_attr_dissector_t radius_byte;
107 radius_attr_dissector_t radius_short;
108 radius_attr_dissector_t radius_signed;
109 radius_attr_dissector_t radius_combo_ip;
110 radius_attr_dissector_t radius_tlv;
111
112 extern void radius_register_avp_dissector(guint32 vendor_id, guint32 attribute_id, radius_avp_dissector_t dissector);
113
114 /* from radius_dict.l */
115 gboolean radius_load_dictionary (radius_dictionary_t* dict, gchar* directory, const gchar* filename, gchar** err_str);
116
117 /* Item of request list */
118 typedef struct _radius_call_t
119 {
120         guint code;
121         guint ident;
122
123         guint32 req_num; /* frame number request seen */
124         guint32 rsp_num; /* frame number response seen */
125         guint32 rspcode;
126         nstime_t req_time;
127         gboolean responded;
128 } radius_call_t;
129
130 /* Container for tapping relevant data */
131 typedef struct _radius_info_t
132 {
133         guint code;
134         guint ident;
135         nstime_t req_time;
136         gboolean is_duplicate;
137         gboolean request_available;
138         guint32 req_num; /* frame number request seen */
139         guint32 rspcode;
140 } radius_info_t;
141