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 #define SL_NRUNIT 256 /* MAX number of SLIP channels;
35 This can be overridden with
36 insmod -oslip_maxdev=nnn */
37 #define SL_MTU 296 /* 296; I am used to 600- FvK */
38
39 /* SLIP protocol characters. */
40 #define END 0300 /* indicates end of frame */
41 #define ESC 0333 /* indicates byte stuffing */
42 #define ESC_END 0334 /* ESC ESC_END means END 'data' */
43 #define ESC_ESC 0335 /* ESC ESC_ESC means ESC 'data' */
44
45
46 struct slip {
47 int magic;
48
49 /* Various fields. */
50 struct tty_struct *tty; /* ptr to TTY structure */
51 struct device *dev; /* easy for intr handling */
52 #ifdef SL_INCLUDE_CSLIP
53 struct slcompress *slcomp; /* for header compression */
54 unsigned char *cbuff; /* compression buffer */
55 #endif
56
57 /* These are pointers to the malloc()ed frame buffers. */
58 unsigned char *rbuff; /* receiver buffer */
59 int rcount; /* received chars counter */
60 unsigned char *xbuff; /* transmitter buffer */
61 unsigned char *xhead; /* pointer to next byte to XMIT */
62 int xleft; /* bytes left in XMIT queue */
63
64 /* SLIP interface statistics. */
65 unsigned long rx_packets; /* inbound frames counter */
66 unsigned long tx_packets; /* outbound frames counter */
67 unsigned long rx_errors; /* Parity, etc. errors */
68 unsigned long tx_errors; /* Planned stuff */
69 unsigned long rx_dropped; /* No memory for skb */
70 unsigned long tx_dropped; /* When MTU change */
71 unsigned long rx_over_errors; /* Frame bigger then SLIP buf. */
72 #ifdef SL_INCLUDE_CSLIP
73 unsigned long tx_compressed;
74 unsigned long rx_compressed;
75 unsigned long tx_misses;
76 #endif
77 /* Detailed SLIP statistics. */
78
79 int mtu; /* Our mtu (to spot changes!) */
80 int buffsize; /* Max buffers sizes */
81
82 #ifdef CONFIG_SLIP_MODE_SLIP6
83 int xdata, xbits; /* 6 bit slip controls */
84 #endif
85
86 unsigned char flags; /* Flag values/ mode etc */
87 #define SLF_INUSE 0 /* Channel in use */
88 #define SLF_ESCAPE 1 /* ESC received */
89 #define SLF_ERROR 2 /* Parity, etc. error */
90
91 unsigned char mode; /* SLIP mode */
92 #define SL_MODE_SLIP 0
93 #define SL_MODE_CSLIP 1
94 #define SL_MODE_SLIP6 2 /* Matt Dillon's printable slip */
95 #define SL_MODE_CSLIP6 (SL_MODE_SLIP6|SL_MODE_CSLIP)
96 #define SL_MODE_AX25 4
97 #define SL_MODE_ADAPTIVE 8
98 };
99
100
101
102 #define SLIP_MAGIC 0x5302
103
104 extern int slip_init(struct device *dev);
105
106 #endif /* _LINUX_SLIP.H */