Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
[dragonfly.git] / usr.sbin / ppp / radius.h
blob59a6b1d39a66315ae9a1a73332b49659dbcac489
1 /*
2 * Copyright 1999 Internet Business Solutions Ltd., Switzerland
3 * All rights reserved.
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.
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.
26 * $FreeBSD: src/usr.sbin/ppp/radius.h,v 1.3.2.4 2002/09/01 02:12:32 brian Exp $
27 * $DragonFly: src/usr.sbin/ppp/radius.h,v 1.2 2003/06/17 04:30:01 dillon Exp $
30 #define MPPE_POLICY_ALLOWED 1
31 #define MPPE_POLICY_REQUIRED 2
33 #define MPPE_TYPE_40BIT 2
34 #define MPPE_TYPE_128BIT 4
36 struct radius {
37 struct fdescriptor desc; /* We're a sort of (selectable) fdescriptor */
38 struct {
39 int fd; /* We're selecting on this */
40 struct rad_handle *rad; /* Using this to talk to our lib */
41 struct pppTimer timer; /* for this long */
42 struct authinfo *auth; /* Tell this about success/failure */
43 } cx;
44 unsigned valid : 1; /* Is this structure valid ? */
45 unsigned vj : 1; /* FRAMED Compression */
46 struct in_addr ip; /* FRAMED IP */
47 struct in_addr mask; /* FRAMED Netmask */
48 unsigned long mtu; /* FRAMED MTU */
49 unsigned long sessiontime; /* Session-Timeout */
50 char *filterid; /* FRAMED Filter Id */
51 struct sticky_route *routes; /* FRAMED Routes */
52 char *msrepstr; /* MS-CHAP2-Response */
53 char *repstr; /* Reply-Message */
54 char *errstr; /* Error-Message */
55 struct {
56 int policy; /* MPPE_POLICY_* */
57 int types; /* MPPE_TYPE_*BIT bitmask */
58 char *recvkey;
59 size_t recvkeylen;
60 char *sendkey;
61 size_t sendkeylen;
62 } mppe;
63 struct {
64 char file[PATH_MAX]; /* Radius config file */
65 } cfg;
68 struct radacct {
69 struct radius *rad_parent; /* "Parent" struct radius stored in bundle */
70 char user_name[AUTHLEN]; /* Session User-Name */
71 char session_id[256]; /* Unique session ID */
72 char multi_session_id[51]; /* Unique MP session ID */
73 int authentic; /* How the session has been authenticated */
74 struct in_addr ip;
75 struct in_addr mask;
78 #define descriptor2radius(d) \
79 ((d)->type == RADIUS_DESCRIPTOR ? (struct radius *)(d) : NULL)
81 struct bundle;
83 extern void radius_Init(struct radius *);
84 extern void radius_Destroy(struct radius *);
86 extern void radius_Show(struct radius *, struct prompt *);
87 extern int radius_Authenticate(struct radius *, struct authinfo *,
88 const char *, const char *, int,
89 const char *, int);
90 extern void radius_Account(struct radius *, struct radacct *,
91 struct datalink *, int, struct in_addr *,
92 struct in_addr *, struct pppThroughput *);
94 /* An (int) parameter to radius_Account, from radlib.h */
95 #if !defined(RAD_START)
96 #define RAD_START 1
97 #define RAD_STOP 2
98 #endif
100 /* Get address from NAS pool */
101 #define RADIUS_INADDR_POOL htonl(0xfffffffe) /* 255.255.255.254 */