1 /* $OpenBSD: if_pppvar.h,v 1.15 2003/12/07 15:41:27 markus 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) 1989-2002 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) 1984-2000 Carnegie Mellon University. All rights reserved.
38 *
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
41 * are met:
42 *
43 * 1. Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 *
46 * 2. Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in
48 * the documentation and/or other materials provided with the
49 * distribution.
50 *
51 * 3. The name "Carnegie Mellon University" must not be used to
52 * endorse or promote products derived from this software without
53 * prior written permission. For permission or any legal
54 * details, please contact
55 * Office of Technology Transfer
56 * Carnegie Mellon University
57 * 5000 Forbes Avenue
58 * Pittsburgh, PA 15213-3890
59 * (412) 268-4387, fax: (412) 268-7395
60 * tech-transfer@andrew.cmu.edu
61 *
62 * 4. Redistributions of any form whatsoever must retain the following
63 * acknowledgment:
64 * "This product includes software developed by Computing Services
65 * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
66 *
67 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
68 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
69 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
70 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
71 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
72 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
73 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
74 */
75
76 #ifndef _NET_IF_PPPVAR_H_
77 #define _NET_IF_PPPVAR_H_
78
79 /*
80 * Supported network protocols. These values are used for
81 * indexing sc_npmode.
82 */
83 #define NP_IP 0 /* Internet Protocol */
84 #define NUM_NP 1 /* Number of NPs. */
85
86 /*
87 * Structure describing each ppp unit.
88 */
89 struct ppp_softc {
90 struct ifnet sc_if; /* network-visible interface */
91 struct timeout sc_timo; /* timeout control (for ptys) */
92 int sc_unit; /* XXX unit number */
93 u_int sc_flags; /* control/status bits; see if_ppp.h */
94 void *sc_devp; /* pointer to device-dep structure */
95 void (*sc_start)(struct ppp_softc *); /* start output proc */
96 void (*sc_ctlp)(struct ppp_softc *); /* rcvd control pkt */
97 void (*sc_relinq)(struct ppp_softc *); /* relinquish ifunit */
98 u_int16_t sc_mru; /* max receive unit */
99 pid_t sc_xfer; /* used in transferring unit */
100 struct ifqueue sc_rawq; /* received packets */
101 struct ifqueue sc_inq; /* queue of input packets for daemon */
102 struct ifqueue sc_fastq; /* interactive output packet q */
103 struct mbuf *sc_togo; /* output packet ready to go */
104 struct mbuf *sc_npqueue; /* output packets not to be sent yet */
105 struct mbuf **sc_npqtail; /* ptr to last next ptr in npqueue */
106 struct pppstat sc_stats; /* count of bytes/pkts sent/rcvd */
107 caddr_t sc_bpf; /* hook for BPF */
108 enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
109 struct compressor *sc_xcomp; /* transmit compressor */
110 void *sc_xc_state; /* transmit compressor state */
111 struct compressor *sc_rcomp; /* receive decompressor */
112 void *sc_rc_state; /* receive decompressor state */
113 time_t sc_last_sent; /* time (secs) last NP pkt sent */
114 time_t sc_last_recv; /* time (secs) last NP pkt rcvd */
115 struct bpf_program sc_pass_filt; /* filter for packets to pass */
116 struct bpf_program sc_active_filt; /* filter for "non-idle" packets */
117 #ifdef VJC
118 struct slcompress *sc_comp; /* vjc control buffer */
119 #endif
120
121 /* Device-dependent part for async lines. */
122 ext_accm sc_asyncmap; /* async control character map */
123 u_int32_t sc_rasyncmap; /* receive async control char map */
124 struct mbuf *sc_outm; /* mbuf chain currently being output */
125 struct mbuf *sc_m; /* pointer to input mbuf chain */
126 struct mbuf *sc_mc; /* pointer to current input mbuf */
127 char *sc_mp; /* ptr to next char in input mbuf */
128 u_int16_t sc_ilen; /* length of input packet so far */
129 u_int16_t sc_fcs; /* FCS so far (input) */
130 u_int16_t sc_outfcs; /* FCS so far for output packet */
131 u_char sc_rawin[16]; /* chars as received */
132 int sc_rawin_count; /* # in sc_rawin */
133 LIST_ENTRY(ppp_softc) sc_list; /* all ppp interfaces */
134 };
135
136 #ifdef _KERNEL
137 extern struct ppp_softc ppp_softc[];
138
139 struct ppp_softc *pppalloc(pid_t pid);
140 void pppdealloc(struct ppp_softc *sc);
141 int pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data,
142 int flag, struct proc *p);
143 void ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost);
144 struct mbuf *ppp_dequeue(struct ppp_softc *sc);
145 void ppp_restart(struct ppp_softc *sc);
146 int pppoutput(struct ifnet *, struct mbuf *,
147 struct sockaddr *, struct rtentry *);
148 #endif /* _KERNEL */
149 #endif /* _NET_IF_PPPVAR_H_ */