radius.h revision 116588
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 116588 2003-06-19 18:55:49Z ume $ 27 */ 28 29#define MPPE_POLICY_ALLOWED 1 30#define MPPE_POLICY_REQUIRED 2 31 32#define MPPE_TYPE_40BIT 2 33#define MPPE_TYPE_128BIT 4 34 35struct radius { 36 struct fdescriptor desc; /* We're a sort of (selectable) fdescriptor */ 37 struct { 38 int fd; /* We're selecting on this */ 39 struct rad_handle *rad; /* Using this to talk to our lib */ 40 struct pppTimer timer; /* for this long */ 41 struct authinfo *auth; /* Tell this about success/failure */ 42 } cx; 43 unsigned valid : 1; /* Is this structure valid ? */ 44 unsigned vj : 1; /* FRAMED Compression */ 45 struct in_addr ip; /* FRAMED IP */ 46 struct in_addr mask; /* FRAMED Netmask */ 47 unsigned long mtu; /* FRAMED MTU */ 48 unsigned long sessiontime; /* Session-Timeout */ 49 char *filterid; /* FRAMED Filter Id */ 50 struct sticky_route *routes; /* FRAMED Routes */ 51 char *msrepstr; /* MS-CHAP2-Response */ 52 char *repstr; /* Reply-Message */ 53 char *errstr; /* Error-Message */ 54#ifndef NOINET6 55 struct sticky_route *ipv6routes; /* FRAMED IPv6 Routes */ 56#endif 57 struct { 58 int policy; /* MPPE_POLICY_* */ 59 int types; /* MPPE_TYPE_*BIT bitmask */ 60 char *recvkey; 61 size_t recvkeylen; 62 char *sendkey; 63 size_t sendkeylen; 64 } mppe; 65 struct { 66 char file[PATH_MAX]; /* Radius config file */ 67 } cfg; 68}; 69 70struct radacct { 71 struct radius *rad_parent; /* "Parent" struct radius stored in bundle */ 72 char user_name[AUTHLEN]; /* Session User-Name */ 73 char session_id[256]; /* Unique session ID */ 74 char multi_session_id[51]; /* Unique MP session ID */ 75 int authentic; /* How the session has been authenticated */ 76 u_short proto; /* Protocol number */ 77 union { 78 struct { 79 struct in_addr addr; 80 struct in_addr mask; 81 } ip; 82#ifndef NOINET6 83 struct { 84 u_char ifid[8]; 85 } ipv6; 86#endif 87 }; 88}; 89 90#define descriptor2radius(d) \ 91 ((d)->type == RADIUS_DESCRIPTOR ? (struct radius *)(d) : NULL) 92 93struct bundle; 94 95extern void radius_Init(struct radius *); 96extern void radius_Destroy(struct radius *); 97 98extern void radius_Show(struct radius *, struct prompt *); 99extern int radius_Authenticate(struct radius *, struct authinfo *, 100 const char *, const char *, int, 101 const char *, int); 102extern void radius_Account_Set_Ip(struct radacct *, struct in_addr *, 103 struct in_addr *); 104#ifndef NOINET6 105extern void radius_Account_Set_Ipv6(struct radacct *, u_char *); 106#endif 107extern void radius_Account(struct radius *, struct radacct *, 108 struct datalink *, int, struct pppThroughput *); 109 110/* An (int) parameter to radius_Account, from radlib.h */ 111#if !defined(RAD_START) 112#define RAD_START 1 113#define RAD_STOP 2 114#endif 115 116/* Get address from NAS pool */ 117#define RADIUS_INADDR_POOL htonl(0xfffffffe) /* 255.255.255.254 */ 118