radius.h revision 116622
143313Sbrian/* 243313Sbrian * Copyright 1999 Internet Business Solutions Ltd., Switzerland 343313Sbrian * All rights reserved. 443313Sbrian * 543313Sbrian * Redistribution and use in source and binary forms, with or without 643313Sbrian * modification, are permitted provided that the following conditions 743313Sbrian * are met: 843313Sbrian * 1. Redistributions of source code must retain the above copyright 943313Sbrian * notice, this list of conditions and the following disclaimer. 1043313Sbrian * 2. Redistributions in binary form must reproduce the above copyright 1143313Sbrian * notice, this list of conditions and the following disclaimer in the 1243313Sbrian * documentation and/or other materials provided with the distribution. 1343313Sbrian * 1443313Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1543313Sbrian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1643313Sbrian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1743313Sbrian * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1843313Sbrian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1943313Sbrian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2043313Sbrian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2143313Sbrian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2243313Sbrian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2343313Sbrian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2443313Sbrian * SUCH DAMAGE. 2543313Sbrian * 2650479Speter * $FreeBSD: head/usr.sbin/ppp/radius.h 116622 2003-06-20 16:15:59Z ume $ 2743313Sbrian */ 2843313Sbrian 2998132Sbrian#define MPPE_POLICY_ALLOWED 1 3098132Sbrian#define MPPE_POLICY_REQUIRED 2 3198132Sbrian 3298132Sbrian#define MPPE_TYPE_40BIT 2 3398132Sbrian#define MPPE_TYPE_128BIT 4 3498132Sbrian 3543313Sbrianstruct radius { 3658028Sbrian struct fdescriptor desc; /* We're a sort of (selectable) fdescriptor */ 3743693Sbrian struct { 3843693Sbrian int fd; /* We're selecting on this */ 3943693Sbrian struct rad_handle *rad; /* Using this to talk to our lib */ 4043693Sbrian struct pppTimer timer; /* for this long */ 4143693Sbrian struct authinfo *auth; /* Tell this about success/failure */ 4243693Sbrian } cx; 4343313Sbrian unsigned valid : 1; /* Is this structure valid ? */ 4443313Sbrian unsigned vj : 1; /* FRAMED Compression */ 4543313Sbrian struct in_addr ip; /* FRAMED IP */ 4643313Sbrian struct in_addr mask; /* FRAMED Netmask */ 4743313Sbrian unsigned long mtu; /* FRAMED MTU */ 4896153Sbrian unsigned long sessiontime; /* Session-Timeout */ 4996153Sbrian char *filterid; /* FRAMED Filter Id */ 5043313Sbrian struct sticky_route *routes; /* FRAMED Routes */ 5196730Sbrian char *msrepstr; /* MS-CHAP2-Response */ 5296324Sbrian char *repstr; /* Reply-Message */ 5396324Sbrian char *errstr; /* Error-Message */ 54116586Sume#ifndef NOINET6 55116622Sume uint8_t *ipv6prefix; /* FRAMED IPv6 Prefix */ 56116586Sume struct sticky_route *ipv6routes; /* FRAMED IPv6 Routes */ 57116586Sume#endif 5843313Sbrian struct { 5998132Sbrian int policy; /* MPPE_POLICY_* */ 6098132Sbrian int types; /* MPPE_TYPE_*BIT bitmask */ 6198132Sbrian char *recvkey; 6298132Sbrian size_t recvkeylen; 6398132Sbrian char *sendkey; 6498132Sbrian size_t sendkeylen; 6598132Sbrian } mppe; 6698132Sbrian struct { 6774001Sbrian char file[PATH_MAX]; /* Radius config file */ 6843313Sbrian } cfg; 6943313Sbrian}; 7043313Sbrian 7165178Sbrianstruct radacct { 7265178Sbrian struct radius *rad_parent; /* "Parent" struct radius stored in bundle */ 7365178Sbrian char user_name[AUTHLEN]; /* Session User-Name */ 7465178Sbrian char session_id[256]; /* Unique session ID */ 7565178Sbrian char multi_session_id[51]; /* Unique MP session ID */ 7665178Sbrian int authentic; /* How the session has been authenticated */ 77116588Sume u_short proto; /* Protocol number */ 78116588Sume union { 79116588Sume struct { 80116588Sume struct in_addr addr; 81116588Sume struct in_addr mask; 82116588Sume } ip; 83116588Sume#ifndef NOINET6 84116588Sume struct { 85116588Sume u_char ifid[8]; 86116588Sume } ipv6; 87116588Sume#endif 88116588Sume }; 8965178Sbrian}; 9065178Sbrian 9143693Sbrian#define descriptor2radius(d) \ 9243693Sbrian ((d)->type == RADIUS_DESCRIPTOR ? (struct radius *)(d) : NULL) 9343693Sbrian 9443313Sbrianstruct bundle; 9543313Sbrian 9643313Sbrianextern void radius_Init(struct radius *); 9743313Sbrianextern void radius_Destroy(struct radius *); 9843313Sbrian 9943313Sbrianextern void radius_Show(struct radius *, struct prompt *); 10096730Sbrianextern int radius_Authenticate(struct radius *, struct authinfo *, 10196730Sbrian const char *, const char *, int, 10298311Sbrian const char *, int); 103116588Sumeextern void radius_Account_Set_Ip(struct radacct *, struct in_addr *, 104116588Sume struct in_addr *); 105116588Sume#ifndef NOINET6 106116588Sumeextern void radius_Account_Set_Ipv6(struct radacct *, u_char *); 107116588Sume#endif 10898243Sbrianextern void radius_Account(struct radius *, struct radacct *, 109116588Sume struct datalink *, int, struct pppThroughput *); 11065178Sbrian 11165178Sbrian/* An (int) parameter to radius_Account, from radlib.h */ 11265178Sbrian#if !defined(RAD_START) 11365178Sbrian#define RAD_START 1 11465178Sbrian#define RAD_STOP 2 11565178Sbrian#endif 11693767Shosokawa 11793767Shosokawa/* Get address from NAS pool */ 11893767Shosokawa#define RADIUS_INADDR_POOL htonl(0xfffffffe) /* 255.255.255.254 */ 119