xref: /openbsd/sys/net/if_pppvar.h (revision 842cf550)
1 /*	$OpenBSD: if_pppvar.h,v 1.12 2002/07/01 19:31:34 deraadt Exp $	*/
2 /*	$NetBSD: if_pppvar.h,v 1.5 1997/01/03 07:23:29 mikel Exp $	*/
3 /*
4  * if_pppvar.h - private structures and declarations for PPP.
5  *
6  * Copyright (c) 1994 The Australian National University.
7  * All rights reserved.
8  *
9  * Permission to use, copy, modify, and distribute this software and its
10  * documentation is hereby granted, provided that the above copyright
11  * notice appears in all copies.  This software is provided without any
12  * warranty, express or implied. The Australian National University
13  * makes no representations about the suitability of this software for
14  * any purpose.
15  *
16  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
17  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
18  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
19  * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
20  * OF SUCH DAMAGE.
21  *
22  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
25  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
26  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
27  * OR MODIFICATIONS.
28  *
29  * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
30  *
31  * Redistribution and use in source and binary forms, with or without
32  * modification, are permitted provided that the following conditions
33  * are met:
34  *
35  * 1. Redistributions of source code must retain the above copyright
36  *    notice, this list of conditions and the following disclaimer.
37  *
38  * 2. Redistributions in binary form must reproduce the above copyright
39  *    notice, this list of conditions and the following disclaimer in
40  *    the documentation and/or other materials provided with the
41  *    distribution.
42  *
43  * 3. The name "Carnegie Mellon University" must not be used to
44  *    endorse or promote products derived from this software without
45  *    prior written permission. For permission or any legal
46  *    details, please contact
47  *      Office of Technology Transfer
48  *      Carnegie Mellon University
49  *      5000 Forbes Avenue
50  *      Pittsburgh, PA  15213-3890
51  *      (412) 268-4387, fax: (412) 268-7395
52  *      tech-transfer@andrew.cmu.edu
53  *
54  * 4. Redistributions of any form whatsoever must retain the following
55  *    acknowledgment:
56  *    "This product includes software developed by Computing Services
57  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
58  *
59  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
60  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
61  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
62  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
63  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
64  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
65  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
66  */
67 
68 #ifndef _NET_IF_PPPVAR_H_
69 #define _NET_IF_PPPVAR_H_
70 
71 /*
72  * Supported network protocols.  These values are used for
73  * indexing sc_npmode.
74  */
75 #define NP_IP	0		/* Internet Protocol */
76 #define NUM_NP	1		/* Number of NPs. */
77 
78 /*
79  * Structure describing each ppp unit.
80  */
81 struct ppp_softc {
82 	struct	ifnet sc_if;		/* network-visible interface */
83 	struct	timeout sc_timo;	/* timeout control (for ptys) */
84 	int	sc_unit;		/* XXX unit number */
85 	u_int	sc_flags;		/* control/status bits; see if_ppp.h */
86 	void	*sc_devp;		/* pointer to device-dep structure */
87 	void	(*sc_start)(struct ppp_softc *); /* start output proc */
88 	void	(*sc_ctlp)(struct ppp_softc *); /* rcvd control pkt */
89 	void	(*sc_relinq)(struct ppp_softc *); /* relinquish ifunit */
90 	u_int16_t sc_mru;		/* max receive unit */
91 	pid_t	sc_xfer;		/* used in transferring unit */
92 	struct	ifqueue sc_rawq;	/* received packets */
93 	struct	ifqueue sc_inq;		/* queue of input packets for daemon */
94 	struct	ifqueue sc_fastq;	/* interactive output packet q */
95 	struct	mbuf *sc_togo;		/* output packet ready to go */
96 	struct	mbuf *sc_npqueue;	/* output packets not to be sent yet */
97 	struct	mbuf **sc_npqtail;	/* ptr to last next ptr in npqueue */
98 	struct	pppstat sc_stats;	/* count of bytes/pkts sent/rcvd */
99 	caddr_t	sc_bpf;			/* hook for BPF */
100 	enum	NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
101 	struct	compressor *sc_xcomp;	/* transmit compressor */
102 	void	*sc_xc_state;		/* transmit compressor state */
103 	struct	compressor *sc_rcomp;	/* receive decompressor */
104 	void	*sc_rc_state;		/* receive decompressor state */
105 	time_t	sc_last_sent;		/* time (secs) last NP pkt sent */
106 	time_t	sc_last_recv;		/* time (secs) last NP pkt rcvd */
107 	struct	bpf_program sc_pass_filt; /* filter for packets to pass */
108 	struct	bpf_program sc_active_filt; /* filter for "non-idle" packets */
109 #ifdef	VJC
110 	struct	slcompress *sc_comp; 	/* vjc control buffer */
111 #endif
112 
113 	/* Device-dependent part for async lines. */
114 	ext_accm sc_asyncmap;		/* async control character map */
115 	u_int32_t sc_rasyncmap;		/* receive async control char map */
116 	struct	mbuf *sc_outm;		/* mbuf chain currently being output */
117 	struct	mbuf *sc_m;		/* pointer to input mbuf chain */
118 	struct	mbuf *sc_mc;		/* pointer to current input mbuf */
119 	char	*sc_mp;			/* ptr to next char in input mbuf */
120 	u_int16_t sc_ilen;		/* length of input packet so far */
121 	u_int16_t sc_fcs;		/* FCS so far (input) */
122 	u_int16_t sc_outfcs;		/* FCS so far for output packet */
123 	u_char	sc_rawin[16];		/* chars as received */
124 	int	sc_rawin_count;		/* # in sc_rawin */
125 };
126 
127 #ifdef _KERNEL
128 struct	ppp_softc ppp_softc[NPPP];
129 
130 struct	ppp_softc *pppalloc(pid_t pid);
131 void	pppdealloc(struct ppp_softc *sc);
132 int	pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data,
133 		      int flag, struct proc *p);
134 void	ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost);
135 struct	mbuf *ppp_dequeue(struct ppp_softc *sc);
136 void	ppp_restart(struct ppp_softc *sc);
137 int	pppoutput(struct ifnet *, struct mbuf *,
138 		       struct sockaddr *, struct rtentry *);
139 #endif /* _KERNEL */
140 #endif /* _NET_IF_PPPVAR_H_ */
141