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 * Alan Cox : Added SL_SLIP_LOTS
13 * Dmitry Gorodchanin : A lot of changes in the 'struct slip'
14 * Dmitry Gorodchanin : Added CSLIP statistics.
15 *
16 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
17 */
18 #ifndef _LINUX_SLIP_H
19 #define _LINUX_SLIP_H
20
21 #include <linux/config.h>
22
23 #if defined(CONFIG_INET) && defined(CONFIG_SLIP_COMPRESSED)
24 # define SL_INCLUDE_CSLIP
25 #endif
26
27 #ifdef SL_INCLUDE_CSLIP
28 # define SL_MODE_DEFAULT SL_MODE_ADAPTIVE
29 #else
30 # define SL_MODE_DEFAULT SL_MODE_SLIP
31 #endif
32
33 /* SLIP configuration. */
34 #ifndef SL_SLIP_LOTS
35 #define SL_NRUNIT 4 /* number of SLIP channels */
36 #else
37 #define SL_NRUNIT 16
38 #endif
39 #define SL_MTU 296 /* 296; I am used to 600- FvK */
40
41 /* SLIP protocol characters. */
42 #define END 0300 /* indicates end of frame */
43 #define ESC 0333 /* indicates byte stuffing */
44 #define ESC_END 0334 /* ESC ESC_END means END 'data' */
45 #define ESC_ESC 0335 /* ESC ESC_ESC means ESC 'data' */
46
47
48 struct slip {
49 int magic;
50
51 /* Various fields. */
52 struct tty_struct *tty; /* ptr to TTY structure */
53 struct device *dev; /* easy for intr handling */
54 #ifdef SL_INCLUDE_CSLIP
55 struct slcompress *slcomp; /* for header compression */
56 unsigned char *cbuff; /* compression buffer */
57 #endif
58
59 /* These are pointers to the malloc()ed frame buffers. */
60 unsigned char *rbuff; /* receiver buffer */
61 int rcount; /* received chars counter */
62 unsigned char *xbuff; /* transmitter buffer */
63 unsigned char *xhead; /* pointer to next byte to XMIT */
64 int xleft; /* bytes left in XMIT queue */
65
66 /* SLIP interface statistics. */
67 unsigned long rx_packets; /* inbound frames counter */
68 unsigned long tx_packets; /* outbound frames counter */
69 unsigned long rx_errors; /* Parity, etc. errors */
70 unsigned long tx_errors; /* Planned stuff */
71 unsigned long rx_dropped; /* No memory for skb */
72 unsigned long tx_dropped; /* When MTU change */
73 unsigned long rx_over_errors; /* Frame bigger then SLIP buf. */
74 #ifdef SL_INCLUDE_CSLIP
75 unsigned long tx_compressed;
76 unsigned long rx_compressed;
77 unsigned long tx_misses;
78 #endif
79 /* Detailed SLIP statistics. */
80
81 int mtu; /* Our mtu (to spot changes!) */
82 int buffsize; /* Max buffers sizes */
83
84 #ifdef CONFIG_SLIP_MODE_SLIP6
85 int xdata, xbits; /* 6 bit slip controls */
86 #endif
87
88 unsigned char flags; /* Flag values/ mode etc */
89 #define SLF_INUSE 0 /* Channel in use */
90 #define SLF_ESCAPE 1 /* ESC received */
91 #define SLF_ERROR 2 /* Parity, etc. error */
92
93 unsigned char mode; /* SLIP mode */
94 #define SL_MODE_SLIP 0
95 #define SL_MODE_CSLIP 1
96 #define SL_MODE_SLIP6 2 /* Matt Dillon's printable slip */
97 #define SL_MODE_CSLIP6 (SL_MODE_SLIP6|SL_MODE_CSLIP)
98 #define SL_MODE_AX25 4
99 #define SL_MODE_ADAPTIVE 8
100 #define SL_MODE_AX25VC 16
101 };
102
103
104
105 #define SLIP_MAGIC 0x5302
106
107 extern int slip_init(struct device *dev);
108
109 #endif /* _LINUX_SLIP.H */