updated ifnet structure to have larger if_flags field. added additional
[unix-history] / sys / net / if_ppp.h
CommitLineData
8b3438a6
RG
1/*
2 * if_ppp.h - Point-to-Point Protocol definitions.
3 *
4 * Copyright (c) 1989 Carnegie Mellon University.
5 * All rights reserved.
6 *
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.
18 *
19 * Modified by Paul Mackerras (paulus@cs.anu.edu.au)
20 * PPP_MRU added, PPP_MTU changed to 296 (default only), added sc_outm.
21 *
22 * $Id$
23 * From: if_ppp.h,v 1.3 1993/08/09 02:37:32 paulus Exp
24 */
25
26/*
27 * Standard PPP header.
28 */
29struct ppp_header {
30 u_char ph_address; /* Address Field */
31 u_char ph_control; /* Control Field */
32 u_short ph_protocol; /* Protocol Field */
33};
34
35#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
36#define PPP_UI 0x03 /* Unnumbered Information */
37#define PPP_FLAG 0x7e /* Flag Sequence */
38#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
39#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
40
41/*
42 * Protocol types.
43 */
44#define PPP_IP 0x21 /* Internet Protocol */
45#define PPP_XNS 0x25 /* Xerox NS */
46#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
47#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
48#define PPP_LCP 0xc021 /* Link Control Protocol */
49
50/*
51 * Important FCS values.
52 */
53#define PPP_INITFCS 0xffff /* Initial FCS value */
54#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
55#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
56
57#define PPP_MTU 296 /* Default MTU (size of Info field) */
58#define PPP_MRU 1500 /* Default MRU (max receive unit) */
59#define PPP_HIWAT 400 /* Don't start a new packet if HIWAT on que */
60
61struct ppp_softc {
62 struct ifnet sc_if; /* network-visible interface */
63 u_int sc_flags; /* see below */
64 struct tty *sc_ttyp; /* pointer to tty structure */
65 struct mbuf *sc_outm; /* mbuf chain being output currently */
66 struct mbuf *sc_m; /* pointer to input mbuf chain */
67 struct mbuf *sc_mc; /* pointer to current input mbuf */
68 char *sc_mp; /* pointer to next char in input mbuf */
69 short sc_ilen; /* length of input-packet-so-far */
70 u_short sc_fcs; /* FCS so far */
71 u_long sc_asyncmap; /* async control character map */
72 struct ifqueue sc_inq; /* TTY side input queue */
73#ifdef VJC
74 struct slcompress sc_comp; /* vjc control buffer */
75#endif
76 u_int sc_bytessent;
77 u_int sc_bytesrcvd;
78};
79
80/* flags */
81#define SC_ESCAPED 0x00010000 /* saw a PPP_ESCAPE */
82#define SC_FLUSH 0x00020000 /* flush input until next PPP_FLAG */
83#define SC_COMP_PROT 0x00000001 /* protocol compression */
84#define SC_COMP_AC 0x00000002 /* header compression */
85#define SC_COMP_TCP 0x00000004 /* TCP traffic (VJ) compression */
86
87#define t_sc T_LINEP
88
89/* this stuff doesn't belong here... */
90#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
91#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
92#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
93#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
94#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
95
96/* old copies of PPP may have defined this */
97#if !defined(ifr_mtu)
98#define ifr_mtu ifr_metric
99#endif
100