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