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