xref: /freebsd/usr.sbin/ppp/lqr.h (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
165309e5cSBrian Somers /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
31de7b4b8SPedro F. Giffuni  *
465309e5cSBrian Somers  * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
565309e5cSBrian Somers  *          based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
665309e5cSBrian Somers  *                           Internet Initiative Japan, Inc (IIJ)
765309e5cSBrian Somers  * All rights reserved.
8af57ed9fSAtsushi Murai  *
965309e5cSBrian Somers  * Redistribution and use in source and binary forms, with or without
1065309e5cSBrian Somers  * modification, are permitted provided that the following conditions
1165309e5cSBrian Somers  * are met:
1265309e5cSBrian Somers  * 1. Redistributions of source code must retain the above copyright
1365309e5cSBrian Somers  *    notice, this list of conditions and the following disclaimer.
1465309e5cSBrian Somers  * 2. Redistributions in binary form must reproduce the above copyright
1565309e5cSBrian Somers  *    notice, this list of conditions and the following disclaimer in the
1665309e5cSBrian Somers  *    documentation and/or other materials provided with the distribution.
17af57ed9fSAtsushi Murai  *
1865309e5cSBrian Somers  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1965309e5cSBrian Somers  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2065309e5cSBrian Somers  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2165309e5cSBrian Somers  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2265309e5cSBrian Somers  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2365309e5cSBrian Somers  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2465309e5cSBrian Somers  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2565309e5cSBrian Somers  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2665309e5cSBrian Somers  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2765309e5cSBrian Somers  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2865309e5cSBrian Somers  * SUCH DAMAGE.
29af57ed9fSAtsushi Murai  */
30af57ed9fSAtsushi Murai 
31af57ed9fSAtsushi Murai /*
32879ed6faSBrian Somers  *  Structure of LQR packet defined in RFC1989
33af57ed9fSAtsushi Murai  */
34af57ed9fSAtsushi Murai struct lqrdata {
353a70c9f7SBrian Somers   u_int32_t MagicNumber;
36879ed6faSBrian Somers   u_int32_t LastOutLQRs;	/* most recently received PeerOutLQRs */
37879ed6faSBrian Somers   u_int32_t LastOutPackets;	/* most recently received PeerOutPackets */
38879ed6faSBrian Somers   u_int32_t LastOutOctets;	/* most recently received PeerOutOctets */
39879ed6faSBrian Somers   u_int32_t PeerInLQRs;		/* Peers SaveInLQRs */
40879ed6faSBrian Somers   u_int32_t PeerInPackets;	/* Peers SaveInPackets */
41879ed6faSBrian Somers   u_int32_t PeerInDiscards;	/* Peers SaveInDiscards */
42879ed6faSBrian Somers   u_int32_t PeerInErrors;	/* Peers SaveInErrors */
43879ed6faSBrian Somers   u_int32_t PeerInOctets;	/* Peers SaveInOctets */
44879ed6faSBrian Somers   u_int32_t PeerOutLQRs;	/* Peers OutLQRs (hdlc.h) */
45879ed6faSBrian Somers   u_int32_t PeerOutPackets;	/* Peers OutPackets (hdlc.h) */
46879ed6faSBrian Somers   u_int32_t PeerOutOctets;	/* Peers OutOctets (hdlc.h) */
47af57ed9fSAtsushi Murai };
48af57ed9fSAtsushi Murai 
49a57095e7SBrian Somers struct lqrsavedata {	/* Saved on receipt of an LQR */
50a57095e7SBrian Somers   u_int32_t InLQRs;	/* From ifInLQRs */
51a57095e7SBrian Somers   u_int32_t InPackets;	/* From ifInPackets */
52a57095e7SBrian Somers   u_int32_t InDiscards;	/* From ifInDiscards */
53a57095e7SBrian Somers   u_int32_t InErrors;	/* From ifInErrors */
54a57095e7SBrian Somers   u_int32_t InOctets;	/* From InGoodOctets ! */
55a57095e7SBrian Somers };
56a57095e7SBrian Somers 
57af57ed9fSAtsushi Murai /*
58af57ed9fSAtsushi Murai  *  We support LQR and ECHO as LQM method
59af57ed9fSAtsushi Murai  */
60af57ed9fSAtsushi Murai #define	LQM_LQR	  1
61af57ed9fSAtsushi Murai #define	LQM_ECHO  2
62af57ed9fSAtsushi Murai 
632764b86aSBrian Somers struct mbuf;
64879ed6faSBrian Somers struct physical;
65879ed6faSBrian Somers struct lcp;
66879ed6faSBrian Somers struct fsm;
67a57095e7SBrian Somers struct hdlc;
685d9e6103SBrian Somers struct link;
695d9e6103SBrian Somers struct bundle;
70879ed6faSBrian Somers 
71dd7e2610SBrian Somers extern void lqr_Dump(const char *, const char *, const struct lqrdata *);
72a57095e7SBrian Somers extern void lqr_Analyse(const struct hdlc *, const struct lqrdata *,
73a57095e7SBrian Somers                         const struct lqrdata *);
74dd7e2610SBrian Somers extern void lqr_ChangeOrder(struct lqrdata *, struct lqrdata *);
75dd7e2610SBrian Somers extern void lqr_Start(struct lcp *);
76b7c5748eSBrian Somers extern void lqr_reStart(struct lcp *);
77dd7e2610SBrian Somers extern void lqr_Stop(struct physical *, int);
78dd7e2610SBrian Somers extern void lqr_StopTimer(struct physical *);
793377c28cSBrian Somers extern struct mbuf *lqr_RecvEcho(struct fsm *, struct mbuf *);
805d9e6103SBrian Somers extern struct mbuf *lqr_Input(struct bundle *, struct link *, struct mbuf *);
815d9e6103SBrian Somers 
825d9e6103SBrian Somers extern struct layer lqrlayer;
83