1145516Sdarrenr/*- 2145516Sdarrenr * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org> 3145516Sdarrenr * based on work by Toshiharu OHNO <tony-o@iij.ad.jp> 4255332Scy * Internet Initiative Japan, Inc (IIJ) 5145516Sdarrenr * All rights reserved. 6145516Sdarrenr * 7145516Sdarrenr * Redistribution and use in source and binary forms, with or without 8145516Sdarrenr * modification, are permitted provided that the following conditions 9145516Sdarrenr * are met: 10145516Sdarrenr * 1. Redistributions of source code must retain the above copyright 11145516Sdarrenr * notice, this list of conditions and the following disclaimer. 12145516Sdarrenr * 2. Redistributions in binary form must reproduce the above copyright 13145516Sdarrenr * notice, this list of conditions and the following disclaimer in the 14145516Sdarrenr * documentation and/or other materials provided with the distribution. 15145516Sdarrenr * 16145516Sdarrenr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17145516Sdarrenr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18145516Sdarrenr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19145516Sdarrenr * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20145516Sdarrenr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21145516Sdarrenr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22145516Sdarrenr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23145516Sdarrenr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24145516Sdarrenr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25145516Sdarrenr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26145516Sdarrenr * SUCH DAMAGE. 27145516Sdarrenr * 28145516Sdarrenr * $FreeBSD: releng/11.0/usr.sbin/ppp/auth.h 134789 2004-09-05 01:46:52Z brian $ 29145516Sdarrenr */ 30145516Sdarrenr 31145516Sdarrenrstruct physical; 32145516Sdarrenrstruct bundle; 33145516Sdarrenrstruct authinfo; 34145516Sdarrenrtypedef void (*auth_func)(struct authinfo *); 35255332Scy 36255332Scystruct authinfo { 37255332Scy struct { 38255332Scy auth_func req; 39145516Sdarrenr auth_func success; 40145516Sdarrenr auth_func failure; 41145516Sdarrenr } fn; 42145516Sdarrenr struct { 43145516Sdarrenr struct fsmheader hdr; 44145516Sdarrenr char name[AUTHLEN]; 45145516Sdarrenr } in; 46145516Sdarrenr struct pppTimer authtimer; 47145516Sdarrenr int retry; 48145516Sdarrenr int id; 49145516Sdarrenr struct physical *physical; 50145516Sdarrenr struct { 51145516Sdarrenr struct fsm_retry fsm; /* How often/frequently to resend requests */ 52145516Sdarrenr } cfg; 53145516Sdarrenr}; 54145516Sdarrenr 55145516Sdarrenr#define auth_Failure(a) (*(a)->fn.failure)(a) 56145516Sdarrenr#define auth_Success(a) (*(a)->fn.success)(a) 57145516Sdarrenr 58145516Sdarrenrextern const char *Auth2Nam(u_short, u_char); 59145516Sdarrenrextern void auth_Init(struct authinfo *, struct physical *, 60145516Sdarrenr auth_func, auth_func, auth_func); 61145516Sdarrenrextern void auth_StopTimer(struct authinfo *); 62145516Sdarrenrextern void auth_StartReq(struct authinfo *); 63145516Sdarrenrextern int auth_Validate(struct bundle *, const char *, const char *); 64145516Sdarrenrextern char *auth_GetSecret(const char *, size_t); 65145516Sdarrenrextern int auth_SetPhoneList(const char *, char *, int); 66145516Sdarrenrextern int auth_Select(struct bundle *, const char *); 67145516Sdarrenrextern struct mbuf *auth_ReadHeader(struct authinfo *, struct mbuf *); 68145516Sdarrenrextern struct mbuf *auth_ReadName(struct authinfo *, struct mbuf *, size_t); 69145516Sdarrenr