138175Sbrian/*- 238175Sbrian * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 338175Sbrian * All rights reserved. 438175Sbrian * 538175Sbrian * Redistribution and use in source and binary forms, with or without 638175Sbrian * modification, are permitted provided that the following conditions 738175Sbrian * are met: 838175Sbrian * 1. Redistributions of source code must retain the above copyright 938175Sbrian * notice, this list of conditions and the following disclaimer. 1038175Sbrian * 2. Redistributions in binary form must reproduce the above copyright 1138175Sbrian * notice, this list of conditions and the following disclaimer in the 1238175Sbrian * documentation and/or other materials provided with the distribution. 1338175Sbrian * 1438175Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1538175Sbrian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1638175Sbrian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1738175Sbrian * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1838175Sbrian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1938175Sbrian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2038175Sbrian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2138175Sbrian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2238175Sbrian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2338175Sbrian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2438175Sbrian * SUCH DAMAGE. 2538175Sbrian * 2650479Speter * $FreeBSD: releng/11.0/usr.sbin/ppp/cbcp.h 50479 1999-08-28 01:35:59Z peter $ 2738175Sbrian */ 2838175Sbrian 2938175Sbrianstruct mbuf; 3038175Sbrianstruct physical; 3138175Sbrianstruct datalink; 3238175Sbrian 3338175Sbrian/* fsm states */ 3438175Sbrian#define CBCP_CLOSED (0) /* Not in use */ 3538175Sbrian#define CBCP_STOPPED (1) /* Waiting for a REQ */ 3638175Sbrian#define CBCP_REQSENT (2) /* Waiting for a RESP */ 3738175Sbrian#define CBCP_RESPSENT (3) /* Waiting for an ACK */ 3838175Sbrian#define CBCP_ACKSENT (4) /* Waiting for an LCP Term REQ */ 3938175Sbrian 4038175Sbrianstruct cbcpcfg { 4138175Sbrian u_char delay; 4238175Sbrian char phone[SCRIPT_LEN]; 4338175Sbrian long fsmretry; 4438175Sbrian}; 4538175Sbrian 4638175Sbrianstruct cbcp { 4738175Sbrian unsigned required : 1; /* Are we gonna call back ? */ 4838175Sbrian struct physical *p; /* On this physical link */ 4938175Sbrian struct { 5038175Sbrian u_char type; /* cbcp_data::type (none/me/him/list) */ 5138175Sbrian u_char delay; /* How long to delay */ 5238175Sbrian char phone[SCRIPT_LEN]; /* What to dial */ 5338175Sbrian 5438175Sbrian int state; /* Our FSM state */ 5538175Sbrian u_char id; /* Our FSM ID */ 5638175Sbrian u_char restart; /* FSM Send again ? */ 5738175Sbrian struct pppTimer timer; /* Resend last option */ 5838175Sbrian } fsm; 5938175Sbrian}; 6038175Sbrian 6138175Sbrianextern void cbcp_Init(struct cbcp *, struct physical *); 6238175Sbrianextern void cbcp_Up(struct cbcp *); 6346686Sbrianextern struct mbuf *cbcp_Input(struct bundle *, struct link *, struct mbuf *); 6438175Sbrianextern void cbcp_Down(struct cbcp *); 6538175Sbrianextern void cbcp_ReceiveTerminateReq(struct physical *); 66