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
/*
 * slip.h	Define the SLIP device driver interface and constants.
 *
 * NOTE:	THIS FILE WILL BE MOVED TO THE LINUX INCLUDE DIRECTORY
 *		AS SOON AS POSSIBLE!
 *
 * Version:	@(#)slip.h	1.2.0	03/28/93
 *
 * Fixes:
 *		Alan Cox	: 	Added slip mtu field.
 *		Matt Dillon	:	Printable slip (borrowed from net2e)
 *
 * Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
 */
#ifndef _LINUX_SLIP_H
#define _LINUX_SLIP_H

/* SLIP configuration. */
#define SL_NRUNIT	4		/* number of SLIP channels	*/
#define SL_MTU		296		/* 296; I am used to 600- FvK	*/

/* SLIP 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'	*/


struct slip {
  /* Bitmapped flag fields. */
  char			inuse;		/* are we allocated?		*/
  char			sending;	/* "channel busy" indicator	*/
  char			escape;		/* SLIP state machine		*/
  char			unused;		/* fillers			*/

  /* Various fields. */
  int			line;		/* SLIP channel number		*/
  struct tty_struct	*tty;		/* ptr to TTY structure		*/
  struct device		*dev;		/* easy for intr handling	*/
  struct slcompress	*slcomp;	/* for header compression 	*/

  /* These are pointers to the malloc()ed frame buffers. */
  unsigned char		*rbuff;		/* receiver buffer		*/
  unsigned char		*xbuff;		/* transmitter buffer		*/
  unsigned char		*cbuff;		/* compression buffer		*/

  /* These are the various pointers into the buffers. */
  unsigned char		*rhead;		/* RECV buffer pointer (head)	*/
  unsigned char		*rend;		/* RECV buffer pointer (end)	*/
  int			rcount;		/* SLIP receive counter		*/

  /* SLIP interface statistics. */
  unsigned long		rpacket;	/* inbound frame counter	*/
  unsigned long		roverrun;	/* "buffer overrun" counter	*/
  unsigned long		spacket;	/* outbound frames counter	*/
  unsigned long		sbusy;		/* "transmitter busy" counter	*/
  unsigned long		errors;		/* error count			*/
  
  int			mtu;		/* Our mtu (to spot changes!)   */
  unsigned char		flags;		/* Flag values/ mode etc	*/
#define SLF_ESCAPE	2
#define SLF_ERROR	4
#define SLF_COMP	16
#define SLF_EXPN	32
  unsigned char		mode;		/* SLIP mode			*/
#define SL_MODE_SLIP	0
#define SL_MODE_CSLIP	1
#define SL_MODE_SLIP6	2		/* Matt Dillon's printable slip */
#define SL_MODE_CSLIP6	(SL_MODE_SLIP6|SL_MODE_CSLIP)
#define SL_MODE_AX25	4
#define SL_MODE_ADAPTIVE 8
  int			xdata,xbits;	/* 6 bit slip controls 		*/
};


extern int	slip_init(struct device *dev);
extern int	slip_esc(unsigned char *s, unsigned char *d, int len);
extern int	slip_esc6(unsigned char *s, unsigned char *d, int len);
extern void	slip_unesc(struct slip *sl, unsigned char *s, int count, int error);
extern void 	slip_unesc6(struct slip *sl, unsigned char *s, int count, int error);


#endif	/* _LINUX_SLIP.H */
孤身打馬南屏舊橋邊過 恰逢山雨來時霧濛濛