radius.h revision 96153
1/* 2 * Copyright 1999 Internet Business Solutions Ltd., Switzerland 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: head/usr.sbin/ppp/radius.h 96153 2002-05-07 10:06:54Z brian $ 27 */ 28 29struct radius { 30 struct fdescriptor desc; /* We're a sort of (selectable) fdescriptor */ 31 struct { 32 int fd; /* We're selecting on this */ 33 struct rad_handle *rad; /* Using this to talk to our lib */ 34 struct pppTimer timer; /* for this long */ 35 struct authinfo *auth; /* Tell this about success/failure */ 36 } cx; 37 unsigned valid : 1; /* Is this structure valid ? */ 38 unsigned vj : 1; /* FRAMED Compression */ 39 struct in_addr ip; /* FRAMED IP */ 40 struct in_addr mask; /* FRAMED Netmask */ 41 unsigned long mtu; /* FRAMED MTU */ 42 unsigned long sessiontime; /* Session-Timeout */ 43 char *filterid; /* FRAMED Filter Id */ 44 struct sticky_route *routes; /* FRAMED Routes */ 45 struct { 46 char file[PATH_MAX]; /* Radius config file */ 47 } cfg; 48}; 49 50struct radacct { 51 struct radius *rad_parent; /* "Parent" struct radius stored in bundle */ 52 char user_name[AUTHLEN]; /* Session User-Name */ 53 char session_id[256]; /* Unique session ID */ 54 char multi_session_id[51]; /* Unique MP session ID */ 55 int authentic; /* How the session has been authenticated */ 56 struct in_addr ip; 57 struct in_addr mask; 58}; 59 60#define descriptor2radius(d) \ 61 ((d)->type == RADIUS_DESCRIPTOR ? (struct radius *)(d) : NULL) 62 63struct bundle; 64 65extern void radius_Init(struct radius *); 66extern void radius_Destroy(struct radius *); 67 68extern void radius_Show(struct radius *, struct prompt *); 69extern void radius_Authenticate(struct radius *, struct authinfo *, 70 const char *, const char *, int, 71 const char *, int); 72extern void radius_Account(struct radius *, struct radacct *, 73 struct datalink *, int, struct in_addr *, 74 struct in_addr *, struct pppThroughput *); 75 76/* An (int) parameter to radius_Account, from radlib.h */ 77#if !defined(RAD_START) 78#define RAD_START 1 79#define RAD_STOP 2 80#endif 81 82/* Get address from NAS pool */ 83#define RADIUS_INADDR_POOL htonl(0xfffffffe) /* 255.255.255.254 */ 84