summaryrefslogtreecommitdiffstats
path: root/drivers/net/hamradio/kiss.h
blob: f4df5720db378be5e6ca447d83daed334f0dd6f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * kiss.h	Define the KISS device driver interface and constants.
 *
 * NOTE:	THIS FILE WILL BE MOVED TO THE LINUX INCLUDE DIRECTORY
 *		AS SOON AS POSSIBLE!
 *
 * Version:	@(#)kiss.h	1.2.0	03/28/93
 *
 * Fixes:
 *		Alan Cox	: 	Added slip mtu field.
 *		Matt Dillon	:	Printable slip (borrowed from net2e)
 *		Alan Cox	:	Added SL_SLIP_LOTS
 *	Dmitry Gorodchanin	:	A lot of changes in the 'struct slip'
 *	Dmitry Gorodchanin	:	Added CSLIP statistics.
 *	Stanislav Voronyi	:	Make line checking as created by
 *					Igor Chechik, RELCOM Corp.
 *	Craig Schlenter		:	Fixed #define bug that caused
 *					CSLIP telnets to hang in 1.3.61-6
 *
 * Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
 */
#ifndef _LINUX_KISS_H
#define _LINUX_KISS_H

#include <linux/config.h>
#include <linux/netdevice.h>

#define KISS_NRUNIT	16
#define KISS_MTU	(256+MAX_HEADER)

/* KISS protocol characters. */
#define END        	     	0300		/* indicates end of frame */
#define ESC             	0333		/* indicates byte stuffing */
#define ESC_END        	 	0334		/* ESC ESC_END means END 'data'	*/
#define ESC_ESC        	 	0335		/* ESC ESC_ESC means ESC 'data'	*/

typedef enum {
	KISS_MODE_NORMAL,
	KISS_MODE_ADAPTIVE,
	KISS_MODE_FLEX,
	KISS_MODE_SMACK,
	KISS_MODE_COMPAT,
	KISS_MODE_TNN_TOKENRING
} kiss_crcmode_t;

typedef enum {
	KISS_PARAM_TXDELAY=1,
	KISS_PARAM_PPERS,
	KISS_PARAM_SLOT,
	KISS_PARAM_TXTAIL,
	KISS_PARAM_DUPLEX
} kiss_command_t;

struct kiss {
	struct tty_struct	*tty;		/* ptr to TTY structure	*/
	struct net_device		*dev;		/* easy for intr handling */

	spinlock_t		lock;

	/* These are pointers to the malloc()ed frame buffers. */
	unsigned char		*rbuff;		/* receiver buffer */
	int			rcount;         /* received chars counter */
	unsigned char		*xbuff;		/* transmitter buffer */
	unsigned char		*xhead;         /* pointer to next byte to XMIT */
	int			xleft;          /* bytes left in XMIT queue */
	int			mtu;		/* Our mtu (to spot changes!) */
	int			buffsize;       /* Max buffers sizes */

	struct {
		int			in_use:1;
		int			escape:1;
		int			error:1;
	} flags;

	kiss_crcmode_t		mode;		/* KISS mode */

	kdev_t			line;
	pid_t			pid;

	struct net_device_stats stats;	/* statistics */
	struct ax25_dev       ax25dev;
};

typedef struct kiss_ctrl {
	struct kiss	ctrl;		/* KISS things			*/
	struct net_device	dev;	/* the device			*/
} kiss_ctrl_t;


#endif	/* _LINUX_KISS.H */