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