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 int magic; 31 /* Bitmapped flag fields. */ 32 char inuse; /* are we allocated? */ 33 char sending; /* "channel busy" indicator */ 34 char escape; /* SLIP state machine */ 35 char unused; /* fillers */ 36 37 /* Various fields. */ 38 int line; /* SLIP channel number */ 39 struct tty_struct *tty; /* ptr to TTY structure */ 40 struct device *dev; /* easy for intr handling */ 41 struct slcompress *slcomp; /* for header compression */ 42 43 /* These are pointers to the malloc()ed frame buffers. */ 44 unsigned char *rbuff; /* receiver buffer */ 45 unsigned char *xbuff; /* transmitter buffer */ 46 unsigned char *cbuff; /* compression buffer */ 47 48 /* These are the various pointers into the buffers. */ 49 unsigned char *rhead; /* RECV buffer pointer (head) */ 50 unsigned char *rend; /* RECV buffer pointer (end) */ 51 int rcount; /* SLIP receive counter */ 52 unsigned char *xhead; /* XMIT buffer pointer (head) */ 53 unsigned char *xtail; /* XMIT buffer pointer (tail) */ 54 55 /* SLIP interface statistics. */ 56 unsigned long rpacket; /* inbound frame counter */ 57 unsigned long roverrun; /* "buffer overrun" counter */ 58 unsigned long spacket; /* outbound frames counter */ 59 unsigned long sbusy; /* "transmitter busy" counter */ 60 unsigned long errors; /* error count */ 61 62 int mtu; /* Our mtu (to spot changes!) */ 63 unsigned char flags; /* Flag values/ mode etc */ 64 #define SLF_ESCAPE 2 65 #define SLF_ERROR 4 66 #define SLF_COMP 16 67 #define SLF_EXPN 32 68 #define SLF_XMIT_BUSY 64 69 unsigned char mode; /* SLIP mode */ 70 #define SL_MODE_SLIP 0 71 #define SL_MODE_CSLIP 1 72 #define SL_MODE_SLIP6 2 /* Matt Dillon's printable slip */ 73 #define SL_MODE_CSLIP6 (SL_MODE_SLIP6|SL_MODE_CSLIP) 74 #define SL_MODE_AX25 4 75 #define SL_MODE_ADAPTIVE 8 76 int xdata,xbits; /* 6 bit slip controls */ 77 }; 78 79 #define SLIP_MAGIC 0x5302 80 81 extern int slip_init(struct device *dev); 82 extern int slip_esc(unsigned char *s, unsigned char *d, int len); 83 extern int slip_esc6(unsigned char *s, unsigned char *d, int len); 84 extern void slip_unesc(struct slip *sl, unsigned char s); 85 extern void slip_unesc6(struct slip *sl, unsigned char s); 86 87 #endif /* _LINUX_SLIP.H */