xref: /freebsd/usr.sbin/ppp/link.h (revision 86b1f0d762ae636d69499aa77e50c36e7f0c52ef)
18c07a7b2SBrian Somers /*-
28c07a7b2SBrian Somers  * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
38c07a7b2SBrian Somers  * All rights reserved.
48c07a7b2SBrian Somers  *
58c07a7b2SBrian Somers  * Redistribution and use in source and binary forms, with or without
68c07a7b2SBrian Somers  * modification, are permitted provided that the following conditions
78c07a7b2SBrian Somers  * are met:
88c07a7b2SBrian Somers  * 1. Redistributions of source code must retain the above copyright
98c07a7b2SBrian Somers  *    notice, this list of conditions and the following disclaimer.
108c07a7b2SBrian Somers  * 2. Redistributions in binary form must reproduce the above copyright
118c07a7b2SBrian Somers  *    notice, this list of conditions and the following disclaimer in the
128c07a7b2SBrian Somers  *    documentation and/or other materials provided with the distribution.
138c07a7b2SBrian Somers  *
148c07a7b2SBrian Somers  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
158c07a7b2SBrian Somers  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
168c07a7b2SBrian Somers  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
178c07a7b2SBrian Somers  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
188c07a7b2SBrian Somers  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
198c07a7b2SBrian Somers  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
208c07a7b2SBrian Somers  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
218c07a7b2SBrian Somers  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
228c07a7b2SBrian Somers  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
238c07a7b2SBrian Somers  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
248c07a7b2SBrian Somers  * SUCH DAMAGE.
258c07a7b2SBrian Somers  *
2686b1f0d7SBrian Somers  *  $Id: link.h,v 1.2 1998/05/21 21:46:14 brian Exp $
278c07a7b2SBrian Somers  *
288c07a7b2SBrian Somers  */
298c07a7b2SBrian Somers 
308c07a7b2SBrian Somers 
318c07a7b2SBrian Somers #define PHYSICAL_LINK 1
328c07a7b2SBrian Somers #define MP_LINK       2
338c07a7b2SBrian Somers 
348c07a7b2SBrian Somers #define LINK_QUEUES (PRI_MAX + 1)
35ed32233cSBrian Somers #define NPROTOSTAT 13
368c07a7b2SBrian Somers 
37455aabc3SBrian Somers struct bundle;
38b6217683SBrian Somers struct prompt;
39455aabc3SBrian Somers 
408c07a7b2SBrian Somers struct link {
418c07a7b2SBrian Somers   int type;                               /* _LINK type */
4286b1f0d7SBrian Somers   const char *name;                       /* Points to datalink::name */
438c07a7b2SBrian Somers   int len;                                /* full size of parent struct */
448c07a7b2SBrian Somers   struct pppThroughput throughput;        /* Link throughput statistics */
458c07a7b2SBrian Somers   struct mqueue Queue[LINK_QUEUES];       /* Our output queue of mbufs */
468c07a7b2SBrian Somers 
478c07a7b2SBrian Somers   u_long proto_in[NPROTOSTAT];            /* outgoing protocol stats */
488c07a7b2SBrian Somers   u_long proto_out[NPROTOSTAT];           /* incoming protocol stats */
498c07a7b2SBrian Somers 
503b0f8d2eSBrian Somers   struct lcp lcp;                         /* Our line control FSM */
513b0f8d2eSBrian Somers   struct ccp ccp;                         /* Our compression FSM */
528c07a7b2SBrian Somers };
538c07a7b2SBrian Somers 
548c07a7b2SBrian Somers extern void link_AddInOctets(struct link *, int);
558c07a7b2SBrian Somers extern void link_AddOutOctets(struct link *, int);
568c07a7b2SBrian Somers 
578c07a7b2SBrian Somers extern void link_SequenceQueue(struct link *);
588c07a7b2SBrian Somers extern int link_QueueLen(struct link *);
593b0f8d2eSBrian Somers extern int link_QueueBytes(struct link *);
608c07a7b2SBrian Somers extern struct mbuf *link_Dequeue(struct link *);
618c07a7b2SBrian Somers extern void link_Write(struct link *, int, const char *, int);
62f4768038SBrian Somers extern void link_StartOutput(struct link *, struct bundle *);
638c07a7b2SBrian Somers extern void link_Output(struct link *, int, struct mbuf *);
648c07a7b2SBrian Somers 
658c07a7b2SBrian Somers #define PROTO_IN  1                       /* third arg to link_ProtocolRecord */
668c07a7b2SBrian Somers #define PROTO_OUT 2
678c07a7b2SBrian Somers extern void link_ProtocolRecord(struct link *, u_short, int);
68b6217683SBrian Somers extern void link_ReportProtocolStatus(struct link *, struct prompt *);
69