Q.933 dissector. (Not complete.)
[metze/wireshark/wip.git] / packet-radius.c
1 /* packet-radius.c
2  *
3  * Routines for RADIUS packet disassembly
4  * Copyright 1999 Johan Feyaerts
5  *
6  * RFC 2865, RFC 2866, RFC 2867, RFC 2868, RFC 2869
7  *
8  * $Id: packet-radius.c,v 1.80 2003/07/15 22:16:51 guy Exp $
9  *
10  * Ethereal - Network traffic analyzer
11  * By Gerald Combs <gerald@ethereal.com>
12  * Copyright 1998 Gerald Combs
13  *
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.
18  *
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.
23  *
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  02111-1307, USA.
27  */
28
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
32
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #include <ctype.h>
37 #include <glib.h>
38 #include <time.h>
39 #include <epan/packet.h>
40 #include <epan/resolv.h>
41
42 #include "packet-q931.h"
43 #include "packet-gtp.h"
44 #include "prefs.h"
45 #include "crypt-md5.h"
46
47 static int proto_radius = -1;
48 static int hf_radius_length = -1;
49 static int hf_radius_code = -1;
50 static int hf_radius_id =-1;
51 static char *shared_secret = NULL;
52 static gpointer authenticator = NULL;
53
54 static gint ett_radius = -1;
55 static gint ett_radius_avp = -1;
56 static gint ett_radius_eap = -1;
57 static gint ett_radius_vsa = -1;
58
59 static dissector_handle_t eap_fragment_handle;
60
61 #define UDP_PORT_RADIUS         1645
62 #define UDP_PORT_RADIUS_NEW     1812
63 #define UDP_PORT_RADACCT        1646
64 #define UDP_PORT_RADACCT_NEW    1813
65
66 #define TEXTBUFFER              2000
67 #define VSABUFFER               10
68
69 typedef struct _e_radiushdr {
70         guint8 rh_code;
71         guint8 rh_ident;
72         guint16 rh_pktlength;
73 } e_radiushdr;
74
75 typedef struct _e_avphdr {
76         guint8 avp_type;
77         guint8 avp_length;
78 } e_avphdr;
79
80 typedef struct _value_value_string {
81         guint16 val1;
82         guint16 val2;
83         gchar *str;
84 } value_value_string;
85
86 typedef struct _rd_vsa_table {
87         guint32 vendor;
88         value_value_string *attrib;
89 } rd_vsa_table;
90
91 typedef struct _rd_valstr_table {
92         int print_type;
93         const value_string *valstr;
94 } rd_valstr_table;
95
96 typedef struct _rd_vsa_buffer {
97         gchar *str;
98         int offset;
99         guint8 length;
100 } rd_vsa_buffer;
101
102 #define AUTHENTICATOR_LENGTH    16
103 #define RD_HDR_LENGTH           4
104
105 #define RADIUS_ACCESS_REQUEST                   1
106 #define RADIUS_ACCESS_ACCEPT                    2
107 #define RADIUS_ACCESS_REJECT                    3
108 #define RADIUS_ACCOUNTING_REQUEST               4
109 #define RADIUS_ACCOUNTING_RESPONSE              5
110 #define RADIUS_ACCOUNTING_STATUS                6
111 #define RADIUS_ACCESS_PASSWORD_REQUEST          7
112 #define RADIUS_ACCESS_PASSWORD_ACK              8
113 #define RADIUS_ACCESS_PASSWORD_REJECT           9
114 #define RADIUS_ACCOUNTING_MESSAGE               10
115 #define RADIUS_ACCESS_CHALLENGE                 11
116 #define RADIUS_STATUS_SERVER                    12
117 #define RADIUS_STATUS_CLIENT                    13
118
119 #define RADIUS_VENDOR_SPECIFIC_CODE             26
120 #define RADIUS_ASCEND_ACCESS_NEXT_CODE          29
121 #define RADIUS_ASCEND_ACCESS_NEW_PIN            30
122 #define RADIUS_ASCEND_PASSWORD_EXPIRED          32
123 #define RADIUS_ASCEND_ACCESS_EVENT_REQUEST      33
124 #define RADIUS_ASCEND_ACCESS_EVENT_RESPONSE     34
125 #define RADIUS_DISCONNECT_REQUEST               40
126 #define RADIUS_DISCONNECT_REQUEST_ACK           41
127 #define RADIUS_DISCONNECT_REQUEST_NAK           42
128 #define RADIUS_CHANGE_FILTER_REQUEST            43
129 #define RADIUS_CHANGE_FILTER_REQUEST_ACK        44
130 #define RADIUS_CHANGE_FILTER_REQUEST_NAK        45
131 #define RADIUS_RESERVED                         255
132
133 enum {
134     RADIUS_STRING = 1,
135     RADIUS_BINSTRING,
136     RADIUS_INTEGER4,
137     RADIUS_IP_ADDRESS,
138     RADIUS_SERVICE_TYPE,
139     RADIUS_FRAMED_PROTOCOL,
140     RADIUS_FRAMED_ROUTING,
141     RADIUS_FRAMED_COMPRESSION,
142     RADIUS_LOGIN_SERVICE,
143     RADIUS_UNKNOWN,
144     RADIUS_IPX_ADDRESS,
145     RADIUS_TERMINATING_ACTION,
146     RADIUS_ACCOUNTING_STATUS_TYPE,
147     RADIUS_ACCT_AUTHENTIC,
148     RADIUS_ACCT_TERMINATE_CAUSE,
149     RADIUS_NAS_PORT_TYPE,
150     RADIUS_TUNNEL_TYPE,
151     RADIUS_TUNNEL_MEDIUM_TYPE,
152     RADIUS_STRING_TAGGED,
153     RADIUS_VENDOR_SPECIFIC,
154     RADIUS_TIMESTAMP,
155     RADIUS_INTEGER4_TAGGED,
156
157     ACC_REASON_CODE,
158     ACC_CCP_OPTION,
159     ACC_ROUTE_POLICY,
160     ACC_ML_MLX_ADMIN_STATE,
161     ACC_CLEARING_CAUSE,
162     ACC_CLEARING_LOCATION,
163     ACC_REQUEST_TYPE,
164     ACC_BRIDGING_SUPPORT,
165     ACC_APSM_OVERSUBSCRIBED,
166     ACC_ACCT_ON_OFF_REASON,
167     ACC_IP_COMPRESSION,
168     ACC_IPX_COMPRESSION,
169     ACC_CALLBACK_MODE,
170     ACC_CALLBACK_CBCP_TYPE,
171     ACC_DIALOUT_AUTH_MODE,
172     ACC_ACCESS_COMMUNITY,
173
174     CISCO_DISCONNECT_CAUSE,
175
176     SHIVA_TYPE_OF_SERVICE,
177     SHIVA_LINK_PROTOCOL,
178     SHIVA_DISCONNECT_REASON,
179     SHIVA_FUNCTION,
180     SHIVA_CONNECT_REASON,
181
182     LIVINGSTON_IPSEC_LOG_OPTIONS,
183     LIVINGSTON_IPSEC_DENY_ACTION,
184     LIVINGSTON_NAT_LOG_OPTIONS,
185     LIVINGSTON_NAT_SESS_DIR_FAIL_ACTION,
186     LIVINGSTON_MULTICAST_CLIENT,
187
188     MICROSOFT_BAP_USAGE,
189     MICROSOFT_ARAP_PW_CHANGE_REASON,
190     MICROSOFT_ACCT_AUTH_TYPE,
191     MICROSOFT_ACCT_EAP_TYPE,
192
193     ASCEND_CALLING_ID_TYPE_OF_NUMBER,
194     ASCEND_CALLING_ID_NUMBERING_PLAN,
195     ASCEND_CALLING_ID_PRESENTATION,
196     ASCEND_CALLING_ID_SCREENING,
197
198     BAY_TUNNEL_AUTHEN_TYPE,
199     BAY_TUNNEL_AUTHEN_MODE,
200     BAY_USER_SERVER_LOCATION,
201     BAY_SYSTEM_DISC_REASON,
202     BAY_MODEM_DISC_REASON,
203     BAY_ADDR_RESOLUTION_PROTOCOL,
204     BAY_USER_LEVEL,
205     BAY_AUDIT_LEVEL,
206
207     VERSANET_TERMINATION_CAUSE,
208
209     REDBACK_TUNNEL_FUNCTION,
210     REDBACK_MCAST_SEND,
211     REDBACK_MCAST_RECEIVE,
212     REDBACK_TUNNEL_DNIS,
213     REDBACK_PVC_ENCAPSULATION_TYPE,
214     REDBACK_PVC_CIRCUIT_PADDING,
215     REDBACK_BIND_TYPE,
216     REDBACK_BIND_AUTH_PROTOCOL,
217     REDBACK_LAC_PORT_TYPE,
218     REDBACK_LAC_REAL_PORT_TYPE,
219
220     COSINE_VPI_VCI,
221
222     SHASTA_USER_PRIVILEGE,
223
224     COLUMBIA_UNIVERSITY_SIP_METHOD,
225
226     THE3GPP_QOS
227 };
228
229 static value_string radius_vals[] =
230 {
231   {RADIUS_ACCESS_REQUEST,               "Access Request"},
232   {RADIUS_ACCESS_ACCEPT,                "Access Accept"},
233   {RADIUS_ACCESS_REJECT,                "Access Reject"},
234   {RADIUS_ACCOUNTING_REQUEST,           "Accounting Request"},
235   {RADIUS_ACCOUNTING_RESPONSE,          "Accounting Response"},
236   {RADIUS_ACCOUNTING_STATUS,            "Accounting Status"},
237   {RADIUS_ACCESS_PASSWORD_REQUEST,      "Access Password Request"},
238   {RADIUS_ACCESS_PASSWORD_ACK,          "Access Password Ack"},
239   {RADIUS_ACCESS_PASSWORD_REJECT,       "Access Password Reject"},
240   {RADIUS_ACCOUNTING_MESSAGE,           "Accounting Message"},
241   {RADIUS_ACCESS_CHALLENGE,             "Access challenge"},
242   {RADIUS_STATUS_SERVER,                "StatusServer"},
243   {RADIUS_STATUS_CLIENT,                "StatusClient"},
244   {RADIUS_VENDOR_SPECIFIC_CODE,         "Vendor Specific"},
245   {RADIUS_ASCEND_ACCESS_NEXT_CODE,      "Ascend Access Next Code"},
246   {RADIUS_ASCEND_ACCESS_NEW_PIN,        "Ascend Access New Pin"},
247   {RADIUS_ASCEND_PASSWORD_EXPIRED,      "Ascend Password Expired"},
248   {RADIUS_ASCEND_ACCESS_EVENT_REQUEST,  "Ascend Access Event Request"},
249   {RADIUS_ASCEND_ACCESS_EVENT_RESPONSE, "Ascend Access Event Response"},
250   {RADIUS_DISCONNECT_REQUEST,           "Disconnect Request"},
251   {RADIUS_DISCONNECT_REQUEST_ACK,       "Disconnect Request ACK"},
252   {RADIUS_DISCONNECT_REQUEST_NAK,       "Disconnect Request NAK"},
253   {RADIUS_CHANGE_FILTER_REQUEST,        "Change Filter Request"},
254   {RADIUS_CHANGE_FILTER_REQUEST_ACK,    "Change Filter Request ACK"},
255   {RADIUS_CHANGE_FILTER_REQUEST_NAK,    "Change Filter Request NAK"},
256   {RADIUS_RESERVED,                     "Reserved"},
257   {0, NULL}
258 };
259
260 /*
261  * These are SMI Network Management Private Enterprise Codes for
262  * organizations; see
263  *
264  *      http://www.isi.edu/in-notes/iana/assignments/enterprise-numbers
265  *
266  * for a list.
267  *
268  * XXX - these also appear in FreeRadius dictionary files, with items such
269  * as
270  *
271  *      VENDOR          Cisco           9
272  */
273 #define VENDOR_ACC                      5
274 #define VENDOR_CISCO                    9
275 #define VENDOR_SHIVA                    166
276 #define VENDOR_LIVINGSTON               307
277 #define VENDOR_MICROSOFT                311
278 #define VENDOR_3COM                     429
279 #define VENDOR_ASCEND                   529
280 #define VENDOR_BAY                      1584
281 #define VENDOR_FOUNDRY                  1991
282 #define VENDOR_VERSANET                 2180
283 #define VENDOR_REDBACK                  2352
284 #define VENDOR_JUNIPER                  2636
285 #define VENDOR_APTIS                    2637
286 #define VENDOR_COSINE                   3085
287 #define VENDOR_SHASTA                   3199
288 #define VENDOR_NOMADIX                  3309
289 #define VENDOR_UNISPHERE                4874
290 #define VENDOR_ISSANNI                  5948
291 #define VENDOR_QUINTUM                  6618
292 #define VENDOR_COLUBRIS                 8744
293 #define VENDOR_COLUMBIA_UNIVERSITY      11862
294 #define VENDOR_THE3GPP                  10415
295
296 static value_string radius_vendor_specific_vendors[] =
297 {
298   {VENDOR_ACC,                  "ACC"},
299   {VENDOR_CISCO,                "Cisco"},
300   {VENDOR_SHIVA,                "Shiva"},
301   {VENDOR_MICROSOFT,            "Microsoft"},
302   {VENDOR_LIVINGSTON,           "Livingston"},
303   {VENDOR_3COM,                 "3Com"},
304   {VENDOR_ASCEND,               "Ascend"},
305   {VENDOR_BAY,                  "Bay Networks"},
306   {VENDOR_FOUNDRY,              "Foundry"},
307   {VENDOR_VERSANET,             "Versanet"},
308   {VENDOR_REDBACK,              "Redback"},
309   {VENDOR_JUNIPER,              "Juniper Networks"},
310   {VENDOR_APTIS,                "Aptis"},
311   {VENDOR_COSINE,               "CoSine Communications"},
312   {VENDOR_SHASTA,               "Shasta"},
313   {VENDOR_NOMADIX,              "Nomadix"},
314   {VENDOR_UNISPHERE,            "Unisphere Networks"},
315   {VENDOR_ISSANNI,              "Issanni Communications"},
316   {VENDOR_QUINTUM,              "Quintum"},
317   {VENDOR_COLUBRIS,             "Colubris"},
318   {VENDOR_COLUMBIA_UNIVERSITY,  "Columbia University"},
319   {VENDOR_THE3GPP,              "3GPP"},
320   {0, NULL}
321 };
322
323 /*
324  * XXX - should we construct this table in Ethereal at start-up time by
325  * reading files such as FreeRadius dictionary files?  For example,
326  * the FreeRadius "dictionary" file has
327  *
328  *      ATTRIBUTE       User-Name               1       string
329  *
330  * for the attribute that's
331  *
332  *      {1,     RADIUS_STRING,                  "User Name"},
333  *
334  * In our tables:
335  *
336  *      "string" -> RADIUS_STRING
337  *      "octets" -> RADIUS_BINSTRING
338  *      "integer" -> RADIUS_INTEGER4
339  *      "ipaddr" -> RADIUS_IP_ADDRESS
340  */
341 static value_value_string radius_attrib[] =
342 {
343   {1,   RADIUS_STRING,                  "User Name"},
344   {2,   RADIUS_STRING,                  "User Password"},
345   {3,   RADIUS_BINSTRING,               "CHAP Password"},
346   {4,   RADIUS_IP_ADDRESS,              "NAS IP Address"},
347   {5,   RADIUS_INTEGER4,                "NAS Port"},
348   {6,   RADIUS_SERVICE_TYPE,            "Service Type"},
349   {7,   RADIUS_FRAMED_PROTOCOL,         "Framed Protocol"},
350   {8,   RADIUS_IP_ADDRESS,              "Framed IP Address"},
351   {9,   RADIUS_IP_ADDRESS,              "Framed IP Netmask"},
352   {10,  RADIUS_FRAMED_ROUTING,          "Framed Routing"},
353   {11,  RADIUS_STRING,                  "Filter Id"},
354   {12,  RADIUS_INTEGER4,                "Framed MTU"},
355   {13,  RADIUS_FRAMED_COMPRESSION,      "Framed Compression"},
356   {14,  RADIUS_IP_ADDRESS,              "Login IP Host"},
357   {15,  RADIUS_LOGIN_SERVICE,           "Login Service"},
358   {16,  RADIUS_INTEGER4,                "Login TCP Port"},
359   {17,  RADIUS_UNKNOWN,                 "Unassigned"},
360   {18,  RADIUS_STRING,                  "Reply Message"},
361   {19,  RADIUS_STRING,                  "Callback Number"},
362   {20,  RADIUS_STRING,                  "Callback Id"},
363   {21,  RADIUS_UNKNOWN,                 "Unassigned"},
364   {22,  RADIUS_STRING,                  "Framed Route"},
365   {23,  RADIUS_IPX_ADDRESS,             "Framed IPX network"},
366   {24,  RADIUS_BINSTRING,               "State"},
367   {25,  RADIUS_BINSTRING,               "Class"},
368   {26,  RADIUS_VENDOR_SPECIFIC,         "Vendor Specific"},
369   {27,  RADIUS_INTEGER4,                "Session Timeout"},
370   {28,  RADIUS_INTEGER4,                "Idle Timeout"},
371   {29,  RADIUS_TERMINATING_ACTION,      "Terminating Action"},
372   {30,  RADIUS_STRING,                  "Called Station Id"},
373   {31,  RADIUS_STRING,                  "Calling Station Id"},
374   {32,  RADIUS_STRING,                  "NAS identifier"},
375   {33,  RADIUS_BINSTRING,               "Proxy State"},
376   {34,  RADIUS_STRING,                  "Login LAT Service"},
377   {35,  RADIUS_STRING,                  "Login LAT Node"},
378   {36,  RADIUS_BINSTRING,               "Login LAT Group"},
379   {37,  RADIUS_INTEGER4,                "Framed AppleTalk Link"},
380   {38,  RADIUS_INTEGER4,                "Framed AppleTalk Network"},
381   {39,  RADIUS_STRING,                  "Framed AppleTalk Zone"},
382   {40,  RADIUS_ACCOUNTING_STATUS_TYPE,  "Acct Status Type"},
383   {41,  RADIUS_INTEGER4,                "Acct Delay Time"},
384   {42,  RADIUS_INTEGER4,                "Acct Input Octets"},
385   {43,  RADIUS_INTEGER4,                "Acct Output Octets"},
386   {44,  RADIUS_STRING,                  "Acct Session Id"},
387   {45,  RADIUS_ACCT_AUTHENTIC,          "Acct Authentic"},
388   {46,  RADIUS_INTEGER4,                "Acct Session Time"},
389   {47,  RADIUS_INTEGER4,                "Acct Input Packets"},
390   {48,  RADIUS_INTEGER4,                "Acct Output Packets"},
391   {49,  RADIUS_ACCT_TERMINATE_CAUSE,    "Acct Terminate Cause"},
392   {50,  RADIUS_STRING,                  "Acct Multi Session Id"},
393   {51,  RADIUS_INTEGER4,                "Acct Link Count"},
394   {52,  RADIUS_INTEGER4,                "Acct Input Gigawords"},
395   {53,  RADIUS_INTEGER4,                "Acct Output Gigawords"},
396   /* 54 Unused */
397   {55,  RADIUS_TIMESTAMP,               "Event Timestamp"},
398   /* 56-59 Unused */
399   {60,  RADIUS_BINSTRING,               "CHAP Challenge"},
400   {61,  RADIUS_NAS_PORT_TYPE,           "NAS Port Type"},
401   {62,  RADIUS_INTEGER4,                "Port Limit"},
402   {63,  RADIUS_BINSTRING,               "Login LAT Port"},
403   {64,  RADIUS_TUNNEL_TYPE,             "Tunnel Type"},
404   {65,  RADIUS_TUNNEL_MEDIUM_TYPE,      "Tunnel Medium Type"},
405   {66,  RADIUS_STRING_TAGGED,           "Tunnel Client Endpoint"},
406   {67,  RADIUS_STRING_TAGGED,           "Tunnel Server Endpoint"},
407   {68,  RADIUS_STRING,                  "Tunnel Connection"},
408   {69,  RADIUS_STRING_TAGGED,           "Tunnel Password"},
409   {70,  RADIUS_STRING,                  "ARAP Password"},
410   {71,  RADIUS_STRING,                  "ARAP Features"},
411   {72,  RADIUS_INTEGER4,                "ARAP Zone-Access"},
412   {73,  RADIUS_INTEGER4,                "ARAP Security"},
413   {74,  RADIUS_STRING,                  "ARAP Security Data"},
414   {75,  RADIUS_INTEGER4,                "Password Retry"},
415   {76,  RADIUS_INTEGER4,                "Prompt"},
416   {77,  RADIUS_STRING,                  "Connect Info"},
417   {78,  RADIUS_STRING,                  "Configuration Token"},
418   {79,  RADIUS_STRING,                  "EAP Message"},
419   {80,  RADIUS_BINSTRING,               "Message Authenticator"},
420   {81,  RADIUS_STRING_TAGGED,           "Tunnel Private Group ID"},
421   {82,  RADIUS_STRING_TAGGED,           "Tunnel Assignment ID"},
422   {83,  RADIUS_INTEGER4_TAGGED,         "Tunnel Preference"},
423   {84,  RADIUS_STRING,                  "ARAP Challenge Response"},
424   {85,  RADIUS_INTEGER4,                "Acct Interim Interval"},
425   {86,  RADIUS_INTEGER4,                "Tunnel Packets Lost"},
426   {87,  RADIUS_STRING,                  "NAS Port ID"},
427   {88,  RADIUS_STRING,                  "Framed Pool"},
428   {90,  RADIUS_STRING_TAGGED,           "Tunnel Client Auth ID"},
429   {91,  RADIUS_STRING_TAGGED,           "Tunnel Server Auth ID"},
430   {120, RADIUS_INTEGER4,                "Ascend Modem Port No"},
431   {121, RADIUS_INTEGER4,                "Ascend Modem Slot No"},
432   {187, RADIUS_INTEGER4,                "Ascend Multilink ID"},
433   {188, RADIUS_INTEGER4,                "Ascend Num In Multilink"},
434   {189, RADIUS_IP_ADDRESS,              "Ascend First Dest"},
435   {190, RADIUS_INTEGER4,                "Ascend Pre Input Octets"},
436   {191, RADIUS_INTEGER4,                "Ascend Pre Output Octets"},
437   {192, RADIUS_INTEGER4,                "Ascend Pre Input Packets"},
438   {193, RADIUS_INTEGER4,                "Ascend Pre Output Packets"},
439   {194, RADIUS_INTEGER4,                "Ascend Maximum Time"},
440   {195, RADIUS_INTEGER4,                "Ascend Disconnect Cause"},
441   {196, RADIUS_INTEGER4,                "Ascend Connect Progress"},
442   {197, RADIUS_INTEGER4,                "Ascend Data Rate"},
443   {198, RADIUS_INTEGER4,                "Ascend PreSession Time"},
444   {218, RADIUS_INTEGER4,                "Ascend Assign IP Pool"},
445   {255, RADIUS_INTEGER4,                "Ascend Xmit Rate"},
446   {0, 0, NULL}
447 };
448
449 static value_string radius_service_type_vals[] =
450 {
451   {1,   "Login"},
452   {2,   "Framed"},
453   {3,   "Callback Login"},
454   {4,   "Callback Framed"},
455   {5,   "Outbound"},
456   {6,   "Administrative"},
457   {7,   "NAS Prompt"},
458   {8,   "Authenticate Only"},
459   {9,   "Callback NAS Prompt"},
460   {10,  "Call Check"},
461   {0, NULL}
462 };
463
464 static value_string radius_framed_protocol_vals[] =
465 {
466   {1,   "PPP"},
467   {2,   "SLIP"},
468   {3,   "Appletalk Remote Access Protocol (ARAP)"},
469   {4,   "Gandalf proprietary Singlelink/Multilink Protocol"},
470   {5,   "Xylogics proprietary IPX/SLIP"},
471   {6,   "X.75 Synchronous"},
472   {255, "Ascend ARA"},
473   {256, "Ascend MPP"},
474   {257, "Ascend EURAW"},
475   {258, "Ascend EUUI"},
476   {259, "Ascend X25"},
477   {260, "Ascend COMB"},
478   {261, "Ascend FR"},
479   {262, "Ascend MP"},
480   {263, "Ascend FR-CIR"},
481   {264, "Ascend ATM-1483"},
482   {265, "Ascend ATM-FR-CIR"},
483   {0, NULL}
484 };
485
486 static value_string radius_framed_routing_vals[] =
487 {
488   {1,   "Send Routing Packets"},
489   {2,   "Listen for routing packets"},
490   {3,   "Send and Listen"},
491   {0,   "None"},
492   {0, NULL}
493 };
494
495 static value_string radius_framed_compression_vals[] =
496 {
497   {1,   "VJ TCP/IP Header Compression"},
498   {2,   "IPX Header Compression"},
499   {3,   "Stac-LZS compression"},
500   {0,   "None"},
501   {0, NULL}
502 };
503
504 static value_string radius_login_service_vals[] =
505 {
506   {1,   "Rlogin"},
507   {2,   "TCP Clear"},
508   {3,   "Portmaster"},
509   {4,   "LAT"},
510   {5,   "X.25 PAD"},
511   {6,   "X.25 T3POS"},
512   {8,   "TCP Clear Quit"},
513   {0,   "Telnet"},
514   {0, NULL}
515 };
516
517 static value_string radius_terminating_action_vals[] =
518 {
519   {1,   "RADIUS Request"},
520   {0,   "Default"},
521   {0, NULL}
522 };
523
524 static value_string radius_accounting_status_type_vals[] =
525 {
526   {1,   "Start"},
527   {2,   "Stop"},
528   {3,   "Interim Update"},
529   {7,   "Accounting On"},
530   {8,   "Accounting Off"},
531   {9,   "Tunnel Start"},        /* Tunnel accounting */
532   {10,  "Tunnel Stop"},         /* Tunnel accounting */
533   {11,  "Tunnel Reject"},       /* Tunnel accounting */
534   {12,  "Tunnel Link Start"},   /* Tunnel accounting */
535   {13,  "Tunnel Link Stop"},    /* Tunnel accounting */
536   {14,  "Tunnel Link Reject"},  /* Tunnel accounting */
537   {0, NULL}
538 };
539
540 static value_string radius_accounting_authentication_vals[] =
541 {
542   {1,   "Radius"},
543   {2,   "Local"},
544   {3,   "Remote"},
545   /* RFC 2866 says 3 is Remote. Is 7 a mistake? */
546   {7,   "Remote"},
547   {0, NULL}
548 };
549
550 static value_string radius_acct_terminate_cause_vals[] =
551 {
552   {1,   "User Request"},
553   {2,   "Lost Carrier"},
554   {3,   "Lost Service"},
555   {4,   "Idle Timeout"},
556   {5,   "Session Timeout"},
557   {6,   "Admin Reset"},
558   {7,   "Admin Reboot"},
559   {8,   "Port Error"},
560   {9,   "NAS Error"},
561   {10,  "NAS Request"},
562   {11,  "NAS Reboot"},
563   {12,  "Port Unneeded"},
564   {13,  "Port Preempted"},
565   {14,  "Port Suspended"},
566   {15,  "Service Unavailable"},
567   {16,  "Callback"},
568   {17,  "User Error"},
569   {18,  "Host Request"},
570   {0, NULL}
571 };
572
573 static value_string radius_tunnel_type_vals[] =
574 {
575   {1,   "PPTP"},
576   {2,   "L2F"},
577   {3,   "L2TP"},
578   {4,   "ATMP"},
579   {5,   "VTP"},
580   {6,   "AH"},
581   {7,   "IP-IP-Encap"},
582   {8,   "MIN-IP-IP"},
583   {9,   "ESP"},
584   {10,  "GRE"},
585   {11,  "DVS"},
586   {12,  "IP-IP"},
587   {0, NULL}
588 };
589
590 static value_string radius_tunnel_medium_type_vals[] =
591 {
592   {1,   "IPv4"},
593   {2,   "IPv6"},
594   {3,   "NSAP"},
595   {4,   "HDLC"},
596   {5,   "BBN"},
597   {6,   "IEEE 802"},
598   {7,   "E.163"},
599   {8,   "E.164"},
600   {9,   "F.69"},
601   {10,  "X.121"},
602   {11,  "IPX"},
603   {12,  "Appletalk"},
604   {13,  "Decnet4"},
605   {14,  "Vines"},
606   {15,  "E.164 NSAP"},
607   {0, NULL}
608 };
609
610 static value_string radius_nas_port_type_vals[] =
611 {
612   {0,   "Async"},
613   {1,   "Sync"},
614   {2,   "ISDN Sync"},
615   {3,   "ISDN Async V.120"},
616   {4,   "ISDN Async V.110"},
617   {5,   "Virtual"},
618   {6,   "PIAFS"},
619   {7,   "HDLC Clear Channel"},
620   {8,   "X.25"},
621   {9,   "X.75"},
622   {10,  "G.3 Fax"},
623   {11,  "SDSL"},
624   {12,  "ADSL CAP"},
625   {13,  "ADSL DMT"},
626   {14,  "IDSL ISDN"},
627   {15,  "Ethernet"},
628   {16,  "xDSL"},
629   {17,  "Cable"},
630   {18,  "Wireless Other"},
631   {19,  "Wireless IEEE 802.11"},
632   {0, NULL}
633 };
634
635 /*
636 reference:
637         'dictionary.acc' file from FreeRADIUS
638                 http://www.freeradius.org/radiusd/raddb/dictionary.acc
639 */
640 static value_value_string radius_vendor_acc_attrib[] =
641 {
642   {1,   ACC_REASON_CODE,        "Acc Reason Code"},
643   {2,   ACC_CCP_OPTION,         "Acc Ccp Option"},
644   {3,   RADIUS_INTEGER4,        "Acc Input Errors"},
645   {4,   RADIUS_INTEGER4,        "Acc Output Errors"},
646   {5,   RADIUS_STRING,          "Acc Access Partition"},
647   {6,   RADIUS_STRING,          "Acc Customer Id"},
648   {7,   RADIUS_IP_ADDRESS,      "Acc Ip Gateway Pri"},
649   {8,   RADIUS_IP_ADDRESS,      "Acc Ip Gateway Sec"},
650   {9,   ACC_ROUTE_POLICY,       "Acc Route Policy"},
651   {10,  ACC_ML_MLX_ADMIN_STATE, "Acc ML MLX Admin State"},
652   {11,  RADIUS_INTEGER4,        "Acc ML Call Threshold"},
653   {12,  RADIUS_INTEGER4,        "Acc ML Clear Threshold"},
654   {13,  RADIUS_INTEGER4,        "Acc ML Damping Factor"},
655   {14,  RADIUS_STRING,          "Acc Tunnel Secret"},
656   {15,  ACC_CLEARING_CAUSE,     "Acc Clearing Cause"},
657   {16,  ACC_CLEARING_LOCATION,  "Acc Clearing Location"},
658   {17,  RADIUS_STRING,          "Acc Service Profile"},
659   {18,  ACC_REQUEST_TYPE,       "Acc Request Type"},
660   {19,  ACC_BRIDGING_SUPPORT,   "Acc Bridging Support"},
661   {20,  ACC_APSM_OVERSUBSCRIBED,"Acc Apsm Oversubscribed"},
662   {21,  ACC_ACCT_ON_OFF_REASON, "Acc Acct On Off Reason"},
663   {22,  RADIUS_INTEGER4,        "Acc Tunnel Port"},
664   {23,  RADIUS_IP_ADDRESS,      "Acc Dns Server Pri"},
665   {24,  RADIUS_IP_ADDRESS,      "Acc Dns Server Sec"},
666   {25,  RADIUS_IP_ADDRESS,      "Acc Nbns Server Pri"},
667   {26,  RADIUS_IP_ADDRESS,      "Acc Nbns Server Sec"},
668   {27,  RADIUS_INTEGER4,        "Acc Dial Port Index"},
669   {28,  ACC_IP_COMPRESSION,     "Acc Ip Compression"},
670   {29,  ACC_IPX_COMPRESSION,    "Acc Ipx Compression"},
671   {30,  RADIUS_INTEGER4,        "Acc Connect Tx Speed"},
672   {31,  RADIUS_INTEGER4,        "Acc Connect Rx Speed"},
673   {32,  RADIUS_STRING,          "Acc Modem Modulation Type"},
674   {33,  RADIUS_STRING,          "Acc Modem Error Protocol"},
675   {34,  RADIUS_INTEGER4,        "Acc Callback Delay"},
676   {35,  RADIUS_STRING,          "Acc Callback Num Valid"},
677   {36,  ACC_CALLBACK_MODE,      "Acc Callback Mode"},
678   {37,  ACC_CALLBACK_CBCP_TYPE, "Acc Callback CBCP Type"},
679   {38,  ACC_DIALOUT_AUTH_MODE,  "Acc Dialout Auth Mode"},
680   {39,  RADIUS_STRING,          "Acc Dialout Auth Password"},
681   {40,  RADIUS_STRING,          "Acc Dialout Auth Username"},
682   {42,  ACC_ACCESS_COMMUNITY,   "Acc Access Community"},
683   {0, 0, NULL},
684 };
685
686 static value_string radius_vendor_acc_reason_code_vals[] =
687 {
688   {0,   "No reason No Failure"},
689   {1,   "Resource shortage"},
690   {2,   "Session already open"},
691   {3,   "Too many RADIUS users"},
692   {4,   "No authentification server"},
693   {5,   "No authentification response"},
694   {6,   "No accounting server"},
695   {7,   "No accounting response"},
696   {8,   "Access Denied"},
697   {9,   "Temporary buffer shortage"},
698   {10,  "Protocol error"},
699   {11,  "Invalid attribute"},
700   {12,  "Invalid service type"},
701   {13,  "Invalid framed protocol"},
702   {14,  "Invalid attribute value"},
703   {15,  "Invalid user information"},
704   {16,  "Invalid IP address"},
705   {17,  "Invalid integer syntax"},
706   {18,  "Invalid NAS port"},
707   {19,  "Requested by user"},
708   {20,  "Network disconnect"},
709   {21,  "Service interruption"},
710   {22,  "Physical port error"},
711   {23,  "Idle timeout"},
712   {24,  "Session timeout"},
713   {25,  "Administrative reset"},
714   {26,  "NAS reload or reset"},
715   {27,  "NAS error"},
716   {28,  "NAS request"},
717   {29,  "Undefined reason given"},
718   {30,  "Conflicting attributes"},
719   {31,  "Port limit exceeded"},
720   {32,  "Facility not available"},
721   {33,  "Internal config error"},
722   {34,  "Bad route specification"},
723   {35,  "Access Partition bind failure"},
724   {36,  "Security violation"},
725   {37,  "Request type conflict"},
726   {38,  "Configuration disallowed"},
727   {39,  "Missing attribute"},
728   {40,  "Invalid request"},
729   {41,  "Missing parameter"},
730   {42,  "Invalid parameter"},
731   {43,  "Call cleared with cause"},
732   {44,  "Inopportune config request"},
733   {45,  "Invalid config parameter"},
734   {46,  "Missing config parameter"},
735   {47,  "Incompatible service profile"},
736   {48,  "Administrative reset"},
737   {49,  "Administrative reload"},
738   {50,  "Port unneeded"},
739   {51,  "Port preempted"},
740   {52,  "Port suspended"},
741   {53,  "Service unavailable"},
742   {54,  "Callback"},
743   {55,  "User error"},
744   {56,  "Host request"},
745   {0, NULL}
746 };
747
748 static value_string radius_vendor_acc_ccp_option_vals[] =
749 {
750   {1,   "Disabled"},
751   {2,   "Enabled"},
752   {0, NULL}
753 };
754
755 static value_string radius_vendor_acc_route_policy_vals[] =
756 {
757   {1,   "Funnel"},
758   {2,   "Direct"},
759   {0, NULL}
760 };
761
762 static value_string radius_vendor_acc_ml_mlx_admin_state_vals[] =
763 {
764   {1,   "Enabled"},
765   {2,   "Disabled"},
766   {0, NULL}
767 };
768
769 static value_string radius_vendor_acc_request_type_vals[] =
770 {
771   {1,   "Ring Indication"},
772   {2,   "Dial Request"},
773   {3,   "User Authentification"},
774   {4,   "Tunnel Authentification"},
775   {0, NULL}
776 };
777
778 static value_string radius_vendor_acc_bridging_support_vals[] =
779 {
780   {1,   "Disabled"},
781   {2,   "Enabled"},
782   {0, NULL}
783 };
784
785 static value_string radius_vendor_acc_apsm_oversubscribed_vals[] =
786 {
787   {1,   "False"},
788   {2,   "True"},
789   {0, NULL}
790 };
791
792 static value_string radius_vendor_acc_acct_on_off_reason_vals[] =
793 {
794   {0,   "NAS Reset"},
795   {1,   "NAS Reload"},
796   {2,   "Configuration Reset"},
797   {3,   "Configuration Reload"},
798   {4,   "Enabled"},
799   {5,   "Disabled"},
800   {0, NULL}
801 };
802
803 static value_string radius_vendor_acc_ip_compression_vals[] =
804 {
805   {1,   "Disabled"},
806   {2,   "Enabled"},
807   {0, NULL}
808 };
809
810 static value_string radius_vendor_acc_ipx_compression_vals[] =
811 {
812   {1,   "Disabled"},
813   {2,   "Enabled"},
814   {0, NULL}
815 };
816
817 static value_string radius_vendor_acc_callback_mode_vals[] =
818 {
819   {0,   "User Auth"},
820   {3,   "User Specified E.164"},
821   {6,   "CBCP Callback"},
822   {7,   "CLI Callback"},
823   {0, NULL}
824 };
825
826 static value_string radius_vendor_acc_callback_cbcp_type_vals[] =
827 {
828   {1,   "CBCP None"},
829   {2,   "CBCP User Specified"},
830   {3,   "CBCP Pre Specified"},
831   {0, NULL}
832 };
833
834 static value_string radius_vendor_acc_dialout_auth_mode_vals[] =
835 {
836   {1,   "PAP"},
837   {2,   "CHAP"},
838   {3,   "CHAP PAP"},
839   {4,   "NONE"},
840   {0, NULL}
841 };
842
843 static value_string radius_vendor_acc_access_community_vals[] =
844 {
845   {1,   "PUBLIC"},
846   {2,   "NETMAN"},
847   {0, NULL}
848 };
849
850 /*
851 references:
852         'dictionary.cisco' file from FreeRADIUS
853                 http://www.freeradius.org/radiusd/raddb/dictionary.cisco
854
855         http://www.cisco.com/univercd/cc/td/doc/product/access/acs_serv/vapp_dev/vsaig3.htm
856
857         http://www.cisco.com/univercd/cc/td/doc/product/software/ios122/122cgcr/fsecur_c/fappendx/fradattr/scfrdat3.pdf
858         http://www.missl.cs.umd.edu/wireless/ethereal/cisco-vsa.pdf
859
860 */
861 static value_value_string radius_vendor_cisco_attrib[] =
862 {
863   /* stanard attributes */
864   {1,   RADIUS_STRING,          "Cisco AV Pair"},
865   {2,   RADIUS_STRING,          "Cisco NAS Port"},
866   /* fax */
867   {3,   RADIUS_STRING,          "Fax Account Id Origin"},
868   {4,   RADIUS_STRING,          "Fax Msg Id"},
869   {5,   RADIUS_STRING,          "Fax Pages"},
870   {6,   RADIUS_STRING,          "Fax Cover Page Flag"},
871   {7,   RADIUS_STRING,          "Fax Modem Time"},
872   {8,   RADIUS_STRING,          "Fax Connect Speed"},
873   {9,   RADIUS_STRING,          "Fax Recipent Count"},
874   {10,  RADIUS_STRING,          "Fax Process Abort Flag"},
875   {11,  RADIUS_STRING,          "Fax DSN Address"},
876   {12,  RADIUS_STRING,          "Fax DSN Flag"},
877   {13,  RADIUS_STRING,          "Fax MDN Address"},
878   {14,  RADIUS_STRING,          "Fax MDN Flag"},
879   {15,  RADIUS_STRING,          "Fax Auth Status"},
880   {16,  RADIUS_STRING,          "Email Server Address"},
881   {17,  RADIUS_STRING,          "Email Server Ack Flag"},
882   {18,  RADIUS_STRING,          "Gateway Id"},
883   {19,  RADIUS_STRING,          "Call Type"},
884   {20,  RADIUS_STRING,          "Port Used"},
885   {21,  RADIUS_STRING,          "Abort Cause"},
886   /* #22 */
887   /* H323 - Voice over IP attributes. */
888   {23,  RADIUS_STRING,          "H323 Remote Address"},
889   {24,  RADIUS_STRING,          "H323 Conf Id"},
890   {25,  RADIUS_STRING,          "H323 Setup Time"},
891   {26,  RADIUS_STRING,          "H323 Call Origin"},
892   {27,  RADIUS_STRING,          "H323 Call Type"},
893   {28,  RADIUS_STRING,          "H323 Connect Time"},
894   {29,  RADIUS_STRING,          "H323 Disconnect Time"},
895   {30,  RADIUS_STRING,          "H323 Disconnect Cause"},
896   {31,  RADIUS_STRING,          "H323 Voice Quality"},
897   /* #32 */
898   {33,  RADIUS_STRING,          "H323 GW Id"},
899   /* #34 */
900   {35,  RADIUS_STRING,          "H323 Incoming Conf Id"},
901   /* #36-#100 */
902   {101, RADIUS_STRING,          "H323 Credit Amount"},
903   {102, RADIUS_STRING,          "H323 Credit Time"},
904   {103, RADIUS_STRING,          "H323 Return Code"},
905   {104, RADIUS_STRING,          "H323 Prompt Id"},
906   {105, RADIUS_STRING,          "H323 Time And Day"},
907   {106, RADIUS_STRING,          "H323 Redirect Number"},
908   {107, RADIUS_STRING,          "H323 Preferred Lang"},
909   {108, RADIUS_STRING,          "H323 Redirect Ip Address"},
910   {109, RADIUS_STRING,          "H323 Billing Model"},
911   {110, RADIUS_STRING,          "H323 Currency Type"},
912   /* #111-#186 */
913 /*
914        Extra attributes sent by the Cisco, if you configure
915        "radius-server vsa accounting" (requires IOS11.2+).
916 */
917   {187, RADIUS_INTEGER4,        "Cisco Multilink ID"},
918   {188, RADIUS_INTEGER4,        "Cisco Num In Multilink"},
919   /* #189 */
920   {190, RADIUS_INTEGER4,        "Cisco Pre Input Octets"},
921   {191, RADIUS_INTEGER4,        "Cisco Pre Output Octets"},
922   {192, RADIUS_INTEGER4,        "Cisco Pre Input Packets"},
923   {193, RADIUS_INTEGER4,        "Cisco Pre Output Packets"},
924   {194, RADIUS_INTEGER4,        "Cisco Maximum Time"},
925   {195, CISCO_DISCONNECT_CAUSE, "Cisco Disconnect Cause"},
926   /* #196 */
927   {197, RADIUS_INTEGER4,        "Cisco Data Rate"},
928   {198, RADIUS_INTEGER4,        "Cisco PreSession Time"},
929   /* #199-#207 */
930   {208, RADIUS_INTEGER4,        "Cisco PW Lifetime"},
931   {209, RADIUS_INTEGER4,        "Cisco IP Direct"},
932   {210, RADIUS_INTEGER4,        "Cisco PPP VJ Slot Comp"},
933   /* #211 */
934   {212, RADIUS_INTEGER4,        "Cisco PPP Async Map"},
935   /* #213-#216 */
936   {217, RADIUS_INTEGER4,        "Cisco IP Pool Definition"},
937   {218, RADIUS_INTEGER4,        "Cisco Asing IP Pool"},
938   /* #219-#227 */
939   {228, RADIUS_INTEGER4,        "Cisco Route IP"},
940   /* #229-#232 */
941   {233, RADIUS_INTEGER4,        "Cisco Link Compression"},
942   {234, RADIUS_INTEGER4,        "Cisco Target Util"},
943   {235, RADIUS_INTEGER4,        "Cisco Maximum Channels"},
944   /* #236-#241 */
945   {242, RADIUS_INTEGER4,        "Cisco Data Filter"},
946   {243, RADIUS_INTEGER4,        "Cisco Call Filter"},
947   {244, RADIUS_INTEGER4,        "Cisco Idle Limit"},
948   /* Cisco SSG Service Selection Gateway Attributes */
949   {250, RADIUS_STRING,          "Cisco Account Info"},
950   {251, RADIUS_STRING,          "Cisco Service Info"},
951   {252, RADIUS_BINSTRING,       "Cisco Command Info"},
952   {253, RADIUS_STRING,          "Cisco Control Info"},
953   {255, RADIUS_INTEGER4,        "Cisco Xmit Rate"},
954   {0, 0, NULL}
955 };
956
957 static value_string radius_vendor_cisco_disconnect_cause_vals[] =
958 {
959   {2,   "Unknown"},
960   {4,   "CLID Authentication Failure"},
961   {10,  "No Carrier"},
962   {11,  "Lost Carrier"},
963   {12,  "No Detected Result Codes"},
964   {20,  "User Ends Session"},
965   {21,  "Idle Timeout"},
966   {22,  "Exit Telnet Session"},
967   {23,  "No Remote IP Addr"},
968   {24,  "Exit Raw TCP"},
969   {25,  "Password Fail"},
970   {26,  "Raw TCP Disabled"},
971   {27,  "Control C Detected"},
972   {28,  "EXEC Program Destroyed"},
973   {40,  "Timeout PPP LCP"},
974   {41,  "Failed PPP LCP Negotiation"},
975   {42,  "Failed PPP PAP Auth Fail"},
976   {43,  "Failed PPP CHAP Auth"},
977   {44,  "Failed PPP Remote Auth"},
978   {45,  "PPP Remote Terminate"},
979   {46,  "PPP Closed Event"},
980   {100, "Session Timeout"},
981   {101, "Session Failed Security"},
982   {102, "Session End Callback"},
983   {120, "Invalid Protocol"},
984   {0, NULL}
985 };
986
987 /*
988 reference:
989         'dictionary.shiva' file from FreeRADIUS
990                 http://www.freeradius.org/radiusd/raddb/dictionary.shiva
991 */
992 static value_value_string radius_vendor_shiva_attrib[] =
993 {
994   {1,   RADIUS_STRING,          "Shiva User Attributes"},
995   {90,  RADIUS_STRING,          "Shiva Called Number"},
996   {91,  RADIUS_STRING,          "Shiva Calling Number"},
997   {92,  RADIUS_STRING,          "Shiva Customer Id"},
998   {93,  SHIVA_TYPE_OF_SERVICE,  "Shiva Type Of Service"},
999   {94,  RADIUS_INTEGER4,        "Shiva Link Speed"},
1000   {95,  RADIUS_INTEGER4,        "Shiva Links In Bundle"},
1001   {96,  RADIUS_INTEGER4,        "Shiva Compression Type"},
1002   {97,  SHIVA_LINK_PROTOCOL,    "Shiva Link Protocol"},
1003   {98,  RADIUS_INTEGER4,        "Shiva Network Protocols"},
1004   {99,  RADIUS_INTEGER4,        "Shiva Session Id"},
1005   {100, SHIVA_DISCONNECT_REASON,"Shiva Disconnect Reason"},
1006   {101, RADIUS_IP_ADDRESS,      "Shiva Acct Serv Switch"},
1007   {102, RADIUS_INTEGER4,        "Shiva Event Flags"},
1008   {103, SHIVA_FUNCTION,         "Shiva Function"},
1009   {104, SHIVA_CONNECT_REASON,   "Shiva Connect Reason"},
1010   {0, 0, NULL},
1011 };
1012
1013 static value_string radius_vendor_shiva_type_of_service_vals[] =
1014 {
1015   {1,   "Analog"},
1016   {2,   "Digitized Analog"},
1017   {3,   "Digital"},
1018   {4,   "Digital V.110"},
1019   {5,   "Digital V.120"},
1020   {6,   "Digital Leased Line"},
1021   {0, NULL}
1022 };
1023
1024 static value_string radius_vendor_shiva_link_protocol_vals[] =
1025 {
1026   {1,   "HDLC"},
1027   {2,   "ARAV1"},
1028   {3,   "ARAV2"},
1029   {4,   "SHELL"},
1030   {5,   "AALAP"},
1031   {6,   "SLIP"},
1032   {0, NULL}
1033 };
1034
1035 static value_string radius_vendor_shiva_disconnect_reason_vals[] =
1036 {
1037   {1,   "Remote"},
1038   {2,   "Error"},
1039   {3,   "Idle Timeout"},
1040   {4,   "Session Timeout"},
1041   {5,   "Admin Disconnect"},
1042   {6,   "Dialback"},
1043   {7,   "Virtual Connection"},
1044   {8,   "Bandwidth On Demand"},
1045   {9,   "Failed Authentication"},
1046   {10,  "Preempted"},
1047   {11,  "Blocked"},
1048   {12,  "Tariff Management"},
1049   {13,  "Backup"},
1050   {0, NULL}
1051 };
1052
1053 static value_string radius_vendor_shiva_function_vals[] =
1054 {
1055   {0,   "Unknown"},
1056   {1,   "Dialin"},
1057   {2,   "Dialout"},
1058   {3,   "Lan To Lan"},
1059   {0, NULL}
1060 };
1061
1062 static value_string radius_vendor_shiva_connect_reason_vals[] =
1063 {
1064   {1,   "Remote"},
1065   {2,   "Dialback"},
1066   {3,   "Virtual Connection"},
1067   {4,   "Bandwidth On Demand"},
1068   {0, NULL}
1069 };
1070
1071 /*
1072 reference:
1073         'dictionary.livingston' file from FreeRADIUS
1074                 http://www.freeradius.org/radiusd/raddb/dictionary.livingston
1075 */
1076 static value_value_string radius_vendor_livingston_attrib[] =
1077 {
1078   {2,   RADIUS_STRING,                  "LE Terminate Detail"},
1079   {3,   RADIUS_STRING,                  "LE Advice of Charge"},
1080   {4,   RADIUS_STRING,                  "LE Connect Detail"},
1081   {6,   RADIUS_STRING,                  "LE IP Pool"},
1082   {7,   RADIUS_IP_ADDRESS,              "LE IP Gateway"},
1083   {8,   RADIUS_STRING,                  "LE Modem Info"},
1084   {9,   LIVINGSTON_IPSEC_LOG_OPTIONS,   "LE IPSec Log Options"},
1085   {10,  LIVINGSTON_IPSEC_DENY_ACTION,   "LE IPSec Deny Action"},
1086   {11,  RADIUS_STRING,                  "LE IPSec Active Profile"},
1087   {12,  RADIUS_STRING,                  "LE IPSec Outsource Profile"},
1088   {13,  RADIUS_STRING,                  "LE IPSec Passive Profile"},
1089   {14,  RADIUS_INTEGER4,                "LE NAT TCP Session Timeout"},
1090   {15,  RADIUS_INTEGER4,                "LE NAT Other Session Timeout"},
1091   {16,  LIVINGSTON_NAT_LOG_OPTIONS,     "LE NAT Log Options"},
1092   {17,  LIVINGSTON_NAT_SESS_DIR_FAIL_ACTION,    "LE NAT Sess Dir Fail Action"},
1093   {18,  RADIUS_STRING,                  "LE NAT Inmap"},
1094   {19,  RADIUS_STRING,                  "LE NAT Outmap"},
1095   {20,  RADIUS_STRING,                  "LE NAT Outsource Inmap"},
1096   {21,  RADIUS_STRING,                  "LE NAT Outsource Outmap"},
1097   {22,  RADIUS_STRING,                  "LE Admin Group"},
1098   {23,  LIVINGSTON_MULTICAST_CLIENT,    "LE Multicast Client"},
1099   {0, 0, NULL},
1100 };
1101
1102 static value_string radius_vendor_livingston_ipsec_log_options_vals[] =
1103 {
1104   {1,   "SA Success On"},
1105   {2,   "SA Failure On"},
1106   {3,   "Console On"},
1107   {4,   "Syslog On"},
1108   {5,   "SA Success Off"},
1109   {6,   "SA Failure Off"},
1110   {7,   "Console Off"},
1111   {8,   "Syslog Off"},
1112   {0, NULL}
1113 };
1114
1115 static value_string radius_vendor_livingston_ipsec_deny_action_vals[] =
1116 {
1117   {1,   "Drop"},
1118   {2,   "ICMP Reject"},
1119   {3,   "Pass Through"},
1120   {0, NULL}
1121 };
1122
1123 static value_string radius_vendor_livingston_nat_log_options_vals[] =
1124 {
1125   {1,   "Session Success On"},
1126   {2,   "Session Failure On"},
1127   {3,   "Console On"},
1128   {4,   "Syslog On"},
1129   {5,   "Success Off"},
1130   {6,   "Failure Off"},
1131   {7,   "Console Off"},
1132   {8,   "Syslog Off"},
1133   {0, NULL}
1134 };
1135
1136 static value_string radius_vendor_livingston_nat_sess_dir_fail_action_vals[] =
1137 {
1138   {1,   "Drop"},
1139   {2,   "ICMP Reject"},
1140   {3,   "Pass Through"},
1141   {0, NULL}
1142 };
1143
1144 static value_string radius_vendor_livingston_multicast_client_vals[] =
1145 {
1146   {1,   "On"},
1147   {0, NULL}
1148 };
1149
1150 static value_value_string radius_vendor_microsoft_attrib[] =
1151 {
1152   {1,   RADIUS_BINSTRING,               "MS CHAP Response"},
1153   {2,   RADIUS_STRING,                  "MS CHAP Error"},
1154   {3,   RADIUS_BINSTRING,               "MS CHAP CPW 1"},
1155   {4,   RADIUS_BINSTRING,               "MS CHAP CPW 2"},
1156   {5,   RADIUS_BINSTRING,               "MS CHAP LM Enc PW"},
1157   {6,   RADIUS_BINSTRING,               "MS CHAP NT Enc PW"},
1158   {7,   RADIUS_BINSTRING,               "MS MPPE Encryption Policy"},
1159   {8,   RADIUS_BINSTRING,               "MS MPPE Encryption Type"},
1160   {9,   RADIUS_INTEGER4,                "MS RAS Vendor"},
1161   {10,  RADIUS_STRING,                  "MS CHAP Domain"},
1162   {11,  RADIUS_BINSTRING,               "MS CHAP Challenge"},
1163   {12,  RADIUS_BINSTRING,               "MS CHAP MPPE Keys"},
1164   {13,  MICROSOFT_BAP_USAGE,            "MS BAP Usage"},
1165   {14,  RADIUS_INTEGER4,                "MS Link Utilization Threshold"},
1166   {15,  RADIUS_INTEGER4,                "MS Link Drop Time Limit"},
1167   {16,  RADIUS_BINSTRING,               "MS MPPE Send Key"},
1168   {17,  RADIUS_BINSTRING,               "MS MPPE Recv Key"},
1169   {18,  RADIUS_STRING,                  "MS RAS Version"},
1170   {19,  RADIUS_BINSTRING,               "MS Old ARAP Password"},
1171   {20,  RADIUS_BINSTRING,               "MS New ARAP Password"},
1172   {21,  MICROSOFT_ARAP_PW_CHANGE_REASON,"MS ARAP PW Change Reason"},
1173   {22,  RADIUS_BINSTRING,               "MS Filter"},
1174   {23,  MICROSOFT_ACCT_AUTH_TYPE,       "MS Acct Auth Type"},
1175   {24,  MICROSOFT_ACCT_EAP_TYPE,        "MS Acct EAP Type"},
1176   {25,  RADIUS_BINSTRING,               "MS CHAP2 Response"},
1177   {26,  RADIUS_BINSTRING,               "MS CHAP2 Success"},
1178   {27,  RADIUS_BINSTRING,               "MS CHAP2 CPW"},
1179   {28,  RADIUS_IP_ADDRESS,              "MS Primary DNS Server"},
1180   {29,  RADIUS_IP_ADDRESS,              "MS Secondary DNS Server"},
1181   {30,  RADIUS_IP_ADDRESS,              "MS Primary NBNS Server"},
1182   {31,  RADIUS_IP_ADDRESS,              "MS Secondary NBNS Server"},
1183   {0, 0, NULL}
1184 };
1185
1186 static value_string radius_vendor_microsoft_bap_usage_vals[] =
1187 {
1188   {0,   "Not Allowed"},
1189   {1,   "Allowed"},
1190   {2,   "Required"},
1191   {0, NULL}
1192 };
1193
1194 static value_string radius_vendor_microsoft_arap_pw_change_reason_vals[] =
1195 {
1196   {1,   "Just Change Password"},
1197   {2,   "Expired Password"},
1198   {3,   "Admin Required Password Change"},
1199   {4,   "Password Too Short"},
1200   {0, NULL}
1201 };
1202
1203 static value_string radius_vendor_microsoft_acct_auth_type_vals[] =
1204 {
1205   {1,   "PAP"},
1206   {2,   "CHAP"},
1207   {3,   "MS CHAP 1"},
1208   {4,   "MS CHAP 2"},
1209   {5,   "EAP"},
1210   {0, NULL}
1211 };
1212
1213 static value_string radius_vendor_microsoft_acct_eap_type_vals[] =
1214 {
1215   {4,   "MD5"},
1216   {5,   "OTP"},
1217   {6,   "Generic Token Card"},
1218   {13,  "TLS"},
1219   {0, NULL}
1220 };
1221
1222 static value_value_string radius_vendor_ascend_attrib[] =
1223 {
1224   {7,   RADIUS_STRING,          "Ascend UU Info"},
1225   {9,   RADIUS_INTEGER4,        "Ascend CIR Timer"},
1226   {10,  RADIUS_INTEGER4,        "Ascend FR 08 Mode"},
1227   {11,  RADIUS_INTEGER4,        "Ascend Destination Nas Port"},
1228   {12,  RADIUS_STRING,          "Ascend FR SVC Addr"},
1229   {13,  RADIUS_INTEGER4,        "Ascend NAS Port Format"},
1230   {14,  RADIUS_INTEGER4,        "Ascend ATM Fault Management"},
1231   {15,  RADIUS_INTEGER4,        "Ascend ATM Loopback Cell Loss"},
1232   {16,  RADIUS_INTEGER4,        "Ascend Ckt Type"},
1233   {17,  RADIUS_INTEGER4,        "Ascend SVC Enabled"},
1234   {18,  RADIUS_INTEGER4,        "Ascend Session Type"},
1235   {19,  RADIUS_IP_ADDRESS,      "Ascend H323 Gatekeeper"},
1236   {20,  RADIUS_STRING,          "Ascend Global Call Id"},
1237   {21,  RADIUS_INTEGER4,        "Ascend H323 Conference Id"},
1238   {22,  RADIUS_IP_ADDRESS,      "Ascend H323 Fegw Address"},
1239   {23,  RADIUS_INTEGER4,        "Ascend H323 Dialed Time"},
1240   {24,  RADIUS_STRING,          "Ascend Dialed Number"},
1241   {25,  RADIUS_INTEGER4,        "Ascend Inter Arrival Jitter"},
1242   {26,  RADIUS_INTEGER4,        "Ascend Dropped Octets"},
1243   {27,  RADIUS_INTEGER4,        "Ascend Dropped Packets"},
1244   {29,  RADIUS_INTEGER4,        "Ascend X25 Pad X3 Profile"},
1245   {30,  RADIUS_STRING,          "Ascend X25 Pad X3 Parameters"},
1246   {31,  RADIUS_STRING,          "Ascend Tunnel VRouter Name"},
1247   {32,  RADIUS_INTEGER4,        "Ascend X25 Reverse Charging"},
1248   {33,  RADIUS_STRING,          "Ascend X25 Nui Prompt"},
1249   {34,  RADIUS_STRING,          "Ascend X25 Nui Password Prompt"},
1250   {35,  RADIUS_STRING,          "Ascend X25 Cug"},
1251   {36,  RADIUS_STRING,          "Ascend X25 Pad Alias 1"},
1252   {37,  RADIUS_STRING,          "Ascend X25 Pad Alias 2"},
1253   {38,  RADIUS_STRING,          "Ascend X25 Pad Alias 3"},
1254   {39,  RADIUS_STRING,          "Ascend X25 X121 Address"},
1255   {40,  RADIUS_STRING,          "Ascend X25 Nui"},
1256   {41,  RADIUS_STRING,          "Ascend X25 Rpoa"},
1257   {42,  RADIUS_STRING,          "Ascend X25 Pad Prompt"},
1258   {43,  RADIUS_STRING,          "Ascend X25 Pad Banner"},
1259   {44,  RADIUS_STRING,          "Ascend X25 Profile Name"},
1260   {45,  RADIUS_STRING,          "Ascend Recv Name"},
1261   {46,  RADIUS_INTEGER4,        "Ascend Bi Directional Auth"},
1262   {47,  RADIUS_INTEGER4,        "Ascend MTU"},
1263   {48,  RADIUS_INTEGER4,        "Ascend Call Direction"},
1264   {49,  RADIUS_INTEGER4,        "Ascend Service Type"},
1265   {50,  RADIUS_INTEGER4,        "Ascend Filter Required"},
1266   {51,  RADIUS_INTEGER4,        "Ascend Traffic Shaper"},
1267   {52,  RADIUS_STRING,          "Ascend Access Intercept LEA"},
1268   {53,  RADIUS_STRING,          "Ascend Access Intercept Log"},
1269   {54,  RADIUS_STRING,          "Ascend Private Route Table ID"},
1270   {55,  RADIUS_INTEGER4,        "Ascend Private Route Required"},
1271   {56,  RADIUS_INTEGER4,        "Ascend Cache Refresh"},
1272   {57,  RADIUS_INTEGER4,        "Ascend Cache Time"},
1273   {58,  RADIUS_INTEGER4,        "Ascend Egress Enabled"},
1274   {59,  RADIUS_STRING,          "Ascend QOS Upstream"},
1275   {60,  RADIUS_STRING,          "Ascend QOS Downstream"},
1276   {61,  RADIUS_INTEGER4,        "Ascend ATM Connect Vpi"},
1277   {62,  RADIUS_INTEGER4,        "Ascend ATM Connect Vci"},
1278   {63,  RADIUS_INTEGER4,        "Ascend ATM Connect Group"},
1279   {64,  RADIUS_INTEGER4,        "Ascend ATM Group"},
1280   {65,  RADIUS_INTEGER4,        "Ascend IPX Header Compression"},
1281   {66,  ASCEND_CALLING_ID_TYPE_OF_NUMBER,       "Ascend Calling Id Type Of Number"},
1282   {67,  ASCEND_CALLING_ID_NUMBERING_PLAN,       "Ascend Calling Id Numbering Plan"},
1283   {68,  ASCEND_CALLING_ID_PRESENTATION,         "Ascend Calling Id Presentation"},
1284   {69,  ASCEND_CALLING_ID_SCREENING,            "Ascend Calling Id Screening"},
1285   {70,  RADIUS_INTEGER4,        "Ascend BIR Enable"},
1286   {71,  RADIUS_INTEGER4,        "Ascend BIR Proxy"},
1287   {72,  RADIUS_INTEGER4,        "Ascend BIR Bridge Group"},
1288   {73,  RADIUS_STRING,          "Ascend IPSEC Profile"},
1289   {74,  RADIUS_INTEGER4,        "Ascend PPPoE Enable"},
1290   {75,  RADIUS_INTEGER4,        "Ascend Bridge Non PPPoE"},
1291   {76,  RADIUS_INTEGER4,        "Ascend ATM Direct"},
1292   {77,  RADIUS_STRING,          "Ascend ATM Direct Profile"},
1293   {78,  RADIUS_IP_ADDRESS,      "Ascend Client Primary WINS"},
1294   {79,  RADIUS_IP_ADDRESS,      "Ascend Client Secondary WINS"},
1295   {80,  RADIUS_INTEGER4,        "Ascend Client Assign WINS"},
1296   {81,  RADIUS_INTEGER4,        "Ascend Auth Type"},
1297   {82,  RADIUS_INTEGER4,        "Ascend Port Redir Protocol"},
1298   {83,  RADIUS_INTEGER4,        "Ascend Port Redir Portnum"},
1299   {84,  RADIUS_IP_ADDRESS,      "Ascend Port Redir Server"},
1300   {85,  RADIUS_INTEGER4,        "Ascend IP Pool Chaining"},
1301   {86,  RADIUS_IP_ADDRESS,      "Ascend Owner IP Addr"},
1302   {87,  RADIUS_INTEGER4,        "Ascend IP TOS"},
1303   {88,  RADIUS_INTEGER4,        "Ascend IP TOS Precedence"},
1304   {89,  RADIUS_INTEGER4,        "Ascend IP TOS Apply To"},
1305   {90,  RADIUS_STRING,          "Ascend Filter"},
1306   {91,  RADIUS_STRING,          "Ascend Telnet Profile"},
1307   {92,  RADIUS_INTEGER4,        "Ascend Dsl Rate Type"},
1308   {93,  RADIUS_STRING,          "Ascend Redirect Number"},
1309   {94,  RADIUS_INTEGER4,        "Ascend ATM Vpi"},
1310   {95,  RADIUS_INTEGER4,        "Ascend ATM Vci"},
1311   {96,  RADIUS_INTEGER4,        "Ascend Source IP Check"},
1312   {97,  RADIUS_INTEGER4,        "Ascend Dsl Rate Mode"},
1313   {98,  RADIUS_INTEGER4,        "Ascend Dsl Upstream Limit"},
1314   {99,  RADIUS_INTEGER4,        "Ascend Dsl Downstream Limit"},
1315   {100, RADIUS_INTEGER4,        "Ascend Dsl CIR Recv Limit"},
1316   {101, RADIUS_INTEGER4,        "Ascend Dsl CIR Xmit Limit"},
1317   {102, RADIUS_STRING,          "Ascend VRouter Name"},
1318   {103, RADIUS_STRING,          "Ascend Source Auth"},
1319   {104, RADIUS_STRING,          "Ascend Private Route"},
1320   {105, RADIUS_INTEGER4,        "Ascend Numbering Plan ID"},
1321   {106, RADIUS_INTEGER4,        "Ascend FR Link Status DLCI"},
1322   {107, RADIUS_STRING,          "Ascend Calling Subaddress"},
1323   {108, RADIUS_INTEGER4,        "Ascend Callback Delay"},
1324   {109, RADIUS_STRING,          "Ascend Endpoint Disc"},
1325   {110, RADIUS_STRING,          "Ascend Remote FW"},
1326   {111, RADIUS_INTEGER4,        "Ascend Multicast GLeave Delay"},
1327   {112, RADIUS_INTEGER4,        "Ascend CBCP Enable"},
1328   {113, RADIUS_INTEGER4,        "Ascend CBCP Mode"},
1329   {114, RADIUS_INTEGER4,        "Ascend CBCP Delay"},
1330   {115, RADIUS_INTEGER4,        "Ascend CBCP Trunk Group"},
1331   {116, RADIUS_STRING,          "Ascend Appletalk Route"},
1332   {117, RADIUS_INTEGER4,        "Ascend Appletalk Peer Mode"},
1333   {118, RADIUS_INTEGER4,        "Ascend Route Appletalk"},
1334   {119, RADIUS_STRING,          "Ascend FCP Parameter"},
1335   {120, RADIUS_INTEGER4,        "Ascend Modem Port No"},
1336   {121, RADIUS_INTEGER4,        "Ascend Modem Slot No"},
1337   {122, RADIUS_INTEGER4,        "Ascend Modem Shelf No"},
1338   {123, RADIUS_INTEGER4,        "Ascend Call Attempt Limit"},
1339   {124, RADIUS_INTEGER4,        "Ascend Call Block Duration"},
1340   {125, RADIUS_INTEGER4,        "Ascend Maximum Call Duration"},
1341   {126, RADIUS_INTEGER4,        "Ascend Temporary Rtes"},
1342   {127, RADIUS_INTEGER4,        "Ascend Tunneling Protocol"},
1343   {128, RADIUS_INTEGER4,        "Ascend Shared Profile Enable"},
1344   {129, RADIUS_STRING,          "Ascend Primary Home Agent"},
1345   {130, RADIUS_STRING,          "Ascend Secondary Home Agent"},
1346   {131, RADIUS_INTEGER4,        "Ascend Dialout Allowed"},
1347   {132, RADIUS_IP_ADDRESS,      "Ascend Client Gateway"},
1348   {133, RADIUS_INTEGER4,        "Ascend BACP Enable"},
1349   {134, RADIUS_INTEGER4,        "Ascend DHCP Maximum Leases"},
1350   {135, RADIUS_IP_ADDRESS,      "Ascend Client Primary DNS"},
1351   {136, RADIUS_IP_ADDRESS,      "Ascend Client Secondary DNS"},
1352   {137, RADIUS_INTEGER4,        "Ascend Client Assign DNS"},
1353   {138, RADIUS_INTEGER4,        "Ascend User Acct Type"},
1354   {139, RADIUS_IP_ADDRESS,      "Ascend User Acct Host"},
1355   {140, RADIUS_INTEGER4,        "Ascend User Acct Port"},
1356   {141, RADIUS_STRING,          "Ascend User Acct Key"},
1357   {142, RADIUS_INTEGER4,        "Ascend User Acct Base"},
1358   {143, RADIUS_INTEGER4,        "Ascend User Acct Time"},
1359   {144, RADIUS_IP_ADDRESS,      "Ascend Assign IP Client"},
1360   {145, RADIUS_IP_ADDRESS,      "Ascend Assign IP Server"},
1361   {146, RADIUS_STRING,          "Ascend Assign IP Global Pool"},
1362   {147, RADIUS_INTEGER4,        "Ascend DHCP Reply"},
1363   {148, RADIUS_INTEGER4,        "Ascend DHCP Pool Number"},
1364   {149, RADIUS_INTEGER4,        "Ascend Expect Callback"},
1365   {150, RADIUS_INTEGER4,        "Ascend Event Type"},
1366   {151, RADIUS_STRING,          "Ascend Session Svr Key"},
1367   {152, RADIUS_INTEGER4,        "Ascend Multicast Rate Limit"},
1368   {153, RADIUS_IP_ADDRESS,      "Ascend IF Netmask"},
1369   {154, RADIUS_IP_ADDRESS,      "Ascend Remote Addr"},
1370   {155, RADIUS_INTEGER4,        "Ascend Multicast Client"},
1371   {156, RADIUS_STRING,          "Ascend FR Circuit Name"},
1372   {157, RADIUS_INTEGER4,        "Ascend FR LinkUp"},
1373   {158, RADIUS_INTEGER4,        "Ascend FR Nailed Grp"},
1374   {159, RADIUS_INTEGER4,        "Ascend FR Type"},
1375   {160, RADIUS_INTEGER4,        "Ascend FR Link Mgt"},
1376   {161, RADIUS_INTEGER4,        "Ascend FR N391"},
1377   {162, RADIUS_INTEGER4,        "Ascend FR DCE N392"},
1378   {163, RADIUS_INTEGER4,        "Ascend FR DTE N392"},
1379   {164, RADIUS_INTEGER4,        "Ascend FR DCE N393"},
1380   {165, RADIUS_INTEGER4,        "Ascend FR DTE N393"},
1381   {166, RADIUS_INTEGER4,        "Ascend FR T391"},
1382   {167, RADIUS_INTEGER4,        "Ascend FR T392"},
1383   {168, RADIUS_STRING,          "Ascend Bridge Address"},
1384   {169, RADIUS_INTEGER4,        "Ascend TS Idle Limit"},
1385   {170, RADIUS_INTEGER4,        "Ascend TS Idle Mode"},
1386   {171, RADIUS_INTEGER4,        "Ascend DBA Monitor"},
1387   {172, RADIUS_INTEGER4,        "Ascend Base Channel Count"},
1388   {173, RADIUS_INTEGER4,        "Ascend Minimum Channels"},
1389   {174, RADIUS_STRING,          "Ascend IPX Route"},
1390   {175, RADIUS_INTEGER4,        "Ascend FT1 Caller"},
1391   {176, RADIUS_STRING,          "Ascend Backup"},
1392   {177, RADIUS_INTEGER4,        "Ascend Call Type"},
1393   {178, RADIUS_STRING,          "Ascend Group"},
1394   {179, RADIUS_INTEGER4,        "Ascend FR DLCI"},
1395   {180, RADIUS_STRING,          "Ascend FR Profile Name"},
1396   {181, RADIUS_STRING,          "Ascend Ara PW"},
1397   {182, RADIUS_STRING,          "Ascend IPX Node Addr"},
1398   {183, RADIUS_IP_ADDRESS,      "Ascend Home Agent IP Addr"},
1399   {184, RADIUS_STRING,          "Ascend Home Agent Password"},
1400   {185, RADIUS_STRING,          "Ascend Home Network Name"},
1401   {186, RADIUS_INTEGER4,        "Ascend Home Agent UDP Port"},
1402   {187, RADIUS_INTEGER4,        "Ascend Multilink ID"},
1403   {188, RADIUS_INTEGER4,        "Ascend Num In Multilink"},
1404   {189, RADIUS_IP_ADDRESS,      "Ascend First Dest"},
1405   {190, RADIUS_INTEGER4,        "Ascend Pre Input Octets"},
1406   {191, RADIUS_INTEGER4,        "Ascend Pre Output Octets"},
1407   {192, RADIUS_INTEGER4,        "Ascend Pre Input Packets"},
1408   {193, RADIUS_INTEGER4,        "Ascend Pre Output Packets"},
1409   {194, RADIUS_INTEGER4,        "Ascend Maximum Time"},
1410   {195, RADIUS_INTEGER4,        "Ascend Disconnect Cause"},
1411   {196, RADIUS_INTEGER4,        "Ascend Connect Progress"},
1412   {197, RADIUS_INTEGER4,        "Ascend Data Rate"},
1413   {198, RADIUS_INTEGER4,        "Ascend PreSession Time"},
1414   {199, RADIUS_INTEGER4,        "Ascend Token Idle"},
1415   {200, RADIUS_INTEGER4,        "Ascend Token Immediate"},
1416   {201, RADIUS_INTEGER4,        "Ascend Require Auth"},
1417   {202, RADIUS_STRING,          "Ascend Number Sessions"},
1418   {203, RADIUS_STRING,          "Ascend Authen Alias"},
1419   {204, RADIUS_INTEGER4,        "Ascend Token Expiry"},
1420   {205, RADIUS_STRING,          "Ascend Menu Selector"},
1421   {206, RADIUS_STRING,          "Ascend Menu Item"},
1422   {207, RADIUS_INTEGER4,        "Ascend PW Warntime"},
1423   {208, RADIUS_INTEGER4,        "Ascend PW Lifetime"},
1424   {209, RADIUS_IP_ADDRESS,      "Ascend IP Direct"},
1425   {210, RADIUS_INTEGER4,        "Ascend PPP VJ Slot Comp"},
1426   {211, RADIUS_INTEGER4,        "Ascend PPP VJ 1172"},
1427   {212, RADIUS_INTEGER4,        "Ascend PPP Async Map"},
1428   {213, RADIUS_STRING,          "Ascend Third Prompt"},
1429   {214, RADIUS_STRING,          "Ascend Send Secret"},
1430   {215, RADIUS_STRING,          "Ascend Receive Secret"},
1431   {216, RADIUS_INTEGER4,        "Ascend IPX Peer Mode"},
1432   {217, RADIUS_STRING,          "Ascend IP Pool Definition"},
1433   {218, RADIUS_INTEGER4,        "Ascend Assign IP Pool"},
1434   {219, RADIUS_INTEGER4,        "Ascend FR Direct"},
1435   {220, RADIUS_STRING,          "Ascend FR Direct Profile"},
1436   {221, RADIUS_INTEGER4,        "Ascend FR Direct DLCI"},
1437   {222, RADIUS_INTEGER4,        "Ascend Handle IPX"},
1438   {223, RADIUS_INTEGER4,        "Ascend Netware timeout"},
1439   {224, RADIUS_INTEGER4,        "Ascend IPX Alias"},
1440   {225, RADIUS_INTEGER4,        "Ascend Metric"},
1441   {226, RADIUS_INTEGER4,        "Ascend PRI Number Type"},
1442   {227, RADIUS_STRING,          "Ascend Dial Number"},
1443   {228, RADIUS_INTEGER4,        "Ascend Route IP"},
1444   {229, RADIUS_INTEGER4,        "Ascend Route IPX"},
1445   {230, RADIUS_INTEGER4,        "Ascend Bridge"},
1446   {231, RADIUS_INTEGER4,        "Ascend Send Auth"},
1447   {232, RADIUS_STRING,          "Ascend Send Passwd"},
1448   {233, RADIUS_INTEGER4,        "Ascend Link Compression"},
1449   {234, RADIUS_INTEGER4,        "Ascend Target Util"},
1450   {235, RADIUS_INTEGER4,        "Ascend Maximum Channels"},
1451   {236, RADIUS_INTEGER4,        "Ascend Inc Channel Count"},
1452   {237, RADIUS_INTEGER4,        "Ascend Dec Channel Count"},
1453   {238, RADIUS_INTEGER4,        "Ascend Seconds Of History"},
1454   {239, RADIUS_INTEGER4,        "Ascend History Weigh Type"},
1455   {240, RADIUS_INTEGER4,        "Ascend Add Seconds"},
1456   {241, RADIUS_INTEGER4,        "Ascend Remove Seconds"},
1457   {242, RADIUS_BINSTRING,       "Ascend Data Filter"},
1458   {243, RADIUS_BINSTRING,       "Ascend Call Filter"},
1459   {244, RADIUS_INTEGER4,        "Ascend Idle Limit"},
1460   {245, RADIUS_INTEGER4,        "Ascend Preempt Limit"},
1461   {246, RADIUS_INTEGER4,        "Ascend Callback"},
1462   {247, RADIUS_INTEGER4,        "Ascend Data Svc"},
1463   {248, RADIUS_INTEGER4,        "Ascend Force 56"},
1464   {249, RADIUS_STRING,          "Ascend Billing Number"},
1465   {250, RADIUS_INTEGER4,        "Ascend Call By Call"},
1466   {251, RADIUS_STRING,          "Ascend Transit Number"},
1467   {252, RADIUS_STRING,          "Ascend Host Info"},
1468   {253, RADIUS_IP_ADDRESS,      "Ascend PPP Address"},
1469   {254, RADIUS_INTEGER4,        "Ascend MPP Idle Percent"},
1470   {255, RADIUS_INTEGER4,        "Ascend Xmit Rate"},
1471   {0, 0, NULL}
1472 };
1473
1474 static value_string radius_vendor_ascend_calling_id_type_of_number_vals[] =
1475 {
1476   {0,   "Unknown"},
1477   {1,   "International Number"},
1478   {2,   "National Number"},
1479   {3,   "Network Specific"},
1480   {4,   "Subscriber Number"},
1481   {6,   "Abbreviated Number"},
1482   {0, NULL}
1483 };
1484
1485 static value_string radius_vendor_ascend_calling_id_numbering_plan_vals[] =
1486 {
1487   {0,   "Unknown"},
1488   {1,   "ISDN Telephony"},
1489   {3,   "Data"},
1490   {4,   "Telex"},
1491   {8,   "National"},
1492   {9,   "Private"},
1493   {0, NULL}
1494 };
1495
1496 static value_string radius_vendor_ascend_calling_id_presentation_vals[] =
1497 {
1498   {0,   "Allowed"},
1499   {1,   "Restricted"},
1500   {2,   "Number Not Available"},
1501   {0, NULL}
1502 };
1503
1504 static value_string radius_vendor_ascend_calling_id_screening_vals[] =
1505 {
1506   {0,   "User Not Screened"},
1507   {1,   "User Provided Passed"},
1508   {2,   "User Provided Failed"},
1509   {3,   "Network Provided"},
1510   {0, NULL}
1511 };
1512
1513 /*
1514 reference:
1515         'dictionary.bay' file from FreeRADIUS
1516                 http://www.freeradius.org/radiusd/raddb/dictionary.bay
1517 */
1518 static value_value_string radius_vendor_bay_attrib[] =
1519 {
1520   {28,  RADIUS_STRING,                  "Annex Filter"},
1521   {29,  RADIUS_STRING,                  "Annex CLI Command"},
1522   {30,  RADIUS_STRING,                  "Annex CLI Filter"},
1523   {31,  RADIUS_STRING,                  "Annex Host Restrict"},
1524   {32,  RADIUS_STRING,                  "Annex Host Allow"},
1525   {33,  RADIUS_STRING,                  "Annex Product Name"},
1526   {34,  RADIUS_STRING,                  "Annex SW Version"},
1527   {35,  RADIUS_IP_ADDRESS,              "Annex Local IP Address"},
1528   {36,  RADIUS_INTEGER4,                "Annex Callback Portlist"},
1529   {37,  RADIUS_INTEGER4,                "Annex Sec Profile Index"},
1530   {38,  BAY_TUNNEL_AUTHEN_TYPE,         "Annex Tunnel Authen Type"},
1531   {39,  BAY_TUNNEL_AUTHEN_MODE,         "Annex Tunnel Authen Mode"},
1532   {40,  RADIUS_STRING,                  "Annex Authen Servers"},
1533   {41,  RADIUS_STRING,                  "Annex Acct Servers"},
1534   {42,  BAY_USER_SERVER_LOCATION,       "Annex User Server Location"},
1535   {43,  RADIUS_STRING,                  "Annex Local Username"},
1536   {44,  BAY_SYSTEM_DISC_REASON,         "Annex System Disc Reason"},
1537   {45,  BAY_MODEM_DISC_REASON,          "Annex Modem Disc Reason"},
1538   {46,  RADIUS_INTEGER4,                "Annex Disconnect Reason"},
1539   {47,  BAY_ADDR_RESOLUTION_PROTOCOL,   "Annex Addr Resolution Protocol"},
1540   {48,  RADIUS_STRING,                  "Annex Addr Resolution Servers"},
1541   {49,  RADIUS_STRING,                  "Annex Domain Name"},
1542   {50,  RADIUS_INTEGER4,                "Annex Transmit Speed"},
1543   {51,  RADIUS_INTEGER4,                "Annex Receive Speed"},
1544   {52,  RADIUS_STRING,                  "Annex Input Filter"},
1545   {53,  RADIUS_STRING,                  "Annex Output Filter"},
1546   {54,  RADIUS_IP_ADDRESS,              "Annex Primary DNS Server"},
1547   {55,  RADIUS_IP_ADDRESS,              "Annex Secondary DNS Server"},
1548   {56,  RADIUS_IP_ADDRESS,              "Annex Primary NBNS Server"},
1549   {57,  RADIUS_IP_ADDRESS,              "Annex Secondary NBNS Server"},
1550   {58,  RADIUS_INTEGER4,                "Annex Syslog Tap"},
1551   {59,  RADIUS_INTEGER4,                "Annex Keypress Timeout"},
1552   {60,  RADIUS_INTEGER4,                "Annex Unauthenticated Time"},
1553   {61,  RADIUS_INTEGER4,                "Annex Re CHAP Timeout"},
1554   {62,  RADIUS_INTEGER4,                "Annex MRRU"},
1555   {63,  RADIUS_STRING,                  "Annex EDO"},
1556   {64,  RADIUS_INTEGER4,                "Annex PPP Trace Level"},
1557   {65,  RADIUS_INTEGER4,                "Annex Pre Input Octets"},
1558   {66,  RADIUS_INTEGER4,                "Annex Pre Output Octets"},
1559   {67,  RADIUS_INTEGER4,                "Annex Pre Input Packets"},
1560   {68,  RADIUS_INTEGER4,                "Annex Pre Output Packets"},
1561   {69,  RADIUS_INTEGER4,                "Annex Connect Progress"},
1562   {73,  RADIUS_INTEGER4,                "Annex Multicast Rate Limit"},
1563   {74,  RADIUS_INTEGER4,                "Annex Maximum Call Duration"},
1564   {75,  RADIUS_INTEGER4,                "Annex Multilink Id"},
1565   {76,  RADIUS_INTEGER4,                "Annex Num In Multilink"},
1566   {81,  RADIUS_INTEGER4,                "Annex Logical Channel Number"},
1567   {82,  RADIUS_INTEGER4,                "Annex Wan Number"},
1568   {83,  RADIUS_INTEGER4,                "Annex Port"},
1569   {85,  RADIUS_INTEGER4,                "Annex Pool Id"},
1570   {86,  RADIUS_STRING,                  "Annex Compression Protocol"},
1571   {87,  RADIUS_INTEGER4,                "Annex Transmitted Packets"},
1572   {88,  RADIUS_INTEGER4,                "Annex Retransmitted Packets"},
1573   {89,  RADIUS_INTEGER4,                "Annex Signal to Noise Ratio"},
1574   {90,  RADIUS_INTEGER4,                "Annex Retrain Requests Sent"},
1575   {91,  RADIUS_INTEGER4,                "Annex Retrain Requests Rcvd"},
1576   {92,  RADIUS_INTEGER4,                "Annex Rate Reneg Req Sent"},
1577   {93,  RADIUS_INTEGER4,                "Annex Rate Reneg Req Rcvd"},
1578   {94,  RADIUS_INTEGER4,                "Annex Begin Receive Line Level"},
1579   {95,  RADIUS_INTEGER4,                "Annex End Receive Line Level"},
1580   {96,  RADIUS_STRING,                  "Annex Begin Modulation"},
1581   {97,  RADIUS_STRING,                  "Annex Error Correction Prot"},
1582   {98,  RADIUS_STRING,                  "Annex End Modulation"},
1583   {100, BAY_USER_LEVEL,                 "Annex User Level"},
1584   {101, BAY_AUDIT_LEVEL,                "Annex Audit Level"},
1585   {0, 0, NULL},
1586 };
1587
1588 static value_string radius_vendor_bay_tunnel_authen_type_vals[] =
1589 {
1590   {0,   "none"},
1591   {1,   "kmd5 128"},
1592   {0, NULL}
1593 };
1594
1595 static value_string radius_vendor_bay_tunnel_authen_mode_vals[] =
1596 {
1597   {0,   "none"},
1598   {1,   "prefix suffix"},
1599   {0, NULL}
1600 };
1601
1602 static value_string radius_vendor_bay_user_server_location_vals[] =
1603 {
1604   {1,   "local"},
1605   {2,   "remote"},
1606   {0, NULL}
1607 };
1608
1609 static value_string radius_vendor_bay_system_disc_reason_vals[] =
1610 {
1611   {0,   "Unknown"},
1612   {1,   "Line disconnected"},
1613   {2,   "Dial failed"},
1614   {3,   "WAN manager error"},
1615   {4,   "Disconnect reset"},
1616   {5,   "Error from adm_notify"},
1617   {6,   "Modem down adm_notify"},
1618   {7,   "PPP protocol disconnect"},
1619   {8,   "Inactivity timer"},
1620   {9,   "CLI Hangup command"},
1621   {10,  "CLI last job"},
1622   {11,  "Session timeout"},
1623   {12,  "Slave termination"},
1624   {13,  "Abnormal termination"},
1625   {14,  "DCD wait failed"},
1626   {15,  "CLI inactivity"},
1627   {16,  "Admin port reset"},
1628   {17,  "CLI auth failed"},
1629   {18,  "Slave auth failed"},
1630   {19,  "PAP auth failed"},
1631   {20,  "CHAP auth failed"},
1632   {21,  "Local modem reset"},
1633   {22,  "Modem dead"},
1634   {23,  "PPP LCP failure"},
1635   {24,  "PPP IPCP failure"},
1636   {25,  "PPP IPXCP failure"},
1637   {26,  "PPP ATCP failure"},
1638   {27,  "PPP CCP failure"},
1639   {28,  "PPP MP failure"},
1640   {29,  "PPP IPCP timeout"},
1641   {30,  "PPP IPXCP timeout"},
1642   {31,  "PPP ATCP timeout"},
1643   {32,  "PPP CCP timeout"},
1644   {33,  "PPP MP timeout"},
1645   {34,  "PPP init failure"},
1646   {35,  "PPP Unknown"},
1647   {36,  "PPP Dialback failed"},
1648   {37,  "PPP Address In Use"},
1649   {38,  "PPP No device"},
1650   {39,  "PPP Modem hangup rcvd"},
1651   {40,  "PPP Hangup rcvd"},
1652   {41,  "PPP Termination rcvd"},
1653   {42,  "PPP Kill rcvd"},
1654   {43,  "PPP Time rcvd"},
1655   {44,  "PPP No memory"},
1656   {45,  "PPP Connection Abort"},
1657   {46,  "PPP VPN LCP failure"},
1658   {47,  "PPP VPN Auth failure"},
1659   {48,  "PPP MP invalid port"},
1660   {49,  "PPP Invalid device"},
1661   {50,  "PPP MMP bundle failure"},
1662   {51,  "DVS Registration failure"},
1663   {52,  "DVS Home agent dereg"},
1664   {53,  "DVS Tunnel no renew"},
1665   {54,  "DVS Tunnel expired"},
1666   {0, NULL}
1667 };
1668
1669 static value_string radius_vendor_bay_modem_disc_reason_vals[] =
1670 {
1671   {0,   "Unknown"},
1672   {1,   "Local disconnect"},
1673   {2,   "CD Timer Expired"},
1674   {4,   "Remote protocol disc"},
1675   {5,   "Clear down"},
1676   {6,   "Long Space disconnect"},
1677   {7,   "Carrier Lost"},
1678   {8,   "Modem Retrain Timeout"},
1679   {0, NULL}
1680 };
1681
1682 static value_string radius_vendor_bay_addr_resolution_protocol_vals[] =
1683 {
1684   {0,   "none"},
1685   {1,   "DHCP"},
1686   {0, NULL}
1687 };
1688
1689 static value_string radius_vendor_bay_user_level_vals[] =
1690 {
1691   {2,   "Manager"},
1692   {4,   "User"},
1693   {8,   "Operator"},
1694   {0, NULL}
1695 };
1696
1697 static value_string radius_vendor_bay_audit_level_vals[] =
1698 {
1699   {2,   "Manager"},
1700   {4,   "User"},
1701   {8,   "Operator"},
1702   {0, NULL}
1703 };
1704
1705 /*
1706 reference:
1707         'dictionary.foundry' file from FreeRADIUS
1708                 http://www.freeradius.org/radiusd/raddb/dictionary.foundry
1709 */
1710 static value_value_string radius_vendor_foundry_attrib[] =
1711 {
1712   {1,   RADIUS_INTEGER4,        "Foundry Privilege Level"},
1713   {2,   RADIUS_STRING,          "Foundry Command String"},
1714   {3,   RADIUS_INTEGER4,        "Foundry Command Exception Flag"},
1715   {0, 0, NULL},
1716 };
1717
1718 /*
1719 reference:
1720         'dictionary.versanet' file from FreeRADIUS
1721                 http://www.freeradius.org/radiusd/raddb/dictionary.versanet
1722 */
1723 static value_value_string radius_vendor_versanet_attrib[] =
1724 {
1725   {1,   VERSANET_TERMINATION_CAUSE,     "Versanet Termination Cause"},
1726   {0, 0, NULL},
1727 };
1728
1729 static value_string radius_vendor_versanet_termination_cause_vals[] =
1730 {
1731   {0,   "Normal Hangup No Error Occurred"},
1732   {3,   "Call Waiting Caused Disconnect"},
1733   {4,   "Physical Carrier Loss"},
1734   {5,   "No err correction at other end"},
1735   {6,   "No resp to feature negotiation"},
1736   {7,   "1st modem async only 2nd sync"},
1737   {8,   "No framing technique in common"},
1738   {9,   "No protocol in common"},
1739   {10,  "Bad resp to feature negotiation"},
1740   {11,  "No sync info from remote modem"},
1741   {12,  "Normal Hangup by Remote modem"},
1742   {13,  "Retransmission limit reached"},
1743   {14,  "Protocol violation occurred"},
1744   {15,  "Lost DTR"},
1745   {16,  "Received GSTN cleardown"},
1746   {17,  "Inactivity timeout"},
1747   {18,  "Speed not supported"},
1748   {19,  "Long space disconnect"},
1749   {20,  "Key abort disconnect"},
1750   {21,  "Clears previous disc reason"},
1751   {22,  "No connection established"},
1752   {23,  "Disconnect after three retrains"},
1753   {0, NULL}
1754 };
1755
1756 /*
1757 reference:
1758         'dictionary.redback' file from FreeRADIUS
1759                 http://www.freeradius.org/radiusd/raddb/dictionary.redback
1760 */
1761 static value_value_string radius_vendor_redback_attrib[] =
1762 {
1763   {1,   RADIUS_IP_ADDRESS,              "Client DNS Pri"},
1764   {2,   RADIUS_IP_ADDRESS,              "Client DNS Sec"},
1765   {3,   RADIUS_INTEGER4,                "DHCP Max Leases"},
1766   {4,   RADIUS_STRING,                  "Context Name"},
1767   {5,   RADIUS_STRING,                  "Bridge Group"},
1768   {6,   RADIUS_STRING,                  "BG Aging Time"},
1769   {7,   RADIUS_STRING,                  "BG Path Cost"},
1770   {8,   RADIUS_STRING,                  "BG Span Dis"},
1771   {9,   RADIUS_STRING,                  "BG Trans BPDU"},
1772   {10,  RADIUS_INTEGER4,                "Rate Limit Rate"},
1773   {11,  RADIUS_INTEGER4,                "Rate Limit Burst"},
1774   {12,  RADIUS_INTEGER4,                "Police Rate"},
1775   {13,  RADIUS_INTEGER4,                "Police Burst"},
1776   {14,  RADIUS_INTEGER4,                "Source Validation"},
1777   {15,  RADIUS_INTEGER4,                "Tunnel Domain"},
1778   {16,  RADIUS_STRING,                  "Tunnel Local Name"},
1779   {17,  RADIUS_STRING,                  "Tunnel Remote Name"},
1780   {18,  REDBACK_TUNNEL_FUNCTION,        "Tunnel Function"},
1781   {21,  RADIUS_INTEGER4,                "Tunnel Max Sessions"},
1782   {22,  RADIUS_INTEGER4,                "Tunnel Max Tunnels"},
1783   {23,  RADIUS_INTEGER4,                "Tunnel Session Auth"},
1784   {24,  RADIUS_INTEGER4,                "Tunnel Window"},
1785   {25,  RADIUS_INTEGER4,                "Tunnel Retransmit"},
1786   {26,  RADIUS_INTEGER4,                "Tunnel Cmd Timeout"},
1787   {27,  RADIUS_STRING,                  "PPPOE URL"},
1788   {28,  RADIUS_STRING,                  "PPPOE MOTM"},
1789   {29,  RADIUS_INTEGER4,                "Tunnel Group"},
1790   {30,  RADIUS_STRING,                  "Tunnel Context"},
1791   {31,  RADIUS_INTEGER4,                "Tunnel Algorithm"},
1792   {32,  RADIUS_INTEGER4,                "Tunnel Deadtime"},
1793   {33,  REDBACK_MCAST_SEND,             "Mcast Send"},
1794   {34,  REDBACK_MCAST_RECEIVE,          "Mcast Receive"},
1795   {35,  RADIUS_INTEGER4,                "Mcast MaxGroups"},
1796   {36,  RADIUS_STRING,                  "Ip Address Pool Name"},
1797   {37,  REDBACK_TUNNEL_DNIS,            "Tunnel DNIS"},
1798   {38,  RADIUS_INTEGER4,                "Medium Type"},
1799   {39,  REDBACK_PVC_ENCAPSULATION_TYPE, "PVC Encapsulation Type"},
1800   {40,  RADIUS_STRING,                  "PVC Profile Name"},
1801   {41,  REDBACK_PVC_CIRCUIT_PADDING,    "PVC Circuit Padding"},
1802   {42,  REDBACK_BIND_TYPE,              "Bind Type"},
1803   {43,  REDBACK_BIND_AUTH_PROTOCOL,     "Bind Auth Protocol"},
1804   {44,  RADIUS_INTEGER4,                "Bind Auth Max Sessions"},
1805   {45,  RADIUS_STRING,                  "Bind Bypass Bypass"},
1806   {46,  RADIUS_STRING,                  "Bind Auth Context"},
1807   {47,  RADIUS_STRING,                  "Bind Auth Service Grp"},
1808   {48,  RADIUS_STRING,                  "Bind Bypass Context"},
1809   {49,  RADIUS_STRING,                  "Bind Int Context"},
1810   {50,  RADIUS_STRING,                  "Bind Tun Context"},
1811   {51,  RADIUS_STRING,                  "Bind Ses Context"},
1812   {52,  RADIUS_INTEGER4,                "Bind Dot1q Slot"},
1813   {53,  RADIUS_INTEGER4,                "Bind Dot1q Port"},
1814   {54,  RADIUS_INTEGER4,                "Bind Dot1q Vlan Tag Id"},
1815   {55,  RADIUS_STRING,                  "Bind Int Interface Name"},
1816   {56,  RADIUS_STRING,                  "Bind L2TP Tunnel Name"},
1817   {57,  RADIUS_INTEGER4,                "Bind L2TP Flow Control"},
1818   {58,  RADIUS_STRING,                  "Bind Sub User At Context"},
1819   {59,  RADIUS_STRING,                  "Bind Sub Password"},
1820   {60,  RADIUS_STRING,                  "Ip Host Addr"},
1821   {61,  RADIUS_INTEGER4,                "IP TOS Field"},
1822   {62,  RADIUS_INTEGER4,                "NAS Real Port"},
1823   {63,  RADIUS_STRING,                  "Tunnel Session Auth Ctx"},
1824   {64,  RADIUS_STRING,                  "Tunnel Session Auth Service Grp"},
1825   {65,  RADIUS_INTEGER4,                "Tunnel Rate Limit Rate"},
1826   {66,  RADIUS_INTEGER4,                "Tunnel Rate Limit Burst"},
1827   {67,  RADIUS_INTEGER4,                "Tunnel Police Rate"},
1828   {68,  RADIUS_INTEGER4,                "Tunnel Police Burst"},
1829   {69,  RADIUS_STRING,                  "Tunnel L2F Second Password"},
1830   {128, RADIUS_INTEGER4,                "Acct Input Octets 64"},
1831   {129, RADIUS_INTEGER4,                "Acct Output Octets 64"},
1832   {130, RADIUS_INTEGER4,                "Acct Input Packets 64"},
1833   {131, RADIUS_INTEGER4,                "Acct Output Packets 64"},
1834   {132, RADIUS_IP_ADDRESS,              "Assigned IP Address"},
1835   {133, RADIUS_INTEGER4,                "Acct Mcast In Octets"},
1836   {134, RADIUS_INTEGER4,                "Acct Mcast Out Octets"},
1837   {135, RADIUS_INTEGER4,                "Acct Mcast In Packets"},
1838   {136, RADIUS_INTEGER4,                "Acct Mcast Out Packets"},
1839   {137, RADIUS_INTEGER4,                "LAC Port"},
1840   {138, RADIUS_INTEGER4,                "LAC Real Port"},
1841   {139, REDBACK_LAC_PORT_TYPE,          "LAC Port Type"},
1842   {140, REDBACK_LAC_REAL_PORT_TYPE,     "LAC Real Port Type"},
1843   {141, RADIUS_STRING,                  "Acct Dyn Ac Ent"},
1844   {142, RADIUS_INTEGER4,                "Session Error Code"},
1845   {143, RADIUS_STRING,                  "Session Error Msg"},
1846   {0, 0, NULL},
1847 };
1848
1849 static value_string radius_vendor_redback_tunnel_function_vals[] =
1850 {
1851   {1,   "LAC Only"},
1852   {2,   "LNS Only"},
1853   {3,   "LAC LNS"},
1854   {0, NULL}
1855 };
1856
1857 static value_string radius_vendor_redback_mcast_send_vals[] =
1858 {
1859   {1,   "NO SEND"},
1860   {2,   "SEND"},
1861   {3,   "UNSOLICITED SEND"},
1862   {0, NULL}
1863 };
1864
1865 static value_string radius_vendor_redback_mcast_receive_vals[] =
1866 {
1867   {1,   "NO RECEIVE"},
1868   {2,   "RECEIVE"},
1869   {0, NULL}
1870 };
1871
1872 static value_string radius_vendor_redback_tunnel_dnis_vals[] =
1873 {
1874   {1,   "DNIS"},
1875   {2,   "DNIS Only"},
1876   {0, NULL}
1877 };
1878
1879 static value_string radius_vendor_redback_pvc_encapsulation_type_vals[] =
1880 {
1881   {1,   "AAA ENCAPS ATM RAW"},
1882   {2,   "AAA ENCAPS ATM ROUTE1483"},
1883   {3,   "AAA ENCAPS ATM AUTO1483"},
1884   {4,   "AAA ENCAPS ATM MULTI"},
1885   {5,   "AAA ENCAPS ATM BRIDGE1483"},
1886   {6,   "AAA ENCAPS ATM PPP"},
1887   {7,   "AAA ENCAPS ATM PPP SERIAL"},
1888   {8,   "AAA ENCAPS ATM PPP NLPID"},
1889   {9,   "AAA ENCAPS ATM PPP AUTO"},
1890   {10,  "AAA ENCAPS ATM PPPOE"},
1891   {11,  "AAA ENCAPS ATM L2TP"},
1892   {12,  "AAA ENCAPS ATM PPP LLC"},
1893   {13,  "AAA ENCAPS FRAME AUTO1490"},
1894   {14,  "AAA ENCAPS FRAME MULTI"},
1895   {15,  "AAA ENCAPS FRAME BRIDGE1490"},
1896   {16,  "AAA ENCAPS FRAME PPP"},
1897   {17,  "AAA ENCAPS FRAME PPP AUTO"},
1898   {18,  "AAA ENCAPS FRAME PPPOE"},
1899   {19,  "AAA ENCAPS FRAME ROUTE1490"},
1900   {20,  "AAA ENCAPS FRAME L2TP"},
1901   {21,  "AAA ENCAPS L2TP VC MUXED"},
1902   {22,  "AAA ENCAPS ETH"},
1903   {23,  "AAA ENCAPS ETH PPPOE"},
1904   {24,  "AAA ENCAPS ETH MULTI"},
1905   {0, NULL}
1906 };
1907
1908 static value_string radius_vendor_redback_pvc_circuit_padding_vals[] =
1909 {
1910   {1,   "AAA CIRCUIT PADDING"},
1911   {2,   "AAA CIRCUIT NO PADDING"},
1912   {0, NULL}
1913 };
1914
1915 static value_string radius_vendor_redback_bind_type_vals[] =
1916 {
1917   {1,   "AAA AUTH BIND"},
1918   {2,   "AAA BYPASS BIND"},
1919   {3,   "AAA INTERFACE BIND"},
1920   {4,   "AAA SUBSCRIBE BIND"},
1921   {5,   "AAA TUNNEL BIND"},
1922   {6,   "AAA SESSION BIND"},
1923   {7,   "AAA Q8021 BIND"},
1924   {8,   "AAA MULTI BIND"},
1925   {0, NULL}
1926 };
1927
1928 static value_string radius_vendor_redback_bind_auth_protocol_vals[] =
1929 {
1930   {1,   "AAA PPP PAP"},
1931   {2,   "AAA PPP CHAP"},
1932   {3,   "AAA PPP CHAP WAIT"},
1933   {4,   "AAA PPP CHAP PAP"},
1934   {5,   "AAA PPP CHAP WAIT PAP"},
1935   {0, NULL}
1936 };
1937
1938 static value_string radius_vendor_redback_lac_port_type_vals[] =
1939 {
1940   {40,  "NAS PORT TYPE 10BT"},
1941   {41,  "NAS PORT TYPE 100BT"},
1942   {42,  "NAS PORT TYPE DS3 FR"},
1943   {43,  "NAS PORT TYPE DS3 ATM"},
1944   {44,  "NAS PORT TYPE OC3"},
1945   {45,  "NAS PORT TYPE HSSI"},
1946   {46,  "NAS PORT TYPE EIA530"},
1947   {47,  "NAS PORT TYPE T1"},
1948   {48,  "NAS PORT TYPE CHAN T3"},
1949   {49,  "NAS PORT TYPE DS1 FR"},
1950   {50,  "NAS PORT TYPE E3 ATM"},
1951   {51,  "NAS PORT TYPE IMA ATM"},
1952   {52,  "NAS PORT TYPE DS3 ATM 2"},
1953   {53,  "NAS PORT TYPE OC3 ATM 2"},
1954   {54,  "NAS PORT TYPE 1000BSX"},
1955   {55,  "NAS PORT TYPE E1 FR"},
1956   {56,  "NAS PORT TYPE E1 ATM"},
1957   {57,  "NAS PORT TYPE E3 FR"},
1958   {58,  "NAS PORT TYPE OC3 POS"},
1959   {59,  "NAS PORT TYPE OC12 POS"},
1960   {60,  "NAS PORT TYPE PPPOE"},
1961   {0, NULL}
1962 };
1963
1964 static value_string radius_vendor_redback_lac_real_port_type_vals[] =
1965 {
1966   {40,  "NAS PORT TYPE 10BT"},
1967   {41,  "NAS PORT TYPE 100BT"},
1968   {42,  "NAS PORT TYPE DS3 FR"},
1969   {43,  "NAS PORT TYPE DS3 ATM"},
1970   {44,  "NAS PORT TYPE OC3"},
1971   {45,  "NAS PORT TYPE HSSI"},
1972   {46,  "NAS PORT TYPE EIA530"},
1973   {47,  "NAS PORT TYPE T1"},
1974   {48,  "NAS PORT TYPE CHAN T3"},
1975   {49,  "NAS PORT TYPE DS1 FR"},
1976   {50,  "NAS PORT TYPE E3 ATM"},
1977   {51,  "NAS PORT TYPE IMA ATM"},
1978   {52,  "NAS PORT TYPE DS3 ATM 2"},
1979   {53,  "NAS PORT TYPE OC3 ATM 2"},
1980   {54,  "NAS PORT TYPE 1000BSX"},
1981   {55,  "NAS PORT TYPE E1 FR"},
1982   {56,  "NAS PORT TYPE E1 ATM"},
1983   {57,  "NAS PORT TYPE E3 FR"},
1984   {58,  "NAS PORT TYPE OC3 POS"},
1985   {59,  "NAS PORT TYPE OC12 POS"},
1986   {60,  "NAS PORT TYPE PPPOE"},
1987   {0, NULL}
1988 };
1989
1990 /*
1991 reference:
1992         http://www.juniper.net/techpubs/software/junos53/swconfig53-getting-started/html/sys-mgmt-authentication2.html
1993 */
1994 static value_value_string radius_vendor_juniper_attrib[] =
1995 {
1996   {1,   RADIUS_STRING,          "Juniper Local User Name"},
1997   {2,   RADIUS_STRING,          "Juniper Allow Commands"},
1998   {3,   RADIUS_STRING,          "Juniper Deny Commands"},
1999   {0, 0, NULL}
2000 };
2001
2002 /*
2003 reference:
2004         'dictionary.aptis' file from FreeRADIUS
2005                 http://www.freeradius.org/radiusd/raddb/dictionary.aptis
2006 */
2007 static value_value_string radius_vendor_aptis_attrib[] =
2008 {
2009   {1,   RADIUS_STRING,          "CVX Identification"},
2010   {2,   RADIUS_INTEGER4,        "CVX VPOP ID"},
2011   {3,   RADIUS_INTEGER4,        "CVX SS7 Session ID Type"},
2012   {4,   RADIUS_INTEGER4,        "CVX Radius Redirect"},
2013   {5,   RADIUS_INTEGER4,        "CVX IPSVC AZNLVL"},
2014   {6,   RADIUS_INTEGER4,        "CVX IPSVC Mask"},
2015   {7,   RADIUS_INTEGER4,        "CVX Multilink Match Info"},
2016   {8,   RADIUS_INTEGER4,        "CVX Multilink Group Number"},
2017   {9,   RADIUS_INTEGER4,        "CVX PPP Log Mask"},
2018   {10,  RADIUS_STRING,          "CVX Modem Begin Modulation"},
2019   {11,  RADIUS_STRING,          "CVX Modem End Modulation"},
2020   {12,  RADIUS_STRING,          "CVX Modem Error Correction"},
2021   {13,  RADIUS_STRING,          "CVX Modem Data Compression"},
2022   {14,  RADIUS_INTEGER4,        "CVX Modem Tx Packets"},
2023   {15,  RADIUS_INTEGER4,        "CVX Modem ReTx Packets"},
2024   {16,  RADIUS_INTEGER4,        "CVX Modem SNR"},
2025   {17,  RADIUS_INTEGER4,        "CVX Modem Local Retrains"},
2026   {18,  RADIUS_INTEGER4,        "CVX Modem Remote Retrains"},
2027   {19,  RADIUS_INTEGER4,        "CVX Modem Local Rate Negs"},
2028   {20,  RADIUS_INTEGER4,        "CVX Modem Remote Rate Negs"},
2029   {21,  RADIUS_INTEGER4,        "CVX Modem Begin Recv Line Lvl"},
2030   {22,  RADIUS_INTEGER4,        "CVX Modem End Recv Line Lvl"},
2031   {0, 0, NULL},
2032 };
2033
2034 static value_value_string radius_vendor_cosine_attrib[] =
2035 {
2036   {1,   RADIUS_STRING,          "Connection Profile Name"},
2037   {2,   RADIUS_STRING,          "Enterprise ID"},
2038   {3,   RADIUS_STRING,          "Address Pool Name"},
2039   {4,   RADIUS_INTEGER4,        "DS Byte"},
2040   {5,   COSINE_VPI_VCI,         "VPI/VCI"},
2041   {6,   RADIUS_INTEGER4,        "DLCI"},
2042   {7,   RADIUS_IP_ADDRESS,      "LNS IP Address"},
2043   {8,   RADIUS_STRING,          "CLI User Permission ID"},
2044   {0, 0, NULL}
2045 };
2046
2047 /*
2048 reference:
2049         'dictionary.shasta' file from FreeRADIUS
2050                 http://www.freeradius.org/radiusd/raddb/dictionary.shasta
2051 */
2052 static value_value_string radius_vendor_shasta_attrib[] =
2053 {
2054   {1,   SHASTA_USER_PRIVILEGE,  "Shasta User Privilege"},
2055   {2,   RADIUS_STRING,          "Shasta Service Profile"},
2056   {3,   RADIUS_STRING,          "Shasta VPN Name"},
2057   {0, 0, NULL},
2058 };
2059
2060 static value_string radius_vendor_shasta_user_privilege_vals[] =
2061 {
2062   {1,   "User"},
2063   {2,   "Super User"},
2064   {3,   "SSuper User"},
2065   {0, NULL}
2066 };
2067
2068 /*
2069 reference:
2070         'dictionary.nomadix' file from FreeRADIUS
2071                 http://www.freeradius.org/radiusd/raddb/dictionary.nomadix
2072 */
2073 static value_value_string radius_vendor_nomadix_attrib[] =
2074 {
2075   {1,   RADIUS_INTEGER4,        "Nomadix Bw Up"},
2076   {2,   RADIUS_INTEGER4,        "Nomadix Bw Down"},
2077   {0, 0, NULL},
2078 };
2079
2080 /*
2081 reference:
2082         'dictionary.erx' file from FreeRADIUS
2083                 http://www.freeradius.org/radiusd/raddb/dictionary.erx
2084 */
2085 static value_value_string radius_vendor_unisphere_attrib[] =
2086 {
2087   {1,   RADIUS_STRING,          "ERX Virtual Router Name"},
2088   {2,   RADIUS_STRING,          "ERX Address Pool Name"},
2089   {3,   RADIUS_STRING,          "ERX Local Loopback Interface"},
2090   {4,   RADIUS_IP_ADDRESS,      "ERX Primary Dns"},
2091   {5,   RADIUS_IP_ADDRESS,      "ERX Primary Wins"},
2092   {6,   RADIUS_IP_ADDRESS,      "ERX Secondary Dns"},
2093   {7,   RADIUS_IP_ADDRESS,      "ERX Secondary Wins"},
2094   {8,   RADIUS_STRING,          "ERX Tunnel Virtual Router"},
2095   {9,   RADIUS_STRING,          "ERX Tunnel Password"},
2096   {10,  RADIUS_STRING,          "ERX Ingress Policy Name"},
2097   {11,  RADIUS_STRING,          "ERX Egress Policy Name"},
2098   {12,  RADIUS_STRING,          "ERX Ingress Statistics"},
2099   {13,  RADIUS_STRING,          "ERX Egress Statistics"},
2100   {14,  RADIUS_STRING,          "ERX Atm Service Category"},
2101   {15,  RADIUS_STRING,          "ERX Atm PCR"},
2102   {16,  RADIUS_STRING,          "ERX Atm SCR"},
2103   {17,  RADIUS_STRING,          "ERX Atm MBS"},
2104   {18,  RADIUS_STRING,          "ERX Cli Initial Access Level"},
2105   {19,  RADIUS_INTEGER4,        "ERX Cli Allow All VR Access"},
2106   {20,  RADIUS_STRING,          "ERX Alternate Cli Access Level"},
2107   {21,  RADIUS_STRING,          "ERX Alternate Cli Vrouter Name"},
2108   {22,  RADIUS_INTEGER4,        "ERX Sa Validate"},
2109   {23,  RADIUS_INTEGER4,        "ERX Igmp Enable"},
2110   {0, 0, NULL},
2111 };
2112
2113 static value_value_string radius_vendor_issanni_attrib[] =
2114 {
2115   {1,   RADIUS_STRING,          "Softflow Template"},
2116   {2,   RADIUS_STRING,          "NAT Pool"},
2117   {3,   RADIUS_STRING,          "Virtual Routing Domain"},
2118   {4,   RADIUS_STRING,          "Tunnel Name"},
2119   {5,   RADIUS_STRING,          "IP Pool Name"},
2120   {6,   RADIUS_STRING,          "PPPoE URL"},
2121   {7,   RADIUS_STRING,          "PPPoE MOTM"},
2122   {8,   RADIUS_STRING,          "PPPoE Service"},
2123   {9,   RADIUS_IP_ADDRESS,      "Primary DNS"},
2124   {10,  RADIUS_IP_ADDRESS,      "Secondary DNS"},
2125   {11,  RADIUS_IP_ADDRESS,      "Primary NBNS"},
2126   {12,  RADIUS_IP_ADDRESS,      "Secondary NBNS"},
2127   {13,  RADIUS_STRING,          "Policing Traffic Class"},
2128   {14,  RADIUS_INTEGER4,        "Tunnel Type"},
2129   {15,  RADIUS_INTEGER4,        "NAT Type"},
2130   {16,  RADIUS_STRING,          "QoS Traffic Class"},
2131   {17,  RADIUS_STRING,          "Interface Name"},
2132   {0, 0, NULL}
2133 };
2134
2135 /*
2136 reference:
2137         'dictionary.quintum' file from FreeRADIUS
2138                 http://www.freeradius.org/radiusd/raddb/dictionary.quintum
2139 */
2140 static value_value_string radius_vendor_quintum_attrib[] =
2141 {
2142   {1,   RADIUS_STRING,          "Quintum AVPair"},
2143   {2,   RADIUS_STRING,          "Quintum NAS Port"},
2144   {23,  RADIUS_STRING,          "Quintum h323 remote address"},
2145   {24,  RADIUS_STRING,          "Quintum h323 conf id"},
2146   {25,  RADIUS_STRING,          "Quintum h323 setup time"},
2147   {26,  RADIUS_STRING,          "Quintum h323 call origin"},
2148   {27,  RADIUS_STRING,          "Quintum h323 call type"},
2149   {28,  RADIUS_STRING,          "Quintum h323 connect time"},
2150   {29,  RADIUS_STRING,          "Quintum h323 disconnect time"},
2151   {30,  RADIUS_STRING,          "Quintum h323 disconnect cause"},
2152   {31,  RADIUS_STRING,          "Quintum h323 voice quality"},
2153   {33,  RADIUS_STRING,          "Quintum h323 gw id"},
2154   {35,  RADIUS_STRING,          "Quintum h323 incoming conf id"},
2155   {101, RADIUS_STRING,          "Quintum h323 credit amount"},
2156   {102, RADIUS_STRING,          "Quintum h323 credit time"},
2157   {103, RADIUS_STRING,          "Quintum h323 return code"},
2158   {104, RADIUS_STRING,          "Quintum h323 prompt id"},
2159   {105, RADIUS_STRING,          "Quintum h323 time and day"},
2160   {106, RADIUS_STRING,          "Quintum h323 redirect number"},
2161   {107, RADIUS_STRING,          "Quintum h323 preferred lang"},
2162   {108, RADIUS_STRING,          "Quintum h323 redirect ip address"},
2163   {109, RADIUS_STRING,          "Quintum h323 billing model"},
2164   {110, RADIUS_STRING,          "Quintum h323 currency type"},
2165   {0, 0, NULL},
2166 };
2167
2168 /*
2169 reference:
2170         http://download.colubris.com/library/product_doc/CN3500_AdminGuide.pdf
2171 */
2172 static value_value_string radius_vendor_colubris_attrib[] =
2173 {
2174   {0,   RADIUS_STRING,          "Colubris AV Pair"},
2175   {0, 0, NULL},
2176 };
2177
2178 /*
2179 reference:
2180         'dictionary.columbia_university' file from FreeRADIUS
2181                 http://www.freeradius.org/radiusd/raddb/dictionary.columbia_university
2182 */
2183 static value_value_string radius_vendor_columbia_university_attrib[] =
2184 {
2185   {0,   COLUMBIA_UNIVERSITY_SIP_METHOD, "SIP Method"},
2186   {1,   RADIUS_STRING,                  "SIP From"},
2187   {2,   RADIUS_STRING,                  "SIP To"},
2188   {4,   RADIUS_STRING,                  "SIP Translated Request URI"},
2189   {0, 0, NULL},
2190 };
2191
2192 static value_string radius_vendor_columbia_university_sip_method_vals[] =
2193 {
2194   {0,   "INVITE"},
2195   {1,   "BYE"},
2196   {2,   "REGISTER"},
2197   {3,   "OTHER"},
2198   {0, NULL}
2199 };
2200
2201 static value_value_string radius_vendor_3gpp_attrib[] =
2202 {
2203    {5,  THE3GPP_QOS,    "QoS Profile"},
2204    {0, 0, NULL},
2205 };
2206
2207 static rd_vsa_table radius_vsa_table[] =
2208 {
2209   {VENDOR_ACC,                  radius_vendor_acc_attrib},
2210   {VENDOR_CISCO,                radius_vendor_cisco_attrib},
2211   {VENDOR_SHIVA,                radius_vendor_shiva_attrib},
2212   {VENDOR_LIVINGSTON,           radius_vendor_livingston_attrib},
2213   {VENDOR_MICROSOFT,            radius_vendor_microsoft_attrib},
2214   {VENDOR_ASCEND,               radius_vendor_ascend_attrib},
2215   {VENDOR_BAY,                  radius_vendor_bay_attrib},
2216   {VENDOR_FOUNDRY,              radius_vendor_foundry_attrib},
2217   {VENDOR_VERSANET,             radius_vendor_versanet_attrib},
2218   {VENDOR_REDBACK,              radius_vendor_redback_attrib},
2219   {VENDOR_JUNIPER,              radius_vendor_juniper_attrib},
2220   {VENDOR_APTIS,                radius_vendor_aptis_attrib},
2221   {VENDOR_COSINE,               radius_vendor_cosine_attrib},
2222   {VENDOR_SHASTA,               radius_vendor_shasta_attrib},
2223   {VENDOR_NOMADIX,              radius_vendor_nomadix_attrib},
2224   {VENDOR_UNISPHERE,            radius_vendor_unisphere_attrib},
2225   {VENDOR_ISSANNI,              radius_vendor_issanni_attrib},
2226   {VENDOR_QUINTUM,              radius_vendor_quintum_attrib},
2227   {VENDOR_COLUBRIS,             radius_vendor_colubris_attrib},
2228   {VENDOR_COLUMBIA_UNIVERSITY,  radius_vendor_columbia_university_attrib},
2229   {VENDOR_THE3GPP,              radius_vendor_3gpp_attrib},
2230   {0, NULL},
2231 };
2232
2233 /*
2234  * XXX - should these be read from files, such as FreeRadius dictionary
2235  * files?  For example, its "dictionary" file has entries such as
2236  *
2237  *      VALUE           Service-Type            Login-User              1
2238  *
2239  * to handle translation of integral values to strings.
2240  */
2241 static rd_valstr_table valstr_table[] =
2242 {
2243   {RADIUS_SERVICE_TYPE,                 radius_service_type_vals},
2244   {RADIUS_FRAMED_PROTOCOL,              radius_framed_protocol_vals},
2245   {RADIUS_FRAMED_ROUTING,               radius_framed_routing_vals},
2246   {RADIUS_FRAMED_COMPRESSION,           radius_framed_compression_vals},
2247   {RADIUS_LOGIN_SERVICE,                radius_login_service_vals},
2248   {RADIUS_TERMINATING_ACTION,           radius_terminating_action_vals},
2249   {RADIUS_ACCOUNTING_STATUS_TYPE,       radius_accounting_status_type_vals},
2250   {RADIUS_ACCT_AUTHENTIC,               radius_accounting_authentication_vals},
2251   {RADIUS_ACCT_TERMINATE_CAUSE,         radius_acct_terminate_cause_vals},
2252   {RADIUS_NAS_PORT_TYPE,                radius_nas_port_type_vals},
2253
2254   {ACC_REASON_CODE,                     radius_vendor_acc_reason_code_vals},
2255   {ACC_CCP_OPTION,                      radius_vendor_acc_ccp_option_vals},
2256   {ACC_ROUTE_POLICY,                    radius_vendor_acc_route_policy_vals},
2257   {ACC_ML_MLX_ADMIN_STATE,              radius_vendor_acc_ml_mlx_admin_state_vals},
2258   {ACC_CLEARING_CAUSE,                  q931_cause_code_vals},
2259   {ACC_CLEARING_LOCATION,               q931_cause_location_vals},
2260   {ACC_REQUEST_TYPE,                    radius_vendor_acc_request_type_vals},
2261   {ACC_BRIDGING_SUPPORT,                radius_vendor_acc_bridging_support_vals},
2262   {ACC_APSM_OVERSUBSCRIBED,             radius_vendor_acc_apsm_oversubscribed_vals},
2263   {ACC_ACCT_ON_OFF_REASON,              radius_vendor_acc_acct_on_off_reason_vals},
2264   {ACC_IP_COMPRESSION,                  radius_vendor_acc_ip_compression_vals},
2265   {ACC_IPX_COMPRESSION,                 radius_vendor_acc_ipx_compression_vals},
2266   {ACC_CALLBACK_MODE,                   radius_vendor_acc_callback_mode_vals},
2267   {ACC_CALLBACK_CBCP_TYPE,              radius_vendor_acc_callback_cbcp_type_vals},
2268   {ACC_DIALOUT_AUTH_MODE,               radius_vendor_acc_dialout_auth_mode_vals},
2269   {ACC_ACCESS_COMMUNITY,                radius_vendor_acc_access_community_vals},
2270
2271   {SHIVA_TYPE_OF_SERVICE,               radius_vendor_shiva_type_of_service_vals},
2272   {SHIVA_LINK_PROTOCOL,                 radius_vendor_shiva_link_protocol_vals},
2273   {SHIVA_DISCONNECT_REASON,             radius_vendor_shiva_disconnect_reason_vals},
2274   {SHIVA_FUNCTION,                      radius_vendor_shiva_function_vals},
2275   {SHIVA_CONNECT_REASON,                radius_vendor_shiva_connect_reason_vals},
2276
2277   {LIVINGSTON_IPSEC_LOG_OPTIONS,        radius_vendor_livingston_ipsec_log_options_vals},
2278   {LIVINGSTON_IPSEC_DENY_ACTION,        radius_vendor_livingston_ipsec_deny_action_vals},
2279   {LIVINGSTON_NAT_LOG_OPTIONS,          radius_vendor_livingston_nat_log_options_vals},
2280   {LIVINGSTON_NAT_SESS_DIR_FAIL_ACTION, radius_vendor_livingston_nat_sess_dir_fail_action_vals},
2281   {LIVINGSTON_MULTICAST_CLIENT,         radius_vendor_livingston_multicast_client_vals},
2282
2283   {CISCO_DISCONNECT_CAUSE,              radius_vendor_cisco_disconnect_cause_vals},
2284
2285   {MICROSOFT_BAP_USAGE,                 radius_vendor_microsoft_bap_usage_vals},
2286   {MICROSOFT_ARAP_PW_CHANGE_REASON,     radius_vendor_microsoft_arap_pw_change_reason_vals},
2287   {MICROSOFT_ACCT_AUTH_TYPE,            radius_vendor_microsoft_acct_auth_type_vals},
2288   {MICROSOFT_ACCT_EAP_TYPE,             radius_vendor_microsoft_acct_eap_type_vals},
2289
2290   {ASCEND_CALLING_ID_TYPE_OF_NUMBER,    radius_vendor_ascend_calling_id_type_of_number_vals},
2291   {ASCEND_CALLING_ID_NUMBERING_PLAN,    radius_vendor_ascend_calling_id_numbering_plan_vals},
2292   {ASCEND_CALLING_ID_PRESENTATION,      radius_vendor_ascend_calling_id_presentation_vals},
2293   {ASCEND_CALLING_ID_SCREENING,         radius_vendor_ascend_calling_id_screening_vals},
2294
2295   {BAY_TUNNEL_AUTHEN_TYPE,              radius_vendor_bay_tunnel_authen_type_vals},
2296   {BAY_TUNNEL_AUTHEN_MODE,              radius_vendor_bay_tunnel_authen_mode_vals},
2297   {BAY_USER_SERVER_LOCATION,            radius_vendor_bay_user_server_location_vals},
2298   {BAY_SYSTEM_DISC_REASON,              radius_vendor_bay_system_disc_reason_vals},
2299   {BAY_MODEM_DISC_REASON,               radius_vendor_bay_modem_disc_reason_vals},
2300   {BAY_ADDR_RESOLUTION_PROTOCOL,        radius_vendor_bay_addr_resolution_protocol_vals},
2301   {BAY_USER_LEVEL,                      radius_vendor_bay_user_level_vals},
2302   {BAY_AUDIT_LEVEL,                     radius_vendor_bay_audit_level_vals},
2303
2304   {VERSANET_TERMINATION_CAUSE,          radius_vendor_versanet_termination_cause_vals},
2305
2306   {REDBACK_TUNNEL_FUNCTION,             radius_vendor_redback_tunnel_function_vals},
2307   {REDBACK_MCAST_SEND,                  radius_vendor_redback_mcast_send_vals},
2308   {REDBACK_MCAST_RECEIVE,               radius_vendor_redback_mcast_receive_vals},
2309   {REDBACK_TUNNEL_DNIS,                 radius_vendor_redback_tunnel_dnis_vals},
2310   {REDBACK_PVC_ENCAPSULATION_TYPE,      radius_vendor_redback_pvc_encapsulation_type_vals},
2311   {REDBACK_PVC_CIRCUIT_PADDING,         radius_vendor_redback_pvc_circuit_padding_vals},
2312   {REDBACK_BIND_TYPE,                   radius_vendor_redback_bind_type_vals},
2313   {REDBACK_BIND_AUTH_PROTOCOL,          radius_vendor_redback_bind_auth_protocol_vals},
2314   {REDBACK_LAC_PORT_TYPE,               radius_vendor_redback_lac_port_type_vals},
2315   {REDBACK_LAC_REAL_PORT_TYPE,          radius_vendor_redback_lac_real_port_type_vals},
2316
2317   {SHASTA_USER_PRIVILEGE,               radius_vendor_shasta_user_privilege_vals},
2318
2319   {COLUMBIA_UNIVERSITY_SIP_METHOD,      radius_vendor_columbia_university_sip_method_vals},
2320
2321   {0, NULL}
2322 };
2323
2324 static rd_vsa_table *get_vsa_table(guint32 vendor)
2325 {
2326     guint32 i;
2327
2328     for (i = 0; radius_vsa_table[i].vendor; i++)
2329         if (radius_vsa_table[i].vendor == vendor)
2330             return(&radius_vsa_table[i]);
2331
2332     return(NULL);
2333 }
2334
2335 static guint32 match_numval(guint32 val, const value_value_string *vvs)
2336 {
2337     guint32 i;
2338
2339     for (i = 0; vvs && vvs[i].str; i++)
2340         if (vvs[i].val1 == val)
2341             return(vvs[i].val2);
2342
2343     return(0);
2344 }
2345
2346 static gchar textbuffer[TEXTBUFFER];
2347 static rd_vsa_buffer vsabuffer[VSABUFFER];
2348
2349 static void
2350 rdconvertbufftostr(gchar *dest, tvbuff_t *tvb, int offset, int length)
2351 {
2352 /*converts the raw buffer into printable text */
2353         guint32 i;
2354         guint32 totlen=0;
2355         const guint8 *pd = tvb_get_ptr(tvb, offset, length);
2356
2357         dest[0]='"';
2358         dest[1]=0;
2359         totlen=1;
2360         for (i=0; i < (guint32)length; i++)
2361         {
2362                 if( isalnum((int)pd[i])||ispunct((int)pd[i])
2363                                 ||((int)pd[i]==' '))            {
2364                         dest[totlen]=(gchar)pd[i];
2365                         totlen++;
2366                 }
2367                 else
2368                 {
2369                         sprintf(&(dest[totlen]), "\\%03o", pd[i]);
2370                         totlen=totlen+strlen(&(dest[totlen]));
2371                 }
2372         }
2373         dest[totlen]='"';
2374         dest[totlen+1]=0;
2375 }
2376
2377 static void
2378 rddecryptpass(gchar *dest,tvbuff_t *tvb,int offset,int length)
2379 {
2380     md5_state_t md_ctx;
2381     md5_byte_t digest[16];
2382     guint32 i;
2383     guint32 totlen;
2384     const guint8 *pd;
2385     guchar c;
2386
2387     if (shared_secret[0] == '\0' || !authenticator ) {
2388         rdconvertbufftostr(dest,tvb,offset,length);
2389         return;
2390     }
2391
2392     dest[0] = '"';
2393     dest[1] = '\0';
2394     totlen = 1;
2395
2396     md5_init(&md_ctx);
2397     md5_append(&md_ctx,shared_secret,strlen(shared_secret));
2398     md5_append(&md_ctx,authenticator,16);
2399     md5_finish(&md_ctx,digest);
2400
2401     pd = tvb_get_ptr(tvb,offset,length);
2402     for( i = 0 ; i < 16 && i < (guint32)length ; i++ ) {
2403         c = pd[i] ^ digest[i];
2404 #ifdef _WIN32
2405         /*
2406          * XXX - "isprint()" can return "true" for non-ASCII characters, but
2407          * those don't work with GTK+ on Windows, as GTK+ on Windows assumes
2408          * UTF-8 strings.  Until we fix up Ethereal to properly handle
2409          * non-ASCII characters in all output (both GUI displays and text
2410          * printouts) on all platforms including Windows, we work around
2411          * the problem by escaping all characters that aren't printable ASCII.
2412          */
2413         if ( c >= 0x20 && c <= 0x7f) {
2414 #else
2415         if ( isprint(c)) {
2416 #endif
2417             dest[totlen] = c;
2418             totlen++;
2419         } else {
2420             sprintf(&(dest[totlen]),"\\%03o",c);
2421             totlen += strlen(&(dest[totlen]));
2422         }
2423     }
2424     while(i<(guint32)length) {
2425 #ifdef _WIN32
2426         /*
2427          * XXX - "isprint()" can return "true" for non-ASCII characters, but
2428          * those don't work with GTK+ on Windows, as GTK+ on Windows assumes
2429          * UTF-8 strings.  Until we fix up Ethereal to properly handle
2430          * non-ASCII characters in all output (both GUI displays and text
2431          * printouts) on all platforms including Windows, we work around
2432          * the problem by escaping all characters that aren't printable ASCII.
2433          */
2434         if ( pd[i] >= 0x20 && pd[i] <= 0x7f) {
2435 #else
2436         if ( isprint(pd[i]) ) {
2437 #endif
2438             dest[totlen] = (gchar)pd[i];
2439             totlen++;
2440         } else {
2441             sprintf(&(dest[totlen]), "\\%03o", pd[i]);
2442             totlen=totlen+strlen(&(dest[totlen]));
2443         }
2444         i++;
2445     }
2446     dest[totlen]='"';
2447     dest[totlen+1] = '\0';
2448 }
2449
2450 static void
2451 rdconvertbufftobinstr(gchar *dest, tvbuff_t *tvb, int offset, int length)
2452 {
2453 /*converts the raw buffer into printable text */
2454         guint32 i;
2455         guint32 totlen=0;
2456         const guint8 *pd = tvb_get_ptr(tvb, offset, length);
2457         static const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
2458                                       '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
2459
2460         for (i=0; i < (guint32)length; i++)
2461         {
2462                 dest[totlen] = hex[pd[i] >> 4];
2463                 totlen++;
2464                 dest[totlen] = hex[pd[i] & 0xF];
2465                 totlen++;
2466         }
2467         dest[totlen]='\0';
2468 }
2469
2470 static gchar *rd_match_strval(guint32 val, const value_string *vs) {
2471         return val_to_str(val, vs, "Undefined");
2472 }
2473
2474 static gchar *rd_match_strval_attrib(guint32 val, const value_value_string *vvs)
2475 {
2476     guint32 i;
2477
2478     for (i = 0; vvs[i].str; i++)
2479         if (vvs[i].val1 == val)
2480             return(vvs[i].str);
2481
2482     return("Unknown Type");
2483 }
2484
2485 static gchar *rdconvertinttostr(gchar *dest, int print_type, guint32 val)
2486 {
2487     guint32 i;
2488     const value_string *vs = NULL;
2489
2490     for (i = 0; valstr_table[i].print_type; i++)
2491     {
2492         if (valstr_table[i].print_type == print_type)
2493         {
2494             vs = valstr_table[i].valstr;
2495             break;
2496         }
2497     }
2498     sprintf(dest, "%s(%u)", (vs ? rd_match_strval(val, vs) : "Undefined"), val);
2499
2500     return dest;
2501 }
2502
2503 /* NOTE: This function's signature has been changed with the addition of the
2504  * tree parameter at the end.
2505  *
2506  * The function behaves EXACTLY AS BEFORE for parameters which do not
2507  * imply THE3GPP_QOS; I had to change the signature because the function
2508  * decode_qos_umts() wants to write on the protocol tree :)
2509  *
2510  * If you think it is better to DUPLICATE the code copying decode_qos_umts
2511  * here, and adapting it, feel free; only keep in mind that changes will have
2512  * to be doubled if any bug is found.
2513  *
2514  * At last, forgive me if I've messed up some indentation...
2515  * */
2516 static gchar *rd_value_to_str_2(gchar *dest, const e_avphdr *avph, tvbuff_t *tvb,
2517                                 int offset, const value_value_string *vvs, proto_tree *tree)
2518 {
2519   int print_type;
2520
2521   /* Variable to peek which will be the next print_type for VENDOR-SPECIFIC
2522    * RADIUS attributes
2523    * */
2524   int next_print_type;
2525
2526   /* Temporary variable to perform some trick on the cont variable; again, this
2527    * is needed only when THE3GPP_QOS in involved.
2528    * */
2529   gchar *tmp_punt;
2530
2531   gchar *cont;
2532   value_string *valstrarr;
2533   guint32 intval;
2534   gint32 timeval;
2535   const guint8 *pd;
2536   guint8 tag;
2537
2538   int vsa_length;
2539   int vsa_len;
2540   int vsa_index;
2541   rd_vsa_table *vsa_rvt;
2542   const e_avphdr *vsa_avph;
2543
2544 /* prints the values of the attribute value pairs into a text buffer */
2545   print_type = match_numval(avph->avp_type, vvs);
2546
2547   /* Default begin */
2548   strcpy(dest, "Value:");
2549   cont=&dest[strlen(dest)];
2550   switch(print_type)
2551   {
2552         case( RADIUS_STRING ):
2553                 if ( avph->avp_type == 2 )  { /* User Password */
2554                     rddecryptpass(cont,tvb,offset+2,avph->avp_length-2);
2555                 } else {
2556                     rdconvertbufftostr(cont,tvb,offset+2,avph->avp_length-2);
2557                 }
2558                 break;
2559         case( RADIUS_BINSTRING ):
2560                 rdconvertbufftobinstr(cont,tvb,offset+2,avph->avp_length-2);
2561                 break;
2562         case( RADIUS_INTEGER4 ):
2563                 sprintf(cont,"%u", tvb_get_ntohl(tvb,offset+2));
2564                 break;
2565         case( RADIUS_IP_ADDRESS ):
2566                 ip_to_str_buf(tvb_get_ptr(tvb,offset+2,4),cont);
2567                 break;
2568         case( RADIUS_IPX_ADDRESS ):
2569                 pd = tvb_get_ptr(tvb,offset+2,4);
2570                 sprintf(cont,"%u:%u:%u:%u",(guint8)pd[offset+2],
2571                         (guint8)pd[offset+3],(guint8)pd[offset+4],
2572                         (guint8)pd[offset+5]);
2573         case( RADIUS_TUNNEL_TYPE ):
2574                 valstrarr=radius_tunnel_type_vals;
2575                 /* Tagged ? */
2576                 intval = tvb_get_ntohl(tvb,offset+2);
2577                 if (intval >> 24) {
2578                         sprintf(dest, "Tag:%u, Value:%s(%u)",
2579                                 intval >> 24,
2580                                 rd_match_strval(intval & 0xffffff,valstrarr),
2581                                 intval & 0xffffff);
2582                         break;
2583                 }
2584                 sprintf(cont, "%s(%u)", rd_match_strval(intval,valstrarr), intval);
2585                 break;
2586         case( RADIUS_TUNNEL_MEDIUM_TYPE ):
2587                 valstrarr=radius_tunnel_medium_type_vals;
2588                 intval = tvb_get_ntohl(tvb,offset+2);
2589                 /* Tagged ? */
2590                 if (intval >> 24) {
2591                         sprintf(dest, "Tag:%u, Value:%s(%u)",
2592                                 intval >> 24,
2593                                 rd_match_strval(intval & 0xffffff,valstrarr),
2594                                 intval & 0xffffff);
2595                         break;
2596                 }
2597                 sprintf(cont, "%s(%u)", rd_match_strval(intval,valstrarr), intval);
2598                 break;
2599         case( RADIUS_STRING_TAGGED ):
2600                 /* Tagged ? */
2601                 tag = tvb_get_guint8(tvb,offset+2);
2602                 if (tag <= 0x1f) {
2603                         sprintf(dest, "Tag:%u, Value:",
2604                                         tag);
2605                         cont=&cont[strlen(cont)];
2606                         rdconvertbufftostr(cont,tvb,offset+3,avph->avp_length-3);
2607                         break;
2608                 }
2609                 rdconvertbufftostr(cont,tvb,offset+2,avph->avp_length-2);
2610                 break;
2611         case ( RADIUS_VENDOR_SPECIFIC ):
2612                 valstrarr = radius_vendor_specific_vendors;
2613                 intval = tvb_get_ntohl(tvb,offset+2);
2614                 sprintf(dest, "Vendor:%s(%u)", rd_match_strval(intval,valstrarr), intval);
2615                 cont = &dest[strlen(dest)];
2616                 vsa_length = avph->avp_length;
2617                 vsa_len = 6;
2618                 vsa_index = 0;
2619                 vsa_rvt = get_vsa_table(intval);
2620                 do
2621                 {
2622                         vsa_avph = (const e_avphdr*)tvb_get_ptr(tvb, offset+vsa_len,
2623                                 avph->avp_length-vsa_len);
2624                         if (vsa_rvt)
2625                                 next_print_type = match_numval(vsa_avph->avp_type,
2626                                         vsa_rvt->attrib);
2627                         else
2628                                 next_print_type = 0;
2629                         cont = &cont[strlen(cont)+1];
2630                         tmp_punt = cont;
2631                         vsabuffer[vsa_index].str = cont;
2632                         vsabuffer[vsa_index].offset = offset+vsa_len;
2633                         vsabuffer[vsa_index].length = vsa_avph->avp_length;
2634                         sprintf(cont, "t:%s(%u) l:%u, ",
2635                                 (vsa_rvt
2636                                         ? rd_match_strval_attrib(vsa_avph->avp_type,vsa_rvt->attrib)
2637                                         : "Unknown Type"),
2638                                 vsa_avph->avp_type, vsa_avph->avp_length);
2639                         cont = &cont[strlen(cont)];
2640                         rd_value_to_str_2(cont, vsa_avph, tvb, offset+vsa_len,
2641                                 (vsa_rvt ? vsa_rvt->attrib : NULL), tree);
2642                         vsa_index++;
2643                         vsa_len += vsa_avph->avp_length;
2644                         if (next_print_type == THE3GPP_QOS )
2645                         {
2646                                 cont = tmp_punt;
2647                                 vsa_index--;
2648                                 vsabuffer[vsa_index].str = 0;
2649                         }
2650                 } while (vsa_length > vsa_len && vsa_index < VSABUFFER);
2651                 break;
2652         case( RADIUS_SERVICE_TYPE ):
2653         case( RADIUS_FRAMED_PROTOCOL ):
2654         case( RADIUS_FRAMED_ROUTING ):
2655         case( RADIUS_FRAMED_COMPRESSION ):
2656         case( RADIUS_LOGIN_SERVICE ):
2657         case( RADIUS_TERMINATING_ACTION ):
2658         case( RADIUS_ACCOUNTING_STATUS_TYPE ):
2659         case( RADIUS_ACCT_AUTHENTIC ):
2660         case( RADIUS_ACCT_TERMINATE_CAUSE ):
2661         case( RADIUS_NAS_PORT_TYPE ):
2662         case( ACC_REASON_CODE ):
2663         case( ACC_CCP_OPTION ):
2664         case( ACC_ROUTE_POLICY ):
2665         case( ACC_ML_MLX_ADMIN_STATE ):
2666         case( ACC_CLEARING_CAUSE ):
2667         case( ACC_CLEARING_LOCATION ):
2668         case( ACC_REQUEST_TYPE ):
2669         case( ACC_BRIDGING_SUPPORT ):
2670         case( ACC_APSM_OVERSUBSCRIBED ):
2671         case( ACC_ACCT_ON_OFF_REASON ):
2672         case( ACC_IP_COMPRESSION ):
2673         case( ACC_IPX_COMPRESSION ):
2674         case( ACC_CALLBACK_MODE ):
2675         case( ACC_CALLBACK_CBCP_TYPE ):
2676         case( ACC_DIALOUT_AUTH_MODE ):
2677         case( ACC_ACCESS_COMMUNITY ):
2678         case( CISCO_DISCONNECT_CAUSE ):
2679         case( SHIVA_TYPE_OF_SERVICE ):
2680         case( SHIVA_LINK_PROTOCOL ):
2681         case( SHIVA_DISCONNECT_REASON ):
2682         case( SHIVA_FUNCTION ):
2683         case( SHIVA_CONNECT_REASON ):
2684         case( LIVINGSTON_IPSEC_LOG_OPTIONS ):
2685         case( LIVINGSTON_IPSEC_DENY_ACTION ):
2686         case( LIVINGSTON_NAT_LOG_OPTIONS ):
2687         case( LIVINGSTON_NAT_SESS_DIR_FAIL_ACTION ):
2688         case( LIVINGSTON_MULTICAST_CLIENT ):
2689         case( MICROSOFT_BAP_USAGE ):
2690         case( MICROSOFT_ARAP_PW_CHANGE_REASON ):
2691         case( MICROSOFT_ACCT_AUTH_TYPE ):
2692         case( MICROSOFT_ACCT_EAP_TYPE ):
2693         case( ASCEND_CALLING_ID_TYPE_OF_NUMBER ):
2694         case( ASCEND_CALLING_ID_NUMBERING_PLAN ):
2695         case( ASCEND_CALLING_ID_PRESENTATION ):
2696         case( ASCEND_CALLING_ID_SCREENING ):
2697         case( BAY_TUNNEL_AUTHEN_TYPE ):
2698         case( BAY_TUNNEL_AUTHEN_MODE ):
2699         case( BAY_USER_SERVER_LOCATION ):
2700         case( BAY_SYSTEM_DISC_REASON ):
2701         case( BAY_MODEM_DISC_REASON ):
2702         case( BAY_ADDR_RESOLUTION_PROTOCOL ):
2703         case( BAY_USER_LEVEL ):
2704         case( BAY_AUDIT_LEVEL ):
2705         case( VERSANET_TERMINATION_CAUSE ):
2706         case( REDBACK_TUNNEL_FUNCTION ):
2707         case( REDBACK_MCAST_SEND ):
2708         case( REDBACK_MCAST_RECEIVE ):
2709         case( REDBACK_TUNNEL_DNIS ):
2710         case( REDBACK_PVC_ENCAPSULATION_TYPE ):
2711         case( REDBACK_PVC_CIRCUIT_PADDING ):
2712         case( REDBACK_BIND_TYPE ):
2713         case( REDBACK_BIND_AUTH_PROTOCOL ):
2714         case( REDBACK_LAC_PORT_TYPE ):
2715         case( REDBACK_LAC_REAL_PORT_TYPE ):
2716         case( SHASTA_USER_PRIVILEGE ):
2717         case( COLUMBIA_UNIVERSITY_SIP_METHOD ):
2718                 rdconvertinttostr(cont, print_type,tvb_get_ntohl(tvb,offset+2));
2719                 break;
2720         case( COSINE_VPI_VCI ):
2721                 sprintf(cont,"%u/%u",
2722                         tvb_get_ntohs(tvb,offset+2),
2723                         tvb_get_ntohs(tvb,offset+4));
2724                 break;
2725
2726         case( THE3GPP_QOS ):
2727                 /* Find the ponter to the already-built label
2728                  * */
2729                 tmp_punt = dest - 2;
2730                 while (*tmp_punt)
2731                         tmp_punt--;
2732                 tmp_punt++;
2733
2734                 /* Call decode_qos_umts from packet-gtp package
2735                  * */
2736                 decode_qos_umts(tvb, offset + 1, tree, tmp_punt, 3);
2737                 break;
2738
2739         case( RADIUS_TIMESTAMP ):
2740                 timeval=tvb_get_ntohl(tvb,offset+2);
2741                 sprintf(cont,"%d (%s)", timeval, abs_time_secs_to_str(timeval));
2742                 break;
2743         case( RADIUS_INTEGER4_TAGGED ):
2744                 intval = tvb_get_ntohl(tvb,offset+2);
2745                 /* Tagged ? */
2746                 if (intval >> 24) {
2747                         sprintf(cont, "Tag:%u, Value:%u",
2748                                 intval >> 24,
2749                                 intval & 0xffffff);
2750                         break;
2751                 }
2752                 sprintf(cont,"%u", intval);
2753                 break;
2754         case( RADIUS_UNKNOWN ):
2755         default:
2756                 strcpy(cont,"Unknown Value Type");
2757                 break;
2758   }
2759   cont=&cont[strlen(cont)];
2760   if (cont == dest) {
2761         strcpy(cont,"Unknown Value");
2762   }
2763   return dest;
2764 }
2765
2766 /* NOTE: This function's signature has been changed with the addition of the
2767  * tree parameter at the end. This is needed for 3GPP QoS handling; previous
2768  * behaviour has not been changed.
2769  * */
2770 static gchar *rd_value_to_str(
2771    e_avphdr *avph, tvbuff_t *tvb, int offset, proto_tree *tree)
2772 {
2773     int i;
2774
2775     for (i = 0; i < VSABUFFER; i++)
2776         vsabuffer[i].str = NULL;
2777     rd_value_to_str_2(textbuffer, avph, tvb, offset, radius_attrib, tree);
2778     return textbuffer;
2779 }
2780
2781 static void
2782 dissect_attribute_value_pairs(tvbuff_t *tvb, int offset,proto_tree *tree,
2783                                    int avplength,packet_info *pinfo)
2784 {
2785 /* adds the attribute value pairs to the tree */
2786   e_avphdr avph;
2787   gchar *avptpstrval;
2788   gchar *valstr;
2789   guint8 *reassembled_data = NULL;
2790   int reassembled_data_len = 0;
2791   int data_needed = 0;
2792
2793   if (avplength==0)
2794   {
2795     if (tree)
2796       proto_tree_add_text(tree, tvb,offset,0,"No Attribute Value Pairs Found");
2797     return;
2798   }
2799
2800   /*
2801    * In case we throw an exception, clean up whatever stuff we've
2802    * allocated (if any).
2803    */
2804   CLEANUP_PUSH(g_free, reassembled_data);
2805
2806   while (avplength > 0)
2807   {
2808     tvb_memcpy(tvb,(guint8 *)&avph,offset,sizeof(e_avphdr));
2809     avptpstrval = rd_match_strval_attrib(avph.avp_type, radius_attrib);
2810     if (avph.avp_length < 2) {
2811       /*
2812        * This AVP is bogus - the length includes the type and length
2813        * fields, so it must be >= 2.
2814        */
2815       if (tree) {
2816         proto_tree_add_text(tree, tvb, offset, avph.avp_length,
2817                             "t:%s(%u) l:%u (length not >= 2)",
2818                             avptpstrval, avph.avp_type, avph.avp_length);
2819       }
2820       break;
2821     }
2822
2823     if (avph.avp_type == 79) {  /* EAP Message */
2824       proto_item *ti;
2825       proto_tree *eap_tree = NULL;
2826       gint tvb_len;
2827       tvbuff_t *next_tvb;
2828       int data_len;
2829       int result;
2830
2831       if (tree) {
2832         ti = proto_tree_add_text(tree, tvb, offset, avph.avp_length,
2833                                  "t:%s(%u) l:%u",
2834                                  avptpstrval, avph.avp_type, avph.avp_length);
2835         eap_tree = proto_item_add_subtree(ti, ett_radius_eap);
2836       }
2837       tvb_len = tvb_length_remaining(tvb, offset+2);
2838       data_len = avph.avp_length-2;
2839       if (data_len < tvb_len)
2840         tvb_len = data_len;
2841       next_tvb = tvb_new_subset(tvb, offset+2, tvb_len, data_len);
2842
2843       /*
2844        * Set the columns non-writable, so that the packet list
2845        * shows this as an RADIUS packet, not as an EAP packet.
2846        */
2847       col_set_writable(pinfo->cinfo, FALSE);
2848
2849       /*
2850        * RFC 2869 says, in section 5.13, describing the EAP-Message
2851        * attribute:
2852        *
2853        *    The String field contains EAP packets, as defined in [3].  If
2854        *    multiple EAP-Message attributes are present in a packet their
2855        *    values should be concatenated; this allows EAP packets longer than
2856        *    253 octets to be passed by RADIUS.
2857        *
2858        * Do reassembly of EAP-Message attributes.
2859        */
2860
2861       /* Are we in the process of reassembling? */
2862       if (reassembled_data != NULL) {
2863         /* Yes - show this as an EAP fragment. */
2864         if (tree)
2865           proto_tree_add_text(eap_tree, next_tvb, 0, -1, "EAP fragment");
2866
2867         /*
2868          * Do we have all of the data in this fragment?
2869          */
2870         if (tvb_len >= data_len) {
2871           /*
2872            * Yes - add it to the reassembled data.
2873            */
2874           tvb_memcpy(next_tvb, reassembled_data + reassembled_data_len,
2875                      0, data_len);
2876           reassembled_data_len += data_len;
2877           data_needed -= data_len;
2878           if (data_needed <= 0) {
2879             /*
2880              * We got at least as much data as we needed; we're done
2881              * reassembling.
2882              * XXX - what if we got more?
2883              */
2884
2885             /*
2886              * Allocate a new tvbuff, referring to the reassembled payload.
2887              */
2888             next_tvb = tvb_new_real_data(reassembled_data, reassembled_data_len,
2889                                          reassembled_data_len);
2890
2891             /*
2892              * We have a tvbuff that refers to this data, so we shouldn't
2893              * free this data if we throw an exception; clear
2894              * "reassembled_data", so the cleanup handler won't free it.
2895              */
2896             reassembled_data = NULL;
2897             reassembled_data_len = 0;
2898             data_needed = 0;
2899
2900             /*
2901              * Arrange that the allocated packet data copy be freed when the
2902              * tvbuff is freed.
2903              */
2904             tvb_set_free_cb(next_tvb, g_free);
2905
2906             /*
2907              * Add the tvbuff to the list of tvbuffs to which the tvbuff we
2908              * were handed refers, so it'll get cleaned up when that tvbuff
2909              * is cleaned up.
2910              */
2911             tvb_set_child_real_data_tvbuff(tvb, next_tvb);
2912
2913             /* Add the defragmented data to the data source list. */
2914             add_new_data_source(pinfo, next_tvb, "Reassembled EAP");
2915
2916             /* Now dissect it. */
2917             call_dissector(eap_fragment_handle, next_tvb, pinfo, eap_tree);
2918           }
2919         }
2920       } else {
2921         /*
2922          * No - hand it to the dissector.
2923          */
2924         result = call_dissector(eap_fragment_handle, next_tvb, pinfo, eap_tree);
2925         if (result < 0) {
2926           /* This is only part of the full EAP packet; start reassembly. */
2927           proto_tree_add_text(eap_tree, next_tvb, 0, -1, "EAP fragment");
2928           reassembled_data_len = data_len;
2929           data_needed = -result;
2930           reassembled_data = g_malloc(reassembled_data_len + data_needed);
2931           tvb_memcpy(next_tvb, reassembled_data, 0, reassembled_data_len);
2932         }
2933       }
2934     } else {
2935       if (tree) {
2936         proto_item *ti;
2937         proto_tree *vsa_tree = NULL;
2938         int i;
2939         /* We pre-add a text and a subtree to allow 3GPP QoS decoding
2940          * to access the protocol tree.
2941          * */
2942         ti = proto_tree_add_text(tree, tvb, offset, avph.avp_length,
2943                             "t:%s(%u) l:%u",
2944                             avptpstrval, avph.avp_type, avph.avp_length);
2945         vsa_tree = proto_item_add_subtree(ti, ett_radius_vsa);
2946         valstr = rd_value_to_str(&avph, tvb, offset, vsa_tree);
2947         proto_item_append_text(ti, ", %s", valstr);
2948         for (i = 0; vsabuffer[i].str && i < VSABUFFER; i++)
2949             proto_tree_add_text(vsa_tree, tvb, vsabuffer[i].offset,
2950                                 vsabuffer[i].length, "%s", vsabuffer[i].str);
2951       }
2952     }
2953
2954     offset = offset+avph.avp_length;
2955     avplength = avplength-avph.avp_length;
2956   }
2957
2958   /*
2959    * Call the cleanup handler to free any reassembled data we haven't
2960    * attached to a tvbuff, and pop the handler.
2961    */
2962   CLEANUP_CALL_AND_POP;
2963 }
2964
2965 static void dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2966 {
2967   proto_tree *radius_tree = NULL, *avptree = NULL;
2968   proto_item *ti,*avptf;
2969   int rhlength;
2970   int rhcode;
2971   int rhident;
2972   int avplength,hdrlength;
2973   e_radiushdr rh;
2974
2975   gchar *codestrval;
2976
2977   if (check_col(pinfo->cinfo, COL_PROTOCOL))
2978         col_set_str(pinfo->cinfo, COL_PROTOCOL, "RADIUS");
2979   if (check_col(pinfo->cinfo, COL_INFO))
2980         col_clear(pinfo->cinfo, COL_INFO);
2981
2982   tvb_memcpy(tvb,(guint8 *)&rh,0,sizeof(e_radiushdr));
2983
2984   rhcode= (int)rh.rh_code;
2985   rhident= (int)rh.rh_ident;
2986   rhlength= (int)g_ntohs(rh.rh_pktlength);
2987   codestrval=  match_strval(rhcode,radius_vals);
2988   if (codestrval==NULL)
2989   {
2990         codestrval="Unknown Packet";
2991   }
2992   if (check_col(pinfo->cinfo, COL_INFO))
2993   {
2994         col_add_fstr(pinfo->cinfo,COL_INFO,"%s(%d) (id=%d, l=%d)",
2995                 codestrval, rhcode, rhident, rhlength);
2996   }
2997
2998   if (tree)
2999   {
3000         ti = proto_tree_add_item(tree,proto_radius, tvb, 0, rhlength, FALSE);
3001
3002         radius_tree = proto_item_add_subtree(ti, ett_radius);
3003
3004         proto_tree_add_uint(radius_tree,hf_radius_code, tvb, 0, 1,
3005                 rh.rh_code);
3006         proto_tree_add_uint_format(radius_tree,hf_radius_id, tvb, 1, 1,
3007                 rh.rh_ident, "Packet identifier: 0x%01x (%d)",
3008                         rhident,rhident);
3009
3010         proto_tree_add_uint(radius_tree, hf_radius_length, tvb,
3011                         2, 2, rhlength);
3012         if ( authenticator ) {
3013             g_free(authenticator);
3014         }
3015         authenticator = g_malloc(AUTHENTICATOR_LENGTH);
3016         if ( authenticator ) {
3017             memcpy(authenticator,tvb_get_ptr(tvb,4,AUTHENTICATOR_LENGTH),AUTHENTICATOR_LENGTH);
3018         }
3019         proto_tree_add_text(radius_tree, tvb, 4,
3020                         AUTHENTICATOR_LENGTH,
3021                          "Authenticator");
3022   }
3023
3024   hdrlength=RD_HDR_LENGTH+AUTHENTICATOR_LENGTH;
3025   avplength= rhlength -hdrlength;
3026
3027   if (avplength > 0) {
3028     /* list the attribute value pairs */
3029
3030     if (tree)
3031     {
3032       avptf = proto_tree_add_text(radius_tree,
3033                                   tvb,hdrlength,avplength,
3034                                   "Attribute value pairs");
3035       avptree = proto_item_add_subtree(avptf, ett_radius_avp);
3036     }
3037
3038     dissect_attribute_value_pairs(tvb, hdrlength, avptree, avplength, pinfo);
3039   }
3040 }
3041 /* registration with the filtering engine */
3042 void
3043 proto_register_radius(void)
3044 {
3045         static hf_register_info hf[] = {
3046                 { &hf_radius_code,
3047                 { "Code","radius.code", FT_UINT8, BASE_DEC, VALS(radius_vals), 0x0,
3048                         "", HFILL }},
3049
3050                 { &hf_radius_id,
3051                 { "Identifier", "radius.id", FT_UINT8, BASE_DEC, NULL, 0x0,
3052                         "", HFILL }},
3053
3054                 { &hf_radius_length,
3055                 { "Length","radius.length", FT_UINT16, BASE_DEC, NULL, 0x0,
3056                         "", HFILL }}
3057         };
3058         static gint *ett[] = {
3059                 &ett_radius,
3060                 &ett_radius_avp,
3061                 &ett_radius_eap,
3062                 &ett_radius_vsa,
3063         };
3064
3065         module_t *radius_module;
3066
3067         proto_radius = proto_register_protocol("Radius Protocol", "RADIUS",
3068             "radius");
3069         proto_register_field_array(proto_radius, hf, array_length(hf));
3070         proto_register_subtree_array(ett, array_length(ett));
3071         
3072         radius_module = prefs_register_protocol(proto_radius,NULL);
3073         prefs_register_string_preference(radius_module,"shared_secret","Shared Secret",
3074                                         "Shared secret used to decode User Passwords",
3075                                         &shared_secret);
3076 }
3077
3078 void
3079 proto_reg_handoff_radius(void)
3080 {
3081         dissector_handle_t radius_handle;
3082
3083         /*
3084          * Get a handle for the EAP fragment dissector.
3085          */
3086         eap_fragment_handle = find_dissector("eap_fragment");
3087
3088         radius_handle = create_dissector_handle(dissect_radius, proto_radius);
3089         dissector_add("udp.port", UDP_PORT_RADIUS, radius_handle);
3090         dissector_add("udp.port", UDP_PORT_RADIUS_NEW, radius_handle);
3091         dissector_add("udp.port", UDP_PORT_RADACCT, radius_handle);
3092         dissector_add("udp.port", UDP_PORT_RADACCT_NEW, radius_handle);
3093 }