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