]> git.ozlabs.org Git - ppp.git/blob - netbsd-1.1/if_pppvar.h
f413c1ac58e3e6e9bb29a7a901cdee49d28a450d
[ppp.git] / netbsd-1.1 / if_pppvar.h
1 /*      $Id: if_pppvar.h,v 1.5 2002/12/06 09:49:16 paulus Exp $ */
2
3 /*
4  * if_pppvar.h - private structures and declarations for PPP.
5  *
6  * Copyright (c) 1994 Paul Mackerras. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in
17  *    the documentation and/or other materials provided with the
18  *    distribution.
19  *
20  * 3. The name(s) of the authors of this software must not be used to
21  *    endorse or promote products derived from this software without
22  *    prior written permission.
23  *
24  * 4. Redistributions of any form whatsoever must retain the following
25  *    acknowledgment:
26  *    "This product includes software developed by Paul Mackerras
27  *     <paulus@samba.org>".
28  *
29  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
30  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
31  * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
32  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
33  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
34  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
35  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
36  *
37  * Copyright (c) 1989 Carnegie Mellon University.
38  * All rights reserved.
39  *
40  * Redistribution and use in source and binary forms are permitted
41  * provided that the above copyright notice and this paragraph are
42  * duplicated in all such forms and that any documentation,
43  * advertising materials, and other materials related to such
44  * distribution and use acknowledge that the software was developed
45  * by Carnegie Mellon University.  The name of the
46  * University may not be used to endorse or promote products derived
47  * from this software without specific prior written permission.
48  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
49  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
50  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
51  */
52
53 /*
54  * Supported network protocols.  These values are used for
55  * indexing sc_npmode.
56  */
57 #define NP_IP   0               /* Internet Protocol */
58 #define NUM_NP  1               /* Number of NPs. */
59
60 /*
61  * Structure describing each ppp unit.
62  */
63 struct ppp_softc {
64         struct  ifnet sc_if;            /* network-visible interface */
65         u_int   sc_flags;               /* control/status bits; see if_ppp.h */
66         void    *sc_devp;               /* pointer to device-dep structure */
67         void    (*sc_start) __P((struct ppp_softc *));  /* start output proc */
68         void    (*sc_ctlp) __P((struct ppp_softc *)); /* rcvd control pkt */
69         void    (*sc_relinq) __P((struct ppp_softc *)); /* relinquish ifunit */
70         u_int16_t sc_mru;               /* max receive unit */
71         pid_t   sc_xfer;                /* used in transferring unit */
72         struct  ifqueue sc_rawq;        /* received packets */
73         struct  ifqueue sc_inq;         /* queue of input packets for daemon */
74         struct  ifqueue sc_fastq;       /* interactive output packet q */
75         struct  mbuf *sc_togo;          /* output packet ready to go */
76         struct  mbuf *sc_npqueue;       /* output packets not to be sent yet */
77         struct  mbuf **sc_npqtail;      /* ptr to last next ptr in npqueue */
78         struct  pppstat sc_stats;       /* count of bytes/pkts sent/rcvd */
79         caddr_t sc_bpf;                 /* hook for BPF */
80         enum    NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
81         struct  compressor *sc_xcomp;   /* transmit compressor */
82         void    *sc_xc_state;           /* transmit compressor state */
83         struct  compressor *sc_rcomp;   /* receive decompressor */
84         void    *sc_rc_state;           /* receive decompressor state */
85         time_t  sc_last_sent;           /* time (secs) last NP pkt sent */
86         time_t  sc_last_recv;           /* time (secs) last NP pkt rcvd */
87 #ifdef PPP_FILTER
88         struct  bpf_program sc_pass_filt;   /* filter for packets to pass */
89         struct  bpf_program sc_active_filt; /* filter for "non-idle" packets */
90 #endif /* PPP_FILTER */
91 #ifdef  VJC
92         struct  slcompress *sc_comp;    /* vjc control buffer */
93 #endif
94
95         /* Device-dependent part for async lines. */
96         ext_accm sc_asyncmap;           /* async control character map */
97         u_int32_t sc_rasyncmap;         /* receive async control char map */
98         struct  mbuf *sc_outm;          /* mbuf chain currently being output */
99         struct  mbuf *sc_m;             /* pointer to input mbuf chain */
100         struct  mbuf *sc_mc;            /* pointer to current input mbuf */
101         char    *sc_mp;                 /* ptr to next char in input mbuf */
102         u_int16_t sc_ilen;              /* length of input packet so far */
103         u_int16_t sc_fcs;               /* FCS so far (input) */
104         u_int16_t sc_outfcs;            /* FCS so far for output packet */
105         u_char  sc_rawin[16];           /* chars as received */
106         int     sc_rawin_count;         /* # in sc_rawin */
107 };
108
109 #ifdef _KERNEL
110 struct  ppp_softc ppp_softc[NPPP];
111
112 struct  ppp_softc *pppalloc __P((pid_t pid));
113 void    pppdealloc __P((struct ppp_softc *sc));
114 int     pppioctl __P((struct ppp_softc *sc, u_long cmd, caddr_t data,
115                       int flag, struct proc *p));
116 void    ppp_restart __P((struct ppp_softc *sc));
117 void    ppppktin __P((struct ppp_softc *sc, struct mbuf *m, int lost));
118 struct  mbuf *ppp_dequeue __P((struct ppp_softc *sc));
119 int     pppoutput __P((struct ifnet *, struct mbuf *,
120                        struct sockaddr *, struct rtentry *));
121 #endif /* _KERNEL */