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