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