root/include/linux/ppp.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


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

/* [previous][next][first][last][top][bottom][index][help] */