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