Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * Stanislav Voronyi : Make line checking as created by |
| 16 | * Igor Chechik, RELCOM Corp. |
| 17 | * Craig Schlenter : Fixed #define bug that caused |
| 18 | * CSLIP telnets to hang in 1.3.61-6 |
| 19 | * |
| 20 | * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> |
| 21 | */ |
| 22 | #ifndef _LINUX_SLIP_H |
| 23 | #define _LINUX_SLIP_H |
| 24 | |
| 25 | #include <linux/config.h> |
| 26 | |
| 27 | #if defined(CONFIG_INET) && defined(CONFIG_SLIP_COMPRESSED) |
| 28 | # define SL_INCLUDE_CSLIP |
| 29 | #endif |
| 30 | |
| 31 | #ifdef SL_INCLUDE_CSLIP |
| 32 | # define SL_MODE_DEFAULT SL_MODE_ADAPTIVE |
| 33 | #else |
| 34 | # define SL_MODE_DEFAULT SL_MODE_SLIP |
| 35 | #endif |
| 36 | |
| 37 | /* SLIP configuration. */ |
| 38 | #define SL_NRUNIT 256 /* MAX number of SLIP channels; |
| 39 | This can be overridden with |
| 40 | insmod -oslip_maxdev=nnn */ |
| 41 | #define SL_MTU 296 /* 296; I am used to 600- FvK */ |
| 42 | |
| 43 | /* SLIP protocol characters. */ |
| 44 | #define END 0300 /* indicates end of frame */ |
| 45 | #define ESC 0333 /* indicates byte stuffing */ |
| 46 | #define ESC_END 0334 /* ESC ESC_END means END 'data' */ |
| 47 | #define ESC_ESC 0335 /* ESC ESC_ESC means ESC 'data' */ |
| 48 | |
| 49 | |
| 50 | struct slip { |
| 51 | int magic; |
| 52 | |
| 53 | /* Various fields. */ |
| 54 | struct tty_struct *tty; /* ptr to TTY structure */ |
| 55 | struct net_device *dev; /* easy for intr handling */ |
| 56 | spinlock_t lock; |
| 57 | |
| 58 | #ifdef SL_INCLUDE_CSLIP |
| 59 | struct slcompress *slcomp; /* for header compression */ |
| 60 | unsigned char *cbuff; /* compression buffer */ |
| 61 | #endif |
| 62 | |
| 63 | /* These are pointers to the malloc()ed frame buffers. */ |
| 64 | unsigned char *rbuff; /* receiver buffer */ |
| 65 | int rcount; /* received chars counter */ |
| 66 | unsigned char *xbuff; /* transmitter buffer */ |
| 67 | unsigned char *xhead; /* pointer to next byte to XMIT */ |
| 68 | int xleft; /* bytes left in XMIT queue */ |
| 69 | |
| 70 | /* SLIP interface statistics. */ |
| 71 | unsigned long rx_packets; /* inbound frames counter */ |
| 72 | unsigned long tx_packets; /* outbound frames counter */ |
| 73 | unsigned long rx_bytes; /* inbound byte counte */ |
| 74 | unsigned long tx_bytes; /* outbound byte counter */ |
| 75 | unsigned long rx_errors; /* Parity, etc. errors */ |
| 76 | unsigned long tx_errors; /* Planned stuff */ |
| 77 | unsigned long rx_dropped; /* No memory for skb */ |
| 78 | unsigned long tx_dropped; /* When MTU change */ |
| 79 | unsigned long rx_over_errors; /* Frame bigger then SLIP buf. */ |
| 80 | #ifdef SL_INCLUDE_CSLIP |
| 81 | unsigned long tx_compressed; |
| 82 | unsigned long rx_compressed; |
| 83 | unsigned long tx_misses; |
| 84 | #endif |
| 85 | /* Detailed SLIP statistics. */ |
| 86 | |
| 87 | int mtu; /* Our mtu (to spot changes!) */ |
| 88 | int buffsize; /* Max buffers sizes */ |
| 89 | |
| 90 | #ifdef CONFIG_SLIP_MODE_SLIP6 |
| 91 | int xdata, xbits; /* 6 bit slip controls */ |
| 92 | #endif |
| 93 | |
| 94 | unsigned long flags; /* Flag values/ mode etc */ |
| 95 | #define SLF_INUSE 0 /* Channel in use */ |
| 96 | #define SLF_ESCAPE 1 /* ESC received */ |
| 97 | #define SLF_ERROR 2 /* Parity, etc. error */ |
| 98 | #define SLF_KEEPTEST 3 /* Keepalive test flag */ |
| 99 | #define SLF_OUTWAIT 4 /* is outpacket was flag */ |
| 100 | |
| 101 | unsigned char mode; /* SLIP mode */ |
| 102 | unsigned char leased; |
| 103 | dev_t line; |
| 104 | pid_t pid; |
| 105 | #define SL_MODE_SLIP 0 |
| 106 | #define SL_MODE_CSLIP 1 |
| 107 | #define SL_MODE_SLIP6 2 /* Matt Dillon's printable slip */ |
| 108 | #define SL_MODE_CSLIP6 (SL_MODE_SLIP6|SL_MODE_CSLIP) |
| 109 | #define SL_MODE_AX25 4 |
| 110 | #define SL_MODE_ADAPTIVE 8 |
| 111 | #ifdef CONFIG_SLIP_SMART |
| 112 | unsigned char outfill; /* # of sec between outfill packet */ |
| 113 | unsigned char keepalive; /* keepalive seconds */ |
| 114 | struct timer_list outfill_timer; |
| 115 | struct timer_list keepalive_timer; |
| 116 | #endif |
| 117 | }; |
| 118 | |
| 119 | #define SLIP_MAGIC 0x5302 |
| 120 | |
| 121 | #endif /* _LINUX_SLIP.H */ |