xref: /openbmc/linux/drivers/net/slip/slip.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2b5451d78SJeff Kirsher /*
3b5451d78SJeff Kirsher  * slip.h	Define the SLIP device driver interface and constants.
4b5451d78SJeff Kirsher  *
5b5451d78SJeff Kirsher  * NOTE:	THIS FILE WILL BE MOVED TO THE LINUX INCLUDE DIRECTORY
6b5451d78SJeff Kirsher  *		AS SOON AS POSSIBLE!
7b5451d78SJeff Kirsher  *
8b5451d78SJeff Kirsher  * Version:	@(#)slip.h	1.2.0	03/28/93
9b5451d78SJeff Kirsher  *
10b5451d78SJeff Kirsher  * Fixes:
11b5451d78SJeff Kirsher  *		Alan Cox	: 	Added slip mtu field.
12b5451d78SJeff Kirsher  *		Matt Dillon	:	Printable slip (borrowed from net2e)
13b5451d78SJeff Kirsher  *		Alan Cox	:	Added SL_SLIP_LOTS
14b5451d78SJeff Kirsher  *	Dmitry Gorodchanin	:	A lot of changes in the 'struct slip'
15b5451d78SJeff Kirsher  *	Dmitry Gorodchanin	:	Added CSLIP statistics.
16b5451d78SJeff Kirsher  *	Stanislav Voronyi	:	Make line checking as created by
17b5451d78SJeff Kirsher  *					Igor Chechik, RELCOM Corp.
18b5451d78SJeff Kirsher  *	Craig Schlenter		:	Fixed #define bug that caused
19b5451d78SJeff Kirsher  *					CSLIP telnets to hang in 1.3.61-6
20b5451d78SJeff Kirsher  *
21b5451d78SJeff Kirsher  * Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
22b5451d78SJeff Kirsher  */
23b5451d78SJeff Kirsher #ifndef _LINUX_SLIP_H
24b5451d78SJeff Kirsher #define _LINUX_SLIP_H
25b5451d78SJeff Kirsher 
26b5451d78SJeff Kirsher 
27b5451d78SJeff Kirsher #if defined(CONFIG_INET) && defined(CONFIG_SLIP_COMPRESSED)
28b5451d78SJeff Kirsher # define SL_INCLUDE_CSLIP
29b5451d78SJeff Kirsher #endif
30b5451d78SJeff Kirsher 
31b5451d78SJeff Kirsher #ifdef SL_INCLUDE_CSLIP
32b5451d78SJeff Kirsher # define SL_MODE_DEFAULT SL_MODE_ADAPTIVE
33b5451d78SJeff Kirsher #else
34b5451d78SJeff Kirsher # define SL_MODE_DEFAULT SL_MODE_SLIP
35b5451d78SJeff Kirsher #endif
36b5451d78SJeff Kirsher 
37b5451d78SJeff Kirsher /* SLIP configuration. */
38b5451d78SJeff Kirsher #define SL_NRUNIT	256		/* MAX number of SLIP channels;
39b5451d78SJeff Kirsher 					   This can be overridden with
40b5451d78SJeff Kirsher 					   insmod -oslip_maxdev=nnn	*/
41b5451d78SJeff Kirsher #define SL_MTU		296		/* 296; I am used to 600- FvK	*/
42b5451d78SJeff Kirsher 
43*e5b40668SHuang Pei /* some arch define END as assembly function ending, just undef it */
44*e5b40668SHuang Pei #undef	END
45b5451d78SJeff Kirsher /* SLIP protocol characters. */
46b5451d78SJeff Kirsher #define END             0300		/* indicates end of frame	*/
47b5451d78SJeff Kirsher #define ESC             0333		/* indicates byte stuffing	*/
48b5451d78SJeff Kirsher #define ESC_END         0334		/* ESC ESC_END means END 'data'	*/
49b5451d78SJeff Kirsher #define ESC_ESC         0335		/* ESC ESC_ESC means ESC 'data'	*/
50b5451d78SJeff Kirsher 
51b5451d78SJeff Kirsher 
52b5451d78SJeff Kirsher struct slip {
53b5451d78SJeff Kirsher   int			magic;
54b5451d78SJeff Kirsher 
55b5451d78SJeff Kirsher   /* Various fields. */
56b5451d78SJeff Kirsher   struct tty_struct	*tty;		/* ptr to TTY structure		*/
57b5451d78SJeff Kirsher   struct net_device	*dev;		/* easy for intr handling	*/
58b5451d78SJeff Kirsher   spinlock_t		lock;
59661f7fdaSTyler Hall   struct work_struct	tx_work;	/* Flushes transmit buffer	*/
60b5451d78SJeff Kirsher 
61b5451d78SJeff Kirsher #ifdef SL_INCLUDE_CSLIP
62b5451d78SJeff Kirsher   struct slcompress	*slcomp;	/* for header compression 	*/
63b5451d78SJeff Kirsher   unsigned char		*cbuff;		/* compression buffer		*/
64b5451d78SJeff Kirsher #endif
65b5451d78SJeff Kirsher 
66b5451d78SJeff Kirsher   /* These are pointers to the malloc()ed frame buffers. */
67b5451d78SJeff Kirsher   unsigned char		*rbuff;		/* receiver buffer		*/
68b5451d78SJeff Kirsher   int                   rcount;         /* received chars counter       */
69b5451d78SJeff Kirsher   unsigned char		*xbuff;		/* transmitter buffer		*/
70b5451d78SJeff Kirsher   unsigned char         *xhead;         /* pointer to next byte to XMIT */
71b5451d78SJeff Kirsher   int                   xleft;          /* bytes left in XMIT queue     */
72b5451d78SJeff Kirsher   int			mtu;		/* Our mtu (to spot changes!)   */
73b5451d78SJeff Kirsher   int                   buffsize;       /* Max buffers sizes            */
74b5451d78SJeff Kirsher 
75b5451d78SJeff Kirsher #ifdef CONFIG_SLIP_MODE_SLIP6
76b5451d78SJeff Kirsher   int			xdata, xbits;	/* 6 bit slip controls 		*/
77b5451d78SJeff Kirsher #endif
78b5451d78SJeff Kirsher 
79b5451d78SJeff Kirsher   unsigned long		flags;		/* Flag values/ mode etc	*/
80b5451d78SJeff Kirsher #define SLF_INUSE	0		/* Channel in use               */
81b5451d78SJeff Kirsher #define SLF_ESCAPE	1               /* ESC received                 */
82b5451d78SJeff Kirsher #define SLF_ERROR	2               /* Parity, etc. error           */
83b5451d78SJeff Kirsher #define SLF_KEEPTEST	3		/* Keepalive test flag		*/
84b5451d78SJeff Kirsher #define SLF_OUTWAIT	4		/* is outpacket was flag	*/
85b5451d78SJeff Kirsher 
86b5451d78SJeff Kirsher   unsigned char		mode;		/* SLIP mode			*/
87b5451d78SJeff Kirsher   unsigned char		leased;
88b5451d78SJeff Kirsher   pid_t			pid;
89b5451d78SJeff Kirsher #define SL_MODE_SLIP	0
90b5451d78SJeff Kirsher #define SL_MODE_CSLIP	1
91b5451d78SJeff Kirsher #define SL_MODE_SLIP6	2		/* Matt Dillon's printable slip */
92b5451d78SJeff Kirsher #define SL_MODE_CSLIP6	(SL_MODE_SLIP6|SL_MODE_CSLIP)
93b5451d78SJeff Kirsher #define SL_MODE_AX25	4
94b5451d78SJeff Kirsher #define SL_MODE_ADAPTIVE 8
95b5451d78SJeff Kirsher #ifdef CONFIG_SLIP_SMART
96b5451d78SJeff Kirsher   unsigned char		outfill;	/* # of sec between outfill packet */
97b5451d78SJeff Kirsher   unsigned char		keepalive;	/* keepalive seconds		*/
98b5451d78SJeff Kirsher   struct timer_list	outfill_timer;
99b5451d78SJeff Kirsher   struct timer_list	keepalive_timer;
100b5451d78SJeff Kirsher #endif
101b5451d78SJeff Kirsher };
102b5451d78SJeff Kirsher 
103b5451d78SJeff Kirsher #define SLIP_MAGIC 0x5302
104b5451d78SJeff Kirsher 
105b5451d78SJeff Kirsher #endif	/* _LINUX_SLIP.H */
106