162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * slip.h	Define the SLIP device driver interface and constants.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * NOTE:	THIS FILE WILL BE MOVED TO THE LINUX INCLUDE DIRECTORY
662306a36Sopenharmony_ci *		AS SOON AS POSSIBLE!
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Version:	@(#)slip.h	1.2.0	03/28/93
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * Fixes:
1162306a36Sopenharmony_ci *		Alan Cox	: 	Added slip mtu field.
1262306a36Sopenharmony_ci *		Matt Dillon	:	Printable slip (borrowed from net2e)
1362306a36Sopenharmony_ci *		Alan Cox	:	Added SL_SLIP_LOTS
1462306a36Sopenharmony_ci *	Dmitry Gorodchanin	:	A lot of changes in the 'struct slip'
1562306a36Sopenharmony_ci *	Dmitry Gorodchanin	:	Added CSLIP statistics.
1662306a36Sopenharmony_ci *	Stanislav Voronyi	:	Make line checking as created by
1762306a36Sopenharmony_ci *					Igor Chechik, RELCOM Corp.
1862306a36Sopenharmony_ci *	Craig Schlenter		:	Fixed #define bug that caused
1962306a36Sopenharmony_ci *					CSLIP telnets to hang in 1.3.61-6
2062306a36Sopenharmony_ci *
2162306a36Sopenharmony_ci * Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci#ifndef _LINUX_SLIP_H
2462306a36Sopenharmony_ci#define _LINUX_SLIP_H
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#if defined(CONFIG_INET) && defined(CONFIG_SLIP_COMPRESSED)
2862306a36Sopenharmony_ci# define SL_INCLUDE_CSLIP
2962306a36Sopenharmony_ci#endif
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#ifdef SL_INCLUDE_CSLIP
3262306a36Sopenharmony_ci# define SL_MODE_DEFAULT SL_MODE_ADAPTIVE
3362306a36Sopenharmony_ci#else
3462306a36Sopenharmony_ci# define SL_MODE_DEFAULT SL_MODE_SLIP
3562306a36Sopenharmony_ci#endif
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* SLIP configuration. */
3862306a36Sopenharmony_ci#define SL_NRUNIT	256		/* MAX number of SLIP channels;
3962306a36Sopenharmony_ci					   This can be overridden with
4062306a36Sopenharmony_ci					   insmod -oslip_maxdev=nnn	*/
4162306a36Sopenharmony_ci#define SL_MTU		296		/* 296; I am used to 600- FvK	*/
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/* some arch define END as assembly function ending, just undef it */
4462306a36Sopenharmony_ci#undef	END
4562306a36Sopenharmony_ci/* SLIP protocol characters. */
4662306a36Sopenharmony_ci#define END             0300		/* indicates end of frame	*/
4762306a36Sopenharmony_ci#define ESC             0333		/* indicates byte stuffing	*/
4862306a36Sopenharmony_ci#define ESC_END         0334		/* ESC ESC_END means END 'data'	*/
4962306a36Sopenharmony_ci#define ESC_ESC         0335		/* ESC ESC_ESC means ESC 'data'	*/
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_cistruct slip {
5362306a36Sopenharmony_ci  int			magic;
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci  /* Various fields. */
5662306a36Sopenharmony_ci  struct tty_struct	*tty;		/* ptr to TTY structure		*/
5762306a36Sopenharmony_ci  struct net_device	*dev;		/* easy for intr handling	*/
5862306a36Sopenharmony_ci  spinlock_t		lock;
5962306a36Sopenharmony_ci  struct work_struct	tx_work;	/* Flushes transmit buffer	*/
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#ifdef SL_INCLUDE_CSLIP
6262306a36Sopenharmony_ci  struct slcompress	*slcomp;	/* for header compression 	*/
6362306a36Sopenharmony_ci  unsigned char		*cbuff;		/* compression buffer		*/
6462306a36Sopenharmony_ci#endif
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci  /* These are pointers to the malloc()ed frame buffers. */
6762306a36Sopenharmony_ci  unsigned char		*rbuff;		/* receiver buffer		*/
6862306a36Sopenharmony_ci  int                   rcount;         /* received chars counter       */
6962306a36Sopenharmony_ci  unsigned char		*xbuff;		/* transmitter buffer		*/
7062306a36Sopenharmony_ci  unsigned char         *xhead;         /* pointer to next byte to XMIT */
7162306a36Sopenharmony_ci  int                   xleft;          /* bytes left in XMIT queue     */
7262306a36Sopenharmony_ci  int			mtu;		/* Our mtu (to spot changes!)   */
7362306a36Sopenharmony_ci  int                   buffsize;       /* Max buffers sizes            */
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#ifdef CONFIG_SLIP_MODE_SLIP6
7662306a36Sopenharmony_ci  int			xdata, xbits;	/* 6 bit slip controls 		*/
7762306a36Sopenharmony_ci#endif
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci  unsigned long		flags;		/* Flag values/ mode etc	*/
8062306a36Sopenharmony_ci#define SLF_INUSE	0		/* Channel in use               */
8162306a36Sopenharmony_ci#define SLF_ESCAPE	1               /* ESC received                 */
8262306a36Sopenharmony_ci#define SLF_ERROR	2               /* Parity, etc. error           */
8362306a36Sopenharmony_ci#define SLF_KEEPTEST	3		/* Keepalive test flag		*/
8462306a36Sopenharmony_ci#define SLF_OUTWAIT	4		/* is outpacket was flag	*/
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci  unsigned char		mode;		/* SLIP mode			*/
8762306a36Sopenharmony_ci  unsigned char		leased;
8862306a36Sopenharmony_ci  pid_t			pid;
8962306a36Sopenharmony_ci#define SL_MODE_SLIP	0
9062306a36Sopenharmony_ci#define SL_MODE_CSLIP	1
9162306a36Sopenharmony_ci#define SL_MODE_SLIP6	2		/* Matt Dillon's printable slip */
9262306a36Sopenharmony_ci#define SL_MODE_CSLIP6	(SL_MODE_SLIP6|SL_MODE_CSLIP)
9362306a36Sopenharmony_ci#define SL_MODE_AX25	4
9462306a36Sopenharmony_ci#define SL_MODE_ADAPTIVE 8
9562306a36Sopenharmony_ci#ifdef CONFIG_SLIP_SMART
9662306a36Sopenharmony_ci  unsigned char		outfill;	/* # of sec between outfill packet */
9762306a36Sopenharmony_ci  unsigned char		keepalive;	/* keepalive seconds		*/
9862306a36Sopenharmony_ci  struct timer_list	outfill_timer;
9962306a36Sopenharmony_ci  struct timer_list	keepalive_timer;
10062306a36Sopenharmony_ci#endif
10162306a36Sopenharmony_ci};
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define SLIP_MAGIC 0x5302
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci#endif	/* _LINUX_SLIP.H */
106