irnet_ppp.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. #include <linux/miscdevice.h>
  16. /************************ CONSTANTS & MACROS ************************/
  17. /* IrNET control channel stuff */
  18. #define IRNET_MAX_COMMAND 256 /* Max length of a command line */
  19. /* PPP hardcore stuff */
  20. /* Bits in rbits (PPP flags in irnet struct) */
  21. #define SC_RCV_BITS (SC_RCV_B7_1|SC_RCV_B7_0|SC_RCV_ODDP|SC_RCV_EVNP)
  22. /* Bit numbers in busy */
  23. #define XMIT_BUSY 0
  24. #define RECV_BUSY 1
  25. #define XMIT_WAKEUP 2
  26. #define XMIT_FULL 3
  27. /* Queue management */
  28. #define PPPSYNC_MAX_RQLEN 32 /* arbitrary */
  29. /****************************** TYPES ******************************/
  30. /**************************** PROTOTYPES ****************************/
  31. /* ----------------------- CONTROL CHANNEL ----------------------- */
  32. static inline ssize_t
  33. irnet_ctrl_write(irnet_socket *,
  34. const char *,
  35. size_t);
  36. static inline ssize_t
  37. irnet_ctrl_read(irnet_socket *,
  38. struct file *,
  39. char *,
  40. size_t);
  41. static inline unsigned int
  42. irnet_ctrl_poll(irnet_socket *,
  43. struct file *,
  44. poll_table *);
  45. /* ----------------------- CHARACTER DEVICE ----------------------- */
  46. static int
  47. dev_irnet_open(struct inode *, /* fs callback : open */
  48. struct file *),
  49. dev_irnet_close(struct inode *,
  50. struct file *);
  51. static ssize_t
  52. dev_irnet_write(struct file *,
  53. const char __user *,
  54. size_t,
  55. loff_t *),
  56. dev_irnet_read(struct file *,
  57. char __user *,
  58. size_t,
  59. loff_t *);
  60. static unsigned int
  61. dev_irnet_poll(struct file *,
  62. poll_table *);
  63. static long
  64. dev_irnet_ioctl(struct file *,
  65. unsigned int,
  66. unsigned long);
  67. /* ------------------------ PPP INTERFACE ------------------------ */
  68. static inline struct sk_buff *
  69. irnet_prepare_skb(irnet_socket *,
  70. struct sk_buff *);
  71. static int
  72. ppp_irnet_send(struct ppp_channel *,
  73. struct sk_buff *);
  74. static int
  75. ppp_irnet_ioctl(struct ppp_channel *,
  76. unsigned int,
  77. unsigned long);
  78. /**************************** VARIABLES ****************************/
  79. /* Filesystem callbacks (to call us) */
  80. static const struct file_operations irnet_device_fops =
  81. {
  82. .owner = THIS_MODULE,
  83. .read = dev_irnet_read,
  84. .write = dev_irnet_write,
  85. .poll = dev_irnet_poll,
  86. .unlocked_ioctl = dev_irnet_ioctl,
  87. .open = dev_irnet_open,
  88. .release = dev_irnet_close,
  89. .llseek = noop_llseek,
  90. /* Also : llseek, readdir, mmap, flush, fsync, fasync, lock, readv, writev */
  91. };
  92. /* Structure so that the misc major (drivers/char/misc.c) take care of us... */
  93. static struct miscdevice irnet_misc_device =
  94. {
  95. .minor = IRNET_MINOR,
  96. .name = "irnet",
  97. .fops = &irnet_device_fops
  98. };
  99. #endif /* IRNET_PPP_H */