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