irnet_ppp.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 int
  66. dev_irnet_ioctl(struct inode *,
  67. struct file *,
  68. unsigned int,
  69. unsigned long);
  70. /* ------------------------ PPP INTERFACE ------------------------ */
  71. static inline struct sk_buff *
  72. irnet_prepare_skb(irnet_socket *,
  73. struct sk_buff *);
  74. static int
  75. ppp_irnet_send(struct ppp_channel *,
  76. struct sk_buff *);
  77. static int
  78. ppp_irnet_ioctl(struct ppp_channel *,
  79. unsigned int,
  80. unsigned long);
  81. /**************************** VARIABLES ****************************/
  82. /* Filesystem callbacks (to call us) */
  83. static struct file_operations irnet_device_fops =
  84. {
  85. .owner = THIS_MODULE,
  86. .read = dev_irnet_read,
  87. .write = dev_irnet_write,
  88. .poll = dev_irnet_poll,
  89. .ioctl = dev_irnet_ioctl,
  90. .open = dev_irnet_open,
  91. .release = dev_irnet_close
  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 */