2 * if_ppp.h - Point-to-Point Protocol definitions.
4 * Copyright (c) 1989 Carnegie Mellon University.
7 * Redistribution and use in source and binary forms are permitted
8 * provided that the above copyright notice and this paragraph are
9 * duplicated in all such forms and that any documentation,
10 * advertising materials, and other materials related to such
11 * distribution and use acknowledge that the software was developed
12 * by Carnegie Mellon University. The name of the
13 * University may not be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 * $Id: if_ppp.h,v 1.5 1994/09/16 01:54:06 paulus Exp $
26 * Standard PPP header.
29 u_char ph_address; /* Address Field */
30 u_char ph_control; /* Control Field */
31 u_short ph_protocol; /* Protocol Field */
34 #define PPP_HDRLEN 4 /* sizeof(struct ppp_header) must be 4 */
35 #define PPP_FCSLEN 2 /* octets for FCS */
37 #define PPP_ADDRESS(p) (((u_char *)(p))[0])
38 #define PPP_CONTROL(p) (((u_char *)(p))[1])
39 #define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
42 * Significant octet values.
44 #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
45 #define PPP_UI 0x03 /* Unnumbered Information */
46 #define PPP_FLAG 0x7e /* Flag Sequence */
47 #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
48 #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
51 * Protocol field values.
53 #define PPP_IP 0x21 /* Internet Protocol */
54 #define PPP_XNS 0x25 /* Xerox NS */
55 #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
56 #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
57 #define PPP_COMP 0xfd /* compressed packet */
58 #define PPP_LCP 0xc021 /* Link Control Protocol */
59 #define PPP_CCP 0x80fd /* Compression Control Protocol */
62 * Important FCS values.
64 #define PPP_INITFCS 0xffff /* Initial FCS value */
65 #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
66 #define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
71 #define PPP_MTU 1500 /* Default MTU (size of Info field) */
72 #define PPP_MRU 1500 /* Default MRU (max receive unit) */
73 #define PPP_MAXMRU 65000 /* Largest MRU we allow */
75 /* Extended asyncmap - allows any character to be escaped. */
76 typedef u_long ext_accm[8];
79 * What to do with network protocol (NP) packets.
82 NPMODE_PASS, /* pass the packet through */
83 NPMODE_DROP, /* silently drop the packet */
84 NPMODE_ERROR, /* return an error */
85 NPMODE_QUEUE /* save it up for later. */
89 * Supported network protocols. These values are used for
92 #define NP_IP 0 /* Internet Protocol */
93 #define NUM_NP 1 /* Number of NPs. */
96 * Structure describing each ppp unit.
99 struct ifnet sc_if; /* network-visible interface */
100 u_int sc_flags; /* see below */
101 void *sc_devp; /* pointer to device-dep structure */
102 int (*sc_start)(); /* start routine */
103 short sc_mru; /* max receive unit */
104 pid_t sc_xfer; /* used in transferring unit */
105 struct ifqueue sc_inq; /* TTY side input queue */
106 struct ifqueue sc_fastq; /* IP interactive output packet q */
108 struct slcompress sc_comp; /* vjc control buffer */
110 u_int sc_bytessent; /* count of octets sent */
111 u_int sc_bytesrcvd; /* count of octets received */
112 caddr_t sc_bpf; /* hook for BPF */
113 enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
114 struct compressor *sc_xcomp; /* transmit compressor */
115 void *sc_xc_state; /* transmit compressor state */
116 struct compressor *sc_rcomp; /* receive decompressor */
117 void *sc_rc_state; /* receive decompressor state */
119 /* Device-dependent part for async lines. */
120 ext_accm sc_asyncmap; /* async control character map */
121 u_long sc_rasyncmap; /* receive async control char map */
122 struct mbuf *sc_outm; /* mbuf chain currently being output */
123 struct mbuf *sc_m; /* pointer to input mbuf chain */
124 struct mbuf *sc_mc; /* pointer to current input mbuf */
125 char *sc_mp; /* ptr to next char in input mbuf */
126 short sc_ilen; /* length of input packet so far */
127 u_short sc_fcs; /* FCS so far (input) */
128 u_short sc_outfcs; /* FCS so far for output packet */
129 u_char sc_rawin[16]; /* chars as received */
130 int sc_rawin_count; /* # in sc_rawin */
134 #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
135 #define SC_COMP_AC 0x00000002 /* header compression (output) */
136 #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
137 #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
138 #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
139 #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
140 #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
141 #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
142 #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
143 #define SC_COMP_RUN 0x00001000 /* compressor has been inited */
144 #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
145 #define SC_DEBUG 0x00010000 /* enable debug messages */
146 #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
147 #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
148 #define SC_LOG_RAWIN 0x00080000 /* log all chars received */
149 #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
150 #define SC_MASK 0x0fffffff /* bits that user can change */
153 #define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */
154 #define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */
155 #define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */
156 #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
157 #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
158 #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
159 #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
160 #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
161 #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
168 int protocol; /* PPP procotol, e.g. PPP_IP */
172 /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
173 struct ppp_option_data {
179 /* this stuff doesn't belong here... */
180 #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
181 #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
182 #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
183 #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
184 #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
185 #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
186 #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
187 #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
188 #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
189 #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
190 #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
191 #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
192 #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
193 #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
194 #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
195 #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
198 #define ifr_mtu ifr_ifru.ifru_metric
201 #if !defined(ifr_mtu)
202 #define ifr_mtu ifr_metric
205 #endif /* _IF_PPP_H_ */