]> git.saurik.com Git - apple/xnu.git/blob - bsd/net/if_pppvar.h
xnu-1699.26.8.tar.gz
[apple/xnu.git] / bsd / net / if_pppvar.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * if_pppvar.h - private structures and declarations for PPP.
30 *
31 * Copyright (c) 1994 The Australian National University.
32 * All rights reserved.
33 *
34 * Permission to use, copy, modify, and distribute this software and its
35 * documentation is hereby granted, provided that the above copyright
36 * notice appears in all copies. This software is provided without any
37 * warranty, express or implied. The Australian National University
38 * makes no representations about the suitability of this software for
39 * any purpose.
40 *
41 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
42 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
43 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
44 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
45 * OF SUCH DAMAGE.
46 *
47 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
48 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
49 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
50 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
51 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
52 * OR MODIFICATIONS.
53 *
54 * Copyright (c) 1989 Carnegie Mellon University.
55 * All rights reserved.
56 *
57 * Redistribution and use in source and binary forms are permitted
58 * provided that the above copyright notice and this paragraph are
59 * duplicated in all such forms and that any documentation,
60 * advertising materials, and other materials related to such
61 * distribution and use acknowledge that the software was developed
62 * by Carnegie Mellon University. The name of the
63 * University may not be used to endorse or promote products derived
64 * from this software without specific prior written permission.
65 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
66 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
67 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
68 *
69 * $FreeBSD: src/sys/net/if_pppvar.h,v 1.15 2000/01/29 16:56:23 peter Exp $
70 */
71
72 #include <sys/appleapiopts.h>
73 #ifndef DONT_WARN_OBSOLETE
74 #warning if_pppvar.h is not used by the darwin kernel
75 #endif
76
77 #ifdef KERNEL_PRIVATE
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 /*hi*/ u_int sc_flags; /* control/status bits; see if_ppp.h */
92 struct callout_handle sc_ch; /* Used for scheduling timeouts */
93 void *sc_devp; /* pointer to device-dep structure */
94 void (*sc_start)(struct ppp_softc *); /* start output proc */
95 void (*sc_ctlp)(struct ppp_softc *); /* rcvd control pkt */
96 void (*sc_relinq)(struct ppp_softc *); /* relinquish ifunit */
97 void (*sc_setmtu)(struct ppp_softc *); /* set mtu */
98 short sc_mru; /* max receive unit */
99 pid_t sc_xfer; /* used in transferring unit */
100 /*hi*/ struct ifqueue sc_rawq; /* received packets */
101 /*net*/ struct ifqueue sc_inq; /* queue of input packets for daemon */
102 /*net*/ struct ifqueue sc_fastq; /* interactive output packet q */
103 struct mbuf *sc_npqueue; /* output packets not to be sent yet */
104 struct mbuf **sc_npqtail; /* ptr to last next ptr in npqueue */
105 struct pppstat sc_stats; /* count of bytes/pkts sent/rcvd */
106 enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
107 struct compressor *sc_xcomp; /* transmit compressor */
108 void *sc_xc_state; /* transmit compressor state */
109 struct compressor *sc_rcomp; /* receive decompressor */
110 void *sc_rc_state; /* receive decompressor state */
111 time_t sc_last_sent; /* time (secs) last NP pkt sent */
112 time_t sc_last_recv; /* time (secs) last NP pkt rcvd */
113 #if PPP_FILTER
114 struct bpf_program sc_pass_filt; /* filter for packets to pass */
115 struct bpf_program sc_active_filt; /* filter for "non-idle" packets */
116 #endif /* PPP_FILTER */
117 #if 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 short sc_ilen; /* length of input packet so far */
129 u_short sc_fcs; /* FCS so far (input) */
130 u_short 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 };
134
135 extern struct ppp_softc ppp_softc[];
136
137 struct ppp_softc *pppalloc(pid_t pid);
138 void pppdealloc(struct ppp_softc *sc);
139 int pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data,
140 int flag, struct proc *p);
141 int pppoutput(struct ifnet *ifp, struct mbuf *m0,
142 struct sockaddr *dst, struct rtentry *rtp);
143 void ppp_restart(struct ppp_softc *sc);
144 void ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost);
145 struct mbuf *ppp_dequeue(struct ppp_softc *sc);
146 #endif /* __APPLE_API_PRIVATE */