1*7978SPeter.Dunlap@Sun.COM /* 2*7978SPeter.Dunlap@Sun.COM * CDDL HEADER START 3*7978SPeter.Dunlap@Sun.COM * 4*7978SPeter.Dunlap@Sun.COM * The contents of this file are subject to the terms of the 5*7978SPeter.Dunlap@Sun.COM * Common Development and Distribution License (the "License"). 6*7978SPeter.Dunlap@Sun.COM * You may not use this file except in compliance with the License. 7*7978SPeter.Dunlap@Sun.COM * 8*7978SPeter.Dunlap@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*7978SPeter.Dunlap@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*7978SPeter.Dunlap@Sun.COM * See the License for the specific language governing permissions 11*7978SPeter.Dunlap@Sun.COM * and limitations under the License. 12*7978SPeter.Dunlap@Sun.COM * 13*7978SPeter.Dunlap@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*7978SPeter.Dunlap@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*7978SPeter.Dunlap@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*7978SPeter.Dunlap@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*7978SPeter.Dunlap@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*7978SPeter.Dunlap@Sun.COM * 19*7978SPeter.Dunlap@Sun.COM * CDDL HEADER END 20*7978SPeter.Dunlap@Sun.COM */ 21*7978SPeter.Dunlap@Sun.COM /* 22*7978SPeter.Dunlap@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*7978SPeter.Dunlap@Sun.COM * Use is subject to license terms. 24*7978SPeter.Dunlap@Sun.COM */ 25*7978SPeter.Dunlap@Sun.COM 26*7978SPeter.Dunlap@Sun.COM #ifndef _RADIUS_PROTOCOL_H 27*7978SPeter.Dunlap@Sun.COM #define _RADIUS_PROTOCOL_H 28*7978SPeter.Dunlap@Sun.COM 29*7978SPeter.Dunlap@Sun.COM #ifdef __cplusplus 30*7978SPeter.Dunlap@Sun.COM extern "C" { 31*7978SPeter.Dunlap@Sun.COM #endif 32*7978SPeter.Dunlap@Sun.COM 33*7978SPeter.Dunlap@Sun.COM /* Packet type. RFC 2865 section 4. */ 34*7978SPeter.Dunlap@Sun.COM #define RAD_ACCESS_REQ 1 /* Authentication Request */ 35*7978SPeter.Dunlap@Sun.COM #define RAD_ACCESS_ACPT 2 /* Authentication Accepted */ 36*7978SPeter.Dunlap@Sun.COM #define RAD_ACCESS_REJ 3 /* Authentication Rejected */ 37*7978SPeter.Dunlap@Sun.COM 38*7978SPeter.Dunlap@Sun.COM /* RADIUS Attribute Types. RFC 2865 section 5. */ 39*7978SPeter.Dunlap@Sun.COM #define RAD_USER_NAME 1 40*7978SPeter.Dunlap@Sun.COM #define RAD_CHAP_PASSWORD 3 41*7978SPeter.Dunlap@Sun.COM #define RAD_CHAP_CHALLENGE 60 42*7978SPeter.Dunlap@Sun.COM 43*7978SPeter.Dunlap@Sun.COM /* RFC 2865 Section 3. The Identifier field is one octet. */ 44*7978SPeter.Dunlap@Sun.COM #define RAD_IDENTIFIER_LEN 1 45*7978SPeter.Dunlap@Sun.COM 46*7978SPeter.Dunlap@Sun.COM /* RFC 2865 Section 5.3. The String field is 16 octets. */ 47*7978SPeter.Dunlap@Sun.COM #define RAD_CHAP_PASSWD_STR_LEN 16 48*7978SPeter.Dunlap@Sun.COM 49*7978SPeter.Dunlap@Sun.COM /* RFC 2865 Section 3. Authenticator field is 16 octets. */ 50*7978SPeter.Dunlap@Sun.COM #define RAD_AUTHENTICATOR_LEN 16 51*7978SPeter.Dunlap@Sun.COM 52*7978SPeter.Dunlap@Sun.COM /* RFC 2865 Section 5: 1-253 octets */ 53*7978SPeter.Dunlap@Sun.COM #define MAX_RAD_ATTR_VALUE_LEN 253 54*7978SPeter.Dunlap@Sun.COM 55*7978SPeter.Dunlap@Sun.COM /* RFC 2865 Section 3. Minimum length 20 octets. */ 56*7978SPeter.Dunlap@Sun.COM #define MIN_RAD_PACKET_LEN 20 57*7978SPeter.Dunlap@Sun.COM 58*7978SPeter.Dunlap@Sun.COM /* RFC 2865 Section 3. Maximum length 4096 octets. */ 59*7978SPeter.Dunlap@Sun.COM #define MAX_RAD_PACKET_LEN 4096 60*7978SPeter.Dunlap@Sun.COM 61*7978SPeter.Dunlap@Sun.COM /* Maximum RADIUS shared secret length (in fact there is no defined limit) */ 62*7978SPeter.Dunlap@Sun.COM #define MAX_RAD_SHARED_SECRET_LEN 128 63*7978SPeter.Dunlap@Sun.COM 64*7978SPeter.Dunlap@Sun.COM /* RFC 2865 Section 3. Minimum RADIUS shared secret length */ 65*7978SPeter.Dunlap@Sun.COM #define MIN_RAD_SHARED_SECRET_LEN 16 66*7978SPeter.Dunlap@Sun.COM 67*7978SPeter.Dunlap@Sun.COM /* Raw RADIUS packet. RFC 2865 section 3. */ 68*7978SPeter.Dunlap@Sun.COM typedef struct radius_packet { 69*7978SPeter.Dunlap@Sun.COM uint8_t code; /* RADIUS code, section 3, RFC 2865 */ 70*7978SPeter.Dunlap@Sun.COM uint8_t identifier; /* 1 octet in length. RFC 2865 section 3 */ 71*7978SPeter.Dunlap@Sun.COM uint8_t length[2]; /* 2 octets, or sizeof (u_short) */ 72*7978SPeter.Dunlap@Sun.COM uint8_t authenticator[RAD_AUTHENTICATOR_LEN]; 73*7978SPeter.Dunlap@Sun.COM uint8_t data[1]; 74*7978SPeter.Dunlap@Sun.COM } radius_packet_t; 75*7978SPeter.Dunlap@Sun.COM 76*7978SPeter.Dunlap@Sun.COM /* Length of a RADIUS packet minus the payload */ 77*7978SPeter.Dunlap@Sun.COM #define RAD_PACKET_HDR_LEN 20 78*7978SPeter.Dunlap@Sun.COM 79*7978SPeter.Dunlap@Sun.COM #ifdef __cplusplus 80*7978SPeter.Dunlap@Sun.COM } 81*7978SPeter.Dunlap@Sun.COM #endif 82*7978SPeter.Dunlap@Sun.COM 83*7978SPeter.Dunlap@Sun.COM #endif /* _RADIUS_PROTOCOL_H */ 84