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