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