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