slip.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * slip.h Define the SLIP device driver interface and constants.
  4. *
  5. * NOTE: THIS FILE WILL BE MOVED TO THE LINUX INCLUDE DIRECTORY
  6. * AS SOON AS POSSIBLE!
  7. *
  8. * Version: @(#)slip.h 1.2.0 03/28/93
  9. *
  10. * Fixes:
  11. * Alan Cox : Added slip mtu field.
  12. * Matt Dillon : Printable slip (borrowed from net2e)
  13. * Alan Cox : Added SL_SLIP_LOTS
  14. * Dmitry Gorodchanin : A lot of changes in the 'struct slip'
  15. * Dmitry Gorodchanin : Added CSLIP statistics.
  16. * Stanislav Voronyi : Make line checking as created by
  17. * Igor Chechik, RELCOM Corp.
  18. * Craig Schlenter : Fixed #define bug that caused
  19. * CSLIP telnets to hang in 1.3.61-6
  20. *
  21. * Author: Fred N. van Kempen, <[email protected]>
  22. */
  23. #ifndef _LINUX_SLIP_H
  24. #define _LINUX_SLIP_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. /* some arch define END as assembly function ending, just undef it */
  39. #undef END
  40. /* SLIP protocol characters. */
  41. #define END 0300 /* indicates end of frame */
  42. #define ESC 0333 /* indicates byte stuffing */
  43. #define ESC_END 0334 /* ESC ESC_END means END 'data' */
  44. #define ESC_ESC 0335 /* ESC ESC_ESC means ESC 'data' */
  45. struct slip {
  46. int magic;
  47. /* Various fields. */
  48. struct tty_struct *tty; /* ptr to TTY structure */
  49. struct net_device *dev; /* easy for intr handling */
  50. spinlock_t lock;
  51. struct work_struct tx_work; /* Flushes transmit buffer */
  52. #ifdef SL_INCLUDE_CSLIP
  53. struct slcompress *slcomp; /* for header compression */
  54. unsigned char *cbuff; /* compression buffer */
  55. #endif
  56. /* These are pointers to the malloc()ed frame buffers. */
  57. unsigned char *rbuff; /* receiver buffer */
  58. int rcount; /* received chars counter */
  59. unsigned char *xbuff; /* transmitter buffer */
  60. unsigned char *xhead; /* pointer to next byte to XMIT */
  61. int xleft; /* bytes left in XMIT queue */
  62. int mtu; /* Our mtu (to spot changes!) */
  63. int buffsize; /* Max buffers sizes */
  64. #ifdef CONFIG_SLIP_MODE_SLIP6
  65. int xdata, xbits; /* 6 bit slip controls */
  66. #endif
  67. unsigned long flags; /* Flag values/ mode etc */
  68. #define SLF_INUSE 0 /* Channel in use */
  69. #define SLF_ESCAPE 1 /* ESC received */
  70. #define SLF_ERROR 2 /* Parity, etc. error */
  71. #define SLF_KEEPTEST 3 /* Keepalive test flag */
  72. #define SLF_OUTWAIT 4 /* is outpacket was flag */
  73. unsigned char mode; /* SLIP mode */
  74. unsigned char leased;
  75. pid_t pid;
  76. #define SL_MODE_SLIP 0
  77. #define SL_MODE_CSLIP 1
  78. #define SL_MODE_SLIP6 2 /* Matt Dillon's printable slip */
  79. #define SL_MODE_CSLIP6 (SL_MODE_SLIP6|SL_MODE_CSLIP)
  80. #define SL_MODE_AX25 4
  81. #define SL_MODE_ADAPTIVE 8
  82. #ifdef CONFIG_SLIP_SMART
  83. unsigned char outfill; /* # of sec between outfill packet */
  84. unsigned char keepalive; /* keepalive seconds */
  85. struct timer_list outfill_timer;
  86. struct timer_list keepalive_timer;
  87. #endif
  88. };
  89. #define SLIP_MAGIC 0x5302
  90. #endif /* _LINUX_SLIP.H */