fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _RADIUS_PROTOCOL_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _RADIUS_PROTOCOL_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Packet type. RFC 2865 section 4. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_ACCESS_REQ 1 /* Authentication Request */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_ACCESS_ACPT 2 /* Authentication Accepted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_ACCESS_REJ 3 /* Authentication Rejected */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* RADIUS Attribute Types. RFC 2865 section 5. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_USER_NAME 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_CHAP_PASSWORD 3
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_CHAP_CHALLENGE 60
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* RFC 2865 Section 3. The Identifier field is one octet. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_IDENTIFIER_LEN 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* RFC 2865 Section 5.3. The String field is 16 octets. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_CHAP_PASSWD_STR_LEN 16
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* RFC 2865 Section 3. Authenticator field is 16 octets. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_AUTHENTICATOR_LEN 16
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* RFC 2865 Section 5: 1-253 octets */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_RAD_ATTR_VALUE_LEN 253
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* RFC 2865 Section 3. Minimum length 20 octets. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MIN_RAD_PACKET_LEN 20
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* RFC 2865 Section 3. Maximum length 4096 octets. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_RAD_PACKET_LEN 4096
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Maximum RADIUS shared secret length (in fact there is no defined limit) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_RAD_SHARED_SECRET_LEN 128
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* RFC 2865 Section 3. Minimum RADIUS shared secret length */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MIN_RAD_SHARED_SECRET_LEN 16
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Raw RADIUS packet. RFC 2865 section 3. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct radius_packet {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t code; /* RADIUS code, section 3, RFC 2865 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t identifier; /* 1 octet in length. RFC 2865 section 3 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t length[2]; /* 2 octets, or sizeof (u_short) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t authenticator[RAD_AUTHENTICATOR_LEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t data[1];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} radius_packet_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Length of a RADIUS packet minus the payload */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RAD_PACKET_HDR_LEN 20
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _RADIUS_PROTOCOL_H */