xref: /freebsd/lib/libradius/radlib.h (revision 6e8394b8baa7d5d9153ab90de6824bcd19b3b4e1)
1 /*-
2  * Copyright 1998 Juniper Networks, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  *	$FreeBSD$
27  */
28 
29 #ifndef _RADLIB_H_
30 #define _RADLIB_H_
31 
32 #include <sys/types.h>
33 #include <netinet/in.h>
34 
35 /* Message types */
36 #define RAD_ACCESS_REQUEST		1
37 #define RAD_ACCESS_ACCEPT		2
38 #define RAD_ACCESS_REJECT		3
39 #define RAD_ACCESS_CHALLENGE		11
40 
41 /* Attribute types and values */
42 #define RAD_USER_NAME			1	/* String */
43 #define RAD_USER_PASSWORD		2	/* String */
44 #define RAD_CHAP_PASSWORD		3	/* String */
45 #define RAD_NAS_IP_ADDRESS		4	/* IP address */
46 #define RAD_NAS_PORT			5	/* Integer */
47 #define RAD_SERVICE_TYPE		6	/* Integer */
48 	#define RAD_LOGIN			1
49 	#define RAD_FRAMED			2
50 	#define RAD_CALLBACK_LOGIN		3
51 	#define RAD_CALLBACK_FRAMED		4
52 	#define RAD_OUTBOUND			5
53 	#define RAD_ADMINISTRATIVE		6
54 	#define RAD_NAS_PROMPT			7
55 	#define RAD_AUTHENTICATE_ONLY		8
56 	#define RAD_CALLBACK_NAS_PROMPT		9
57 #define RAD_FRAMED_PROTOCOL		7	/* Integer */
58 	#define RAD_PPP				1
59 	#define RAD_SLIP			2
60 	#define RAD_ARAP			3	/* Appletalk */
61 	#define RAD_GANDALF			4
62 	#define RAD_XYLOGICS			5
63 #define RAD_FRAMED_IP_ADDRESS		8	/* IP address */
64 #define RAD_FRAMED_IP_NETMASK		9	/* IP address */
65 #define RAD_FRAMED_ROUTING		10	/* Integer */
66 #define RAD_FILTER_ID			11	/* String */
67 #define RAD_FRAMED_MTU			12	/* Integer */
68 #define RAD_FRAMED_COMPRESSION		13	/* Integer */
69 #define RAD_LOGIN_IP_HOST		14	/* IP address */
70 #define RAD_LOGIN_SERVICE		15	/* Integer */
71 #define RAD_LOGIN_TCP_PORT		16	/* Integer */
72      /* unassiged			17 */
73 #define RAD_REPLY_MESSAGE		18	/* String */
74 #define RAD_CALLBACK_NUMBER		19	/* String */
75 #define RAD_CALLBACK_ID			20	/* String */
76      /* unassiged			21 */
77 #define RAD_FRAMED_ROUTE		22	/* String */
78 #define RAD_FRAMED_IPX_NETWORK		23	/* IP address */
79 #define RAD_STATE			24	/* String */
80 #define RAD_CLASS			25	/* Integer */
81 #define RAD_VENDOR_SPECIFIC		26	/* Integer */
82 #define RAD_SESSION_TIMEOUT		27	/* Integer */
83 #define RAD_IDLE_TIMEOUT		28	/* Integer */
84 #define RAD_TERMINATION_ACTION		29	/* Integer */
85 #define RAD_CALLED_STATION_ID		30	/* String */
86 #define RAD_CALLING_STATION_ID		31	/* String */
87 #define RAD_NAS_IDENTIFIER		32	/* Integer */
88 #define RAD_PROXY_STATE			33	/* Integer */
89 #define RAD_LOGIN_LAT_SERVICE		34	/* Integer */
90 #define RAD_LOGIN_LAT_NODE		35	/* Integer */
91 #define RAD_LOGIN_LAT_GROUP		36	/* Integer */
92 #define RAD_FRAMED_APPLETALK_LINK	37	/* Integer */
93 #define RAD_FRAMED_APPLETALK_NETWORK	38	/* Integer */
94 #define RAD_FRAMED_APPLETALK_ZONE	39	/* Integer */
95      /* reserved for accounting		40-59 */
96 #define RAD_CHAP_CHALLENGE		60	/* String */
97 #define RAD_NAS_PORT_TYPE		61	/* Integer */
98 #define RAD_PORT_LIMIT			62	/* Integer */
99 #define RAD_LOGIN_LAT_PORT		63	/* Integer */
100 
101 struct rad_handle;
102 struct timeval;
103 
104 __BEGIN_DECLS
105 int			 rad_add_server(struct rad_handle *,
106 			    const char *, int, const char *, int, int);
107 void			 rad_close(struct rad_handle *);
108 int			 rad_config(struct rad_handle *, const char *);
109 int			 rad_continue_send_request(struct rad_handle *, int,
110 			    int *, struct timeval *);
111 int			 rad_create_request(struct rad_handle *, int);
112 struct in_addr		 rad_cvt_addr(const void *);
113 u_int32_t		 rad_cvt_int(const void *);
114 char			*rad_cvt_string(const void *, size_t);
115 int			 rad_get_attr(struct rad_handle *, const void **,
116 			    size_t *);
117 int			 rad_init_send_request(struct rad_handle *, int *,
118 			    struct timeval *);
119 struct rad_handle	*rad_open(void);
120 int			 rad_put_addr(struct rad_handle *, int, struct in_addr);
121 int			 rad_put_attr(struct rad_handle *, int,
122 			    const void *, size_t);
123 int			 rad_put_int(struct rad_handle *, int, u_int32_t);
124 int			 rad_put_string(struct rad_handle *, int,
125 			    const char *);
126 int			 rad_send_request(struct rad_handle *);
127 const char		*rad_strerror(struct rad_handle *);
128 __END_DECLS
129 
130 #endif /* _RADLIB_H_ */
131