irnet_ppp.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * IrNET protocol module : Synchronous PPP over an IrDA socket.
  3. *
  4. * Jean II - HPL `00 - <jt@hpl.hp.com>
  5. *
  6. * This file contains all definitions and declarations necessary for the
  7. * PPP part of the IrNET module.
  8. * This file is a private header, so other modules don't want to know
  9. * what's in there...
  10. */
  11. #ifndef IRNET_PPP_H
  12. #define IRNET_PPP_H
  13. /***************************** INCLUDES *****************************/
  14. #include "irnet.h" /* Module global include */
  15. /************************ CONSTANTS & MACROS ************************/
  16. /* /dev/irnet file constants */
  17. #define IRNET_MAJOR 10 /* Misc range */
  18. #define IRNET_MINOR 187 /* Official allocation */
  19. /* IrNET control channel stuff */
  20. #define IRNET_MAX_COMMAND 256 /* Max length of a command line */
  21. /* PPP hardcore stuff */
  22. /* Bits in rbits (PPP flags in irnet struct) */
  23. #define SC_RCV_BITS (SC_RCV_B7_1|SC_RCV_B7_0|SC_RCV_ODDP|SC_RCV_EVNP)
  24. /* Bit numbers in busy */
  25. #define XMIT_BUSY 0
  26. #define RECV_BUSY 1
  27. #define XMIT_WAKEUP 2
  28. #define XMIT_FULL 3
  29. /* Queue management */
  30. #define PPPSYNC_MAX_RQLEN 32 /* arbitrary */
  31. /****************************** TYPES ******************************/
  32. /**************************** PROTOTYPES ****************************/
  33. /* ----------------------- CONTROL CHANNEL ----------------------- */
  34. static inline ssize_t
  35. irnet_ctrl_write(irnet_socket *,
  36. const char *,
  37. size_t);
  38. static inline ssize_t
  39. irnet_ctrl_read(irnet_socket *,
  40. struct file *,
  41. char *,
  42. size_t);
  43. static inline unsigned int
  44. irnet_ctrl_poll(irnet_socket *,
  45. struct file *,
  46. poll_table *);
  47. /* ----------------------- CHARACTER DEVICE ----------------------- */
  48. static int
  49. dev_irnet_open(struct inode *, /* fs callback : open */
  50. struct file *),
  51. dev_irnet_close(struct inode *,
  52. struct file *);
  53. static ssize_t
  54. dev_irnet_write(struct file *,
  55. const char __user *,
  56. size_t,
  57. loff_t *),
  58. dev_irnet_read(struct file *,
  59. char __user *,
  60. size_t,
  61. loff_t *);
  62. static unsigned int
  63. dev_irnet_poll(struct file *,
  64. poll_table *);
  65. static long
  66. dev_irnet_ioctl(struct file *,
  67. unsigned int,
  68. unsigned long);
  69. /* ------------------------ PPP INTERFACE ------------------------ */
  70. static inline struct sk_buff *
  71. irnet_prepare_skb(irnet_socket *,
  72. struct sk_buff *);
  73. static int
  74. ppp_irnet_send(struct ppp_channel *,
  75. struct sk_buff *);
  76. static int
  77. ppp_irnet_ioctl(struct ppp_channel *,
  78. unsigned int,
  79. unsigned long);
  80. /**************************** VARIABLES ****************************/
  81. /* Filesystem callbacks (to call us) */
  82. static const struct file_operations irnet_device_fops =
  83. {
  84. .owner = THIS_MODULE,
  85. .read = dev_irnet_read,
  86. .write = dev_irnet_write,
  87. .poll = dev_irnet_poll,
  88. .unlocked_ioctl = dev_irnet_ioctl,
  89. .open = dev_irnet_open,
  90. .release = dev_irnet_close,
  91. .llseek = noop_llseek,
  92. /* Also : llseek, readdir, mmap, flush, fsync, fasync, lock, readv, writev */
  93. };
  94. /* Structure so that the misc major (drivers/char/misc.c) take care of us... */
  95. static struct miscdevice irnet_misc_device =
  96. {
  97. IRNET_MINOR,
  98. "irnet",
  99. &irnet_device_fops
  100. };
  101. #endif /* IRNET_PPP_H */