home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.0 / LINUX-1.0 / LINUX-1 / linux / drivers / net / slip.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-08  |  2.8 KB  |  84 lines

  1. /*
  2.  * slip.h    Define the SLIP device driver interface and constants.
  3.  *
  4.  * NOTE:    THIS FILE WILL BE MOVED TO THE LINUX INCLUDE DIRECTORY
  5.  *        AS SOON AS POSSIBLE!
  6.  *
  7.  * Version:    @(#)slip.h    1.2.0    03/28/93
  8.  *
  9.  * Fixes:
  10.  *        Alan Cox    :     Added slip mtu field.
  11.  *        Matt Dillon    :    Printable slip (borrowed from net2e)
  12.  *
  13.  * Author:    Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
  14.  */
  15. #ifndef _LINUX_SLIP_H
  16. #define _LINUX_SLIP_H
  17.  
  18. /* SLIP configuration. */
  19. #define SL_NRUNIT    4        /* number of SLIP channels    */
  20. #define SL_MTU        296        /* 296; I am used to 600- FvK    */
  21.  
  22. /* SLIP protocol characters. */
  23. #define END             0300        /* indicates end of frame    */
  24. #define ESC             0333        /* indicates byte stuffing    */
  25. #define ESC_END         0334        /* ESC ESC_END means END 'data'    */
  26. #define ESC_ESC         0335        /* ESC ESC_ESC means ESC 'data'    */
  27.  
  28.  
  29. struct slip {
  30.   /* Bitmapped flag fields. */
  31.   char            inuse;        /* are we allocated?        */
  32.   char            sending;    /* "channel busy" indicator    */
  33.   char            escape;        /* SLIP state machine        */
  34.   char            unused;        /* fillers            */
  35.  
  36.   /* Various fields. */
  37.   int            line;        /* SLIP channel number        */
  38.   struct tty_struct    *tty;        /* ptr to TTY structure        */
  39.   struct device        *dev;        /* easy for intr handling    */
  40.   struct slcompress    *slcomp;    /* for header compression     */
  41.  
  42.   /* These are pointers to the malloc()ed frame buffers. */
  43.   unsigned char        *rbuff;        /* receiver buffer        */
  44.   unsigned char        *xbuff;        /* transmitter buffer        */
  45.   unsigned char        *cbuff;        /* compression buffer        */
  46.  
  47.   /* These are the various pointers into the buffers. */
  48.   unsigned char        *rhead;        /* RECV buffer pointer (head)    */
  49.   unsigned char        *rend;        /* RECV buffer pointer (end)    */
  50.   int            rcount;        /* SLIP receive counter        */
  51.  
  52.   /* SLIP interface statistics. */
  53.   unsigned long        rpacket;    /* inbound frame counter    */
  54.   unsigned long        roverrun;    /* "buffer overrun" counter    */
  55.   unsigned long        spacket;    /* outbound frames counter    */
  56.   unsigned long        sbusy;        /* "transmitter busy" counter    */
  57.   unsigned long        errors;        /* error count            */
  58.   
  59.   int            mtu;        /* Our mtu (to spot changes!)   */
  60.   unsigned char        flags;        /* Flag values/ mode etc    */
  61. #define SLF_ESCAPE    2
  62. #define SLF_ERROR    4
  63. #define SLF_COMP    16
  64. #define SLF_EXPN    32
  65.   unsigned char        mode;        /* SLIP mode            */
  66. #define SL_MODE_SLIP    0
  67. #define SL_MODE_CSLIP    1
  68. #define SL_MODE_SLIP6    2        /* Matt Dillon's printable slip */
  69. #define SL_MODE_CSLIP6    (SL_MODE_SLIP6|SL_MODE_CSLIP)
  70. #define SL_MODE_AX25    4
  71. #define SL_MODE_ADAPTIVE 8
  72.   int            xdata,xbits;    /* 6 bit slip controls         */
  73. };
  74.  
  75.  
  76. extern int    slip_init(struct device *dev);
  77. extern int    slip_esc(unsigned char *s, unsigned char *d, int len);
  78. extern int    slip_esc6(unsigned char *s, unsigned char *d, int len);
  79. extern void    slip_unesc(struct slip *sl, unsigned char *s, int count, int error);
  80. extern void     slip_unesc6(struct slip *sl, unsigned char *s, int count, int error);
  81.  
  82.  
  83. #endif    /* _LINUX_SLIP.H */
  84.