radlib.h revision 41119
1178023Semax/*-
2178023Semax * Copyright 1998 Juniper Networks, Inc.
3178023Semax * All rights reserved.
4178023Semax *
5178023Semax * Redistribution and use in source and binary forms, with or without
6178023Semax * modification, are permitted provided that the following conditions
7178023Semax * are met:
8178023Semax * 1. Redistributions of source code must retain the above copyright
9178023Semax *    notice, this list of conditions and the following disclaimer.
10178023Semax * 2. Redistributions in binary form must reproduce the above copyright
11178023Semax *    notice, this list of conditions and the following disclaimer in the
12178023Semax *    documentation and/or other materials provided with the distribution.
13178023Semax *
14230099Sdougb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15178023Semax * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16178023Semax * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17178023Semax * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18178023Semax * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19178023Semax * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20178023Semax * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21178023Semax * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22178023Semax * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23178023Semax * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24178023Semax * SUCH DAMAGE.
25178023Semax *
26178023Semax *	$FreeBSD: head/lib/libradius/radlib.h 41119 1998-11-13 00:53:01Z jdp $
27178023Semax */
28178023Semax
29178023Semax#ifndef _RADLIB_H_
30178023Semax#define _RADLIB_H_
31178023Semax
32178023Semax#include <sys/types.h>
33178023Semax#include <netinet/in.h>
34178023Semax
35178023Semax/* Message types */
36178023Semax#define RAD_ACCESS_REQUEST		1
37178023Semax#define RAD_ACCESS_ACCEPT		2
38178023Semax#define RAD_ACCESS_REJECT		3
39178023Semax#define RAD_ACCESS_CHALLENGE		11
40178023Semax
41178023Semax/* Attribute types and values */
42178023Semax#define RAD_USER_NAME			1	/* String */
43178023Semax#define RAD_USER_PASSWORD		2	/* String */
44178023Semax#define RAD_CHAP_PASSWORD		3	/* String */
45178023Semax#define RAD_NAS_IP_ADDRESS		4	/* IP address */
46178023Semax#define RAD_NAS_PORT			5	/* Integer */
47178023Semax#define RAD_SERVICE_TYPE		6	/* Integer */
48178023Semax	#define RAD_LOGIN			1
49208060Sdougb	#define RAD_FRAMED			2
50178023Semax	#define RAD_CALLBACK_LOGIN		3
51178023Semax	#define RAD_CALLBACK_FRAMED		4
52178023Semax	#define RAD_OUTBOUND			5
53178023Semax	#define RAD_ADMINISTRATIVE		6
54178023Semax	#define RAD_NAS_PROMPT			7
55178023Semax	#define RAD_AUTHENTICATE_ONLY		8
56178023Semax	#define RAD_CALLBACK_NAS_PROMPT		9
57178023Semax#define RAD_FRAMED_PROTOCOL		7	/* Integer */
58208060Sdougb	#define RAD_PPP				1
59178023Semax	#define RAD_SLIP			2
60178023Semax	#define RAD_ARAP			3	/* Appletalk */
61178023Semax	#define RAD_GANDALF			4
62178023Semax	#define RAD_XYLOGICS			5
63178023Semax#define RAD_FRAMED_IP_ADDRESS		8	/* IP address */
64178023Semax#define RAD_FRAMED_IP_NETMASK		9	/* IP address */
65178023Semax#define RAD_FRAMED_ROUTING		10	/* Integer */
66178023Semax#define RAD_FILTER_ID			11	/* String */
67178023Semax#define RAD_FRAMED_MTU			12	/* Integer */
68178023Semax#define RAD_FRAMED_COMPRESSION		13	/* Integer */
69178023Semax#define RAD_LOGIN_IP_HOST		14	/* IP address */
70178023Semax#define RAD_LOGIN_SERVICE		15	/* Integer */
71178023Semax#define RAD_LOGIN_TCP_PORT		16	/* Integer */
72178023Semax     /* unassiged			17 */
73178023Semax#define RAD_REPLY_MESSAGE		18	/* String */
74178023Semax#define RAD_CALLBACK_NUMBER		19	/* String */
75178023Semax#define RAD_CALLBACK_ID			20	/* String */
76178023Semax     /* unassiged			21 */
77178023Semax#define RAD_FRAMED_ROUTE		22	/* String */
78178023Semax#define RAD_FRAMED_IPX_NETWORK		23	/* IP address */
79178023Semax#define RAD_STATE			24	/* String */
80178023Semax#define RAD_CLASS			25	/* Integer */
81178023Semax#define RAD_VENDOR_SPECIFIC		26	/* Integer */
82178023Semax#define RAD_SESSION_TIMEOUT		27	/* Integer */
83178023Semax#define RAD_IDLE_TIMEOUT		28	/* Integer */
84178023Semax#define RAD_TERMINATION_ACTION		29	/* Integer */
85178023Semax#define RAD_CALLED_STATION_ID		30	/* String */
86178023Semax#define RAD_CALLING_STATION_ID		31	/* String */
87178023Semax#define RAD_NAS_IDENTIFIER		32	/* Integer */
88178023Semax#define RAD_PROXY_STATE			33	/* Integer */
89178023Semax#define RAD_LOGIN_LAT_SERVICE		34	/* Integer */
90178023Semax#define RAD_LOGIN_LAT_NODE		35	/* Integer */
91178023Semax#define RAD_LOGIN_LAT_GROUP		36	/* Integer */
92178023Semax#define RAD_FRAMED_APPLETALK_LINK	37	/* Integer */
93178023Semax#define RAD_FRAMED_APPLETALK_NETWORK	38	/* Integer */
94178023Semax#define RAD_FRAMED_APPLETALK_ZONE	39	/* Integer */
95178023Semax     /* reserved for accounting		40-59 */
96178023Semax#define RAD_CHAP_CHALLENGE		60	/* String */
97178023Semax#define RAD_NAS_PORT_TYPE		61	/* Integer */
98178023Semax#define RAD_PORT_LIMIT			62	/* Integer */
99178023Semax#define RAD_LOGIN_LAT_PORT		63	/* Integer */
100178023Semax
101178023Semaxstruct rad_handle;
102178023Semax
103178023Semax__BEGIN_DECLS
104178023Semaxint			 rad_add_server(struct rad_handle *,
105178023Semax			    const char *, int, const char *, int, int);
106178023Semaxvoid			 rad_close(struct rad_handle *);
107178023Semaxint			 rad_config(struct rad_handle *, const char *);
108178023Semaxint			 rad_create_request(struct rad_handle *, int);
109178023Semaxstruct in_addr		 rad_cvt_addr(const void *);
110178023Semaxu_int32_t		 rad_cvt_int(const void *);
111178023Semaxchar			*rad_cvt_string(const void *, size_t);
112178023Semaxint			 rad_get_attr(struct rad_handle *, const void **,
113178023Semax			    size_t *);
114178023Semaxstruct rad_handle	*rad_open(void);
115178023Semaxint			 rad_put_addr(struct rad_handle *, int, struct in_addr);
116178023Semaxint			 rad_put_attr(struct rad_handle *, int,
117178023Semax			    const void *, size_t);
118178023Semaxint			 rad_put_int(struct rad_handle *, int, u_int32_t);
119178023Semaxint			 rad_put_string(struct rad_handle *, int,
120178023Semax			    const char *);
121178023Semaxint			 rad_send_request(struct rad_handle *);
122178023Semaxconst char		*rad_strerror(struct rad_handle *);
123__END_DECLS
124
125#endif /* _RADLIB_H_ */
126