slip.h 4.1 KB

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