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