178189Sbrian/*- 2330449Seadler * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3330449Seadler * 478189Sbrian * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org> 578189Sbrian * based on work by Toshiharu OHNO <tony-o@iij.ad.jp> 678189Sbrian * Internet Initiative Japan, Inc (IIJ) 778189Sbrian * All rights reserved. 86756Samurai * 978189Sbrian * Redistribution and use in source and binary forms, with or without 1078189Sbrian * modification, are permitted provided that the following conditions 1178189Sbrian * are met: 1278189Sbrian * 1. Redistributions of source code must retain the above copyright 1378189Sbrian * notice, this list of conditions and the following disclaimer. 1478189Sbrian * 2. Redistributions in binary form must reproduce the above copyright 1578189Sbrian * notice, this list of conditions and the following disclaimer in the 1678189Sbrian * documentation and/or other materials provided with the distribution. 176756Samurai * 1878189Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1978189Sbrian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2078189Sbrian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2178189Sbrian * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2278189Sbrian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2378189Sbrian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2478189Sbrian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2578189Sbrian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2678189Sbrian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2778189Sbrian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2878189Sbrian * SUCH DAMAGE. 296756Samurai * 3050479Speter * $FreeBSD: stable/11/usr.sbin/ppp/auth.h 330449 2018-03-05 07:26:05Z eadler $ 316756Samurai */ 326756Samurai 3336285Sbrianstruct physical; 3436285Sbrianstruct bundle; 3543693Sbrianstruct authinfo; 3643693Sbriantypedef void (*auth_func)(struct authinfo *); 376756Samurai 386756Samuraistruct authinfo { 3943693Sbrian struct { 4043693Sbrian auth_func req; 4143693Sbrian auth_func success; 4243693Sbrian auth_func failure; 4343693Sbrian } fn; 4443693Sbrian struct { 4543693Sbrian struct fsmheader hdr; 4643693Sbrian char name[AUTHLEN]; 4743693Sbrian } in; 486756Samurai struct pppTimer authtimer; 496756Samurai int retry; 506756Samurai int id; 5136285Sbrian struct physical *physical; 5236285Sbrian struct { 5344305Sbrian struct fsm_retry fsm; /* How often/frequently to resend requests */ 5436285Sbrian } cfg; 556756Samurai}; 566756Samurai 5796324Sbrian#define auth_Failure(a) (*(a)->fn.failure)(a) 5896324Sbrian#define auth_Success(a) (*(a)->fn.success)(a) 5943693Sbrian 6044106Sbrianextern const char *Auth2Nam(u_short, u_char); 6143693Sbrianextern void auth_Init(struct authinfo *, struct physical *, 6243693Sbrian auth_func, auth_func, auth_func); 6336285Sbrianextern void auth_StopTimer(struct authinfo *); 6443693Sbrianextern void auth_StartReq(struct authinfo *); 65134789Sbrianextern int auth_Validate(struct bundle *, const char *, const char *); 66134789Sbrianextern char *auth_GetSecret(const char *, size_t); 6738174Sbrianextern int auth_SetPhoneList(const char *, char *, int); 6838174Sbrianextern int auth_Select(struct bundle *, const char *); 6943693Sbrianextern struct mbuf *auth_ReadHeader(struct authinfo *, struct mbuf *); 70134789Sbrianextern struct mbuf *auth_ReadName(struct authinfo *, struct mbuf *, size_t); 71