1 #ifndef _LINUX_IF_PPP_H 2 #define _LINUX_IF_PPP_H 3 4 /* definitions for kernel PPP module 5 Michael Callahan <callahan@maths.ox.ac.uk> 6 Nov. 4 1993 */ 7 8 /* how many PPP units? */ 9 #ifdef CONFIG_PPP_LOTS 10 #define PPP_NRUNIT 16 11 #else 12 #define PPP_NRUNIT 4 13 #endif 14 15 #define PPP_VERSION "0.2.7" 16 17 /* line discipline number */ 18 #define N_PPP 3 19 20 /* Magic value for the ppp structure */ 21 #define PPP_MAGIC 0x5002 22 23 #define PPPIOCGFLAGS 0x5490 /* get configuration flags */ 24 #define PPPIOCSFLAGS 0x5491 /* set configuration flags */ 25 #define PPPIOCGASYNCMAP 0x5492 /* get async map */ 26 #define PPPIOCSASYNCMAP 0x5493 /* set async map */ 27 #define PPPIOCGUNIT 0x5494 /* get ppp unit number */ 28 #define PPPIOCSINPSIG 0x5495 /* set input ready signal */ 29 #define PPPIOCSDEBUG 0x5497 /* set debug level */ 30 #define PPPIOCGDEBUG 0x5498 /* get debug level */ 31 #define PPPIOCGSTAT 0x5499 /* read PPP statistic information */ 32 #define PPPIOCGTIME 0x549A /* read time delta information */ 33 #define PPPIOCGXASYNCMAP 0x549B /* get async table */ 34 #define PPPIOCSXASYNCMAP 0x549C /* set async table */ 35 #define PPPIOCSMRU 0x549D /* set receive unit size for PPP */ 36 #define PPPIOCRASYNCMAP 0x549E /* set receive async map */ 37 #define PPPIOCSMAXCID 0x549F /* set the maximum compression slot id */ 38 39 /* special characters in the framing protocol */ 40 #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ 41 #define PPP_UI 0x03 /* Unnumbered Information */ 42 #define PPP_FLAG 0x7E /* frame delimiter -- marks frame boundaries */ 43 #define PPP_ADDRESS 0xFF /* first character of frame <-- (may be */ 44 #define PPP_CONTROL 0x03 /* second character of frame <-- compressed)*/ 45 #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ 46 #define PPP_ESC 0x7d /* escape character -- next character is 47 data, and the PPP_TRANS bit should be 48 toggled. PPP_ESC PPP_FLAG is illegal */ 49 50 /* protocol numbers */ 51 #define PROTO_IP 0x0021 52 #define PROTO_VJCOMP 0x002d 53 #define PROTO_VJUNCOMP 0x002f 54 55 /* FCS support */ 56 #define PPP_FCS_INIT 0xffff 57 #define PPP_FCS_GOOD 0xf0b8 58 59 /* initial MTU */ 60 #define PPP_MTU 1500 61 62 /* initial MRU */ 63 #define PPP_MRU PPP_MTU 64 65 /* flags */ 66 #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ 67 #define SC_COMP_AC 0x00000002 /* header compression (output) */ 68 #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ 69 #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ 70 #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ 71 #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ 72 #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ 73 #define SC_IP_DOWN 0x00000200 /* give ip frames to pppd */ 74 #define SC_IP_FLUSH 0x00000400 /* "next time" flag for IP_DOWN */ 75 #define SC_DEBUG 0x00010000 /* enable debug messages */ 76 #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ 77 #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ 78 #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ 79 #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ 80 81 /* Flag bits to determine state of input characters */ 82 #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ 83 #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 0 */ 84 #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ 85 #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ 86 87 #define SC_MASK 0x0fffffff /* bits that user can change */ 88 89 /* flag for doing transmitter lockout */ 90 #define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */ 91 92 /* 93 * This is the format of the data buffer of a LQP packet. The packet data 94 * is sent/received to the peer. 95 */ 96 97 struct ppp_lqp_packet_hdr { 98 __u32 LastOutLQRs; /* Copied from PeerOutLQRs */ 99 __u32 LastOutPackets; /* Copied from PeerOutPackets */ 100 __u32 LastOutOctets; /* Copied from PeerOutOctets */ 101 __u32 PeerInLQRs; /* Copied from SavedInLQRs */ 102 __u32 PeerInPackets; /* Copied from SavedInPackets */ 103 __u32 PeerInDiscards; /* Copied from SavedInDiscards */ 104 __u32 PeerInErrors; /* Copied from SavedInErrors */ 105 __u32 PeerInOctets; /* Copied from SavedInOctets */ 106 __u32 PeerOutLQRs; /* Copied from OutLQRs, plus 1 */ 107 __u32 PeerOutPackets; /* Current ifOutUniPackets, + 1 */ 108 __u32 PeerOutOctets; /* Current ifOutOctets + LQR */ 109 }; 110 111 /* 112 * This data is not sent to the remote. It is updated by the driver when 113 * a packet is received. 114 */ 115 116 struct ppp_lqp_packet_trailer { 117 __u32 SaveInLQRs; /* Current InLQRs on reception */ 118 __u32 SaveInPackets; /* Current ifInUniPackets */ 119 __u32 SaveInDiscards; /* Current ifInDiscards */ 120 __u32 SaveInErrors; /* Current ifInErrors */ 121 __u32 SaveInOctets; /* Current ifInOctects */ 122 }; 123 124 /* 125 * PPP LQP packet. The packet is changed by the driver immediately prior 126 * to transmission and updated upon reception with the current values. 127 * So, it must be known to the driver as well as the pppd software. 128 */ 129 130 struct ppp_lpq_packet { 131 __u32 magic; /* current magic value */ 132 struct ppp_lqp_packet_hdr hdr; /* Header fields for structure */ 133 struct ppp_lqp_packet_trailer tail; /* Trailer fields (not sent) */ 134 }; 135 136 /* 137 * PPP interface statistics. (used by LQP / pppstats) 138 */ 139 140 struct ppp_stats { 141 __u32 rbytes; /* bytes received */ 142 __u32 rcomp; /* compressed packets received */ 143 __u32 runcomp; /* uncompressed packets received */ 144 __u32 rothers; /* non-ip frames received */ 145 __u32 rerrors; /* received errors */ 146 __u32 roverrun; /* "buffer overrun" counter */ 147 __u32 tossed; /* packets discarded */ 148 __u32 runts; /* frames too short to process */ 149 __u32 rgiants; /* frames too large to process */ 150 __u32 sbytes; /* bytes sent */ 151 __u32 scomp; /* compressed packets sent */ 152 __u32 suncomp; /* uncompressed packets sent */ 153 __u32 sothers; /* non-ip frames sent */ 154 __u32 serrors; /* transmitter errors */ 155 __u32 sbusy; /* "transmitter busy" counter */ 156 }; 157 158 /* 159 * Demand dial fields 160 */ 161 162 struct ppp_ddinfo { 163 unsigned long ip_sjiffies; /* time when last IP frame sent */ 164 unsigned long ip_rjiffies; /* time when last IP frame recvd*/ 165 unsigned long nip_sjiffies; /* time when last NON-IP sent */ 166 unsigned long nip_rjiffies; /* time when last NON-IP recvd */ 167 }; 168 169 #ifdef __KERNEL__ 170 171 struct ppp { 172 int magic; /* magic value for structure */ 173 174 /* Bitmapped flag fields. */ 175 char sending; /* "channel busy" indicator */ 176 char escape; /* 0x20 if prev char was PPP_ESC*/ 177 char toss; /* toss this frame */ 178 unsigned long inuse; /* are we allocated? */ 179 180 unsigned int flags; /* miscellany */ 181 182 __u32 xmit_async_map[8]; /* 1 bit means that given control 183 character is quoted on output*/ 184 185 __u32 recv_async_map; /* 1 bit means that given control 186 character is ignored on input*/ 187 int mtu; /* maximum xmit frame size */ 188 int mru; /* maximum receive frame size */ 189 unsigned short fcs; /* FCS field of current frame */ 190 191 /* Various fields. */ 192 int line; /* PPP channel number */ 193 struct tty_struct *tty; /* ptr to TTY structure */ 194 struct device *dev; /* easy for intr handling */ 195 struct slcompress *slcomp; /* for header compression */ 196 unsigned long last_xmit; /* time of last transmission */ 197 198 /* These are pointers to the malloc()ed frame buffers. 199 These buffers are used while processing a packet. If a packet 200 has to hang around for the user process to read it, it lingers in 201 the user buffers below. */ 202 unsigned char *rbuff; /* receiver buffer */ 203 unsigned char *xbuff; /* transmitter buffer */ 204 unsigned char *cbuff; /* compression buffer */ 205 206 /* These are the various pointers into the buffers. */ 207 unsigned char *rhead; /* RECV buffer pointer (head) */ 208 unsigned char *rend; /* RECV buffer pointer (end) */ 209 int rcount; /* PPP receive counter */ 210 unsigned char *xhead; /* XMIT buffer pointer (head) */ 211 unsigned char *xtail; /* XMIT buffer pointer (end) */ 212 213 /* Structures for interfacing with the user process. */ 214 #define RBUFSIZE 4000 215 unsigned char *us_rbuff; /* circular incoming packet buf.*/ 216 unsigned char *us_rbuff_end; /* end of allocated space */ 217 unsigned char *us_rbuff_head; /* head of waiting packets */ 218 unsigned char *us_rbuff_tail; /* tail of waiting packets */ 219 unsigned long us_rbuff_lock; /* lock: bit 0 head bit 1 tail */ 220 int inp_sig; /* input ready signal for pgrp */ 221 int inp_sig_pid; /* process to get notified */ 222 223 /* items to support the select() function */ 224 struct wait_queue *write_wait; /* queue for reading processes */ 225 struct wait_queue *read_wait; /* queue for writing processes */ 226 227 /* PPP interface statistics. */ 228 struct ppp_stats stats; /* statistic information */ 229 230 /* PPP demand dial information. */ 231 struct ppp_ddinfo ddinfo; /* demand dial information */ 232 }; 233 234 #endif /* __KERNEL__ */ 235 #endif /* _LINUX_PPP_H */ 236 237