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