|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
26: /*
27: * if_ppp.h - Point-to-Point Protocol definitions.
28: *
29: * Copyright (c) 1989 Carnegie Mellon University.
30: * All rights reserved.
31: *
32: * Redistribution and use in source and binary forms are permitted
33: * provided that the above copyright notice and this paragraph are
34: * duplicated in all such forms and that any documentation,
35: * advertising materials, and other materials related to such
36: * distribution and use acknowledge that the software was developed
37: * by Carnegie Mellon University. The name of the
38: * University may not be used to endorse or promote products derived
39: * from this software without specific prior written permission.
40: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
41: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
42: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
43: */
44:
45: #ifndef _IF_PPP_H_
46: #define _IF_PPP_H_
47:
48: /*
49: * Standard PPP header.
50: */
51: struct ppp_header {
52: u_int8_t ph_address; /* Address Field */
53: u_int8_t ph_control; /* Control Field */
54: u_int16_t ph_protocol; /* Protocol Field */
55: };
56:
57: #define PPP_HDRLEN 4 /* sizeof(struct ppp_header) must be 4 */
58: #define PPP_FCSLEN 2 /* octets for FCS */
59:
60: #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
61: #define PPP_UI 0x03 /* Unnumbered Information */
62: #define PPP_FLAG 0x7e /* Flag Sequence */
63: #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
64: #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
65:
66: /*
67: * Protocol field values.
68: */
69: #define PPP_IP 0x21 /* Internet Protocol */
70: #define PPP_XNS 0x25 /* Xerox NS */
71: #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
72: #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
73: #define PPP_COMP 0xfd /* compressed packet */
74: #define PPP_LCP 0xc021 /* Link Control Protocol */
75: #define PPP_CCP 0x80fd /* Compression Control Protocol */
76:
77: /*
78: * Important FCS values.
79: */
80: #define PPP_INITFCS 0xffff /* Initial FCS value */
81: #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
82: #define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
83:
84: /*
85: * Packet sizes
86: */
87: #define PPP_MTU 1500 /* Default MTU (size of Info field) */
88: #define PPP_MRU 1500 /* Default MRU (max receive unit) */
89: #define PPP_MAXMRU 65000 /* Largest MRU we allow */
90:
91: /* Extended asyncmap - allows any character to be escaped. */
92: typedef u_int32_t ext_accm[8];
93:
94: /*
95: * Structure describing each ppp unit.
96: */
97: struct ppp_softc {
98: struct ifnet sc_if; /* network-visible interface */
99: u_int sc_flags; /* see below */
100: void *sc_devp; /* pointer to device-dependent structure */
101: int (*sc_start) __P((struct ppp_softc *)); /* start routine */
102: short sc_mru; /* max receive unit */
103: pid_t sc_xfer; /* used in xferring unit to another dev */
104: struct ifqueue sc_inq; /* TTY side input queue */
105: struct ifqueue sc_fastq; /* IP interactive output packet queue */
106: #ifdef VJC
107: struct slcompress sc_comp; /* vjc control buffer */
108: #endif
109: u_int sc_bytessent; /* count of octets sent */
110: u_int sc_bytesrcvd; /* count of octets received */
111: caddr_t sc_bpf; /* hook for BPF */
112:
113: /* Device-dependent part for async lines. */
114: ext_accm sc_asyncmap; /* async control character map */
115: u_int32_t sc_rasyncmap; /* receive async control char map */
116: struct mbuf *sc_outm; /* mbuf chain being output currently */
117: struct mbuf *sc_m; /* pointer to input mbuf chain */
118: struct mbuf *sc_mc; /* pointer to current input mbuf */
119: char *sc_mp; /* pointer to next char in input mbuf */
120: short sc_ilen; /* length of input-packet-so-far */
121: u_short sc_fcs; /* FCS so far (input) */
122: u_short sc_outfcs; /* FCS so far for output packet */
123: u_char sc_rawin[16]; /* chars as received */
124: int sc_rawin_count; /* # in sc_rawin */
125: };
126:
127: /* flags */
128: #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
129: #define SC_COMP_AC 0x00000002 /* header compression (output) */
130: #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
131: #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
132: #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
133: #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
134: #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
135: #define SC_DEBUG 0x00010000 /* enable debug messages */
136: #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
137: #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
138: #define SC_LOG_RAWIN 0x00080000 /* log all chars received */
139: #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
140: #define SC_MASK 0x0fffffff /* bits that user can change */
141:
142: /* state bits */
143: #define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */
144: #define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */
145: #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
146: #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 0 */
147: #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
148: #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
149:
150: /* this stuff doesn't belong here... */
151: #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
152: #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
153: #define PPPIOCGASYNCMAP _IOR('t', 88, int32_t) /* get async map */
154: #define PPPIOCSASYNCMAP _IOW('t', 87, int32_t) /* set async map */
155: #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
156: #define PPPIOCGRASYNCMAP _IOR('t', 85, int32_t) /* get receive async map */
157: #define PPPIOCSRASYNCMAP _IOW('t', 84, int32_t) /* set receive async map */
158: #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
159: #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
160: #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
161: #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
162: #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
163: #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
164:
165: #if !defined(ifr_mtu)
166: #define ifr_mtu ifr_metric
167: #endif
168:
169: #endif /* _IF_PPP_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.