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