irnet_irda.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. * IRDA part of the IrNET module (dealing with IrTTP, IrIAS and co).
  8. * This file is a private header, so other modules don't want to know
  9. * what's in there...
  10. */
  11. #ifndef IRNET_IRDA_H
  12. #define IRNET_IRDA_H
  13. /***************************** INCLUDES *****************************/
  14. /* Please add other headers in irnet.h */
  15. #include "irnet.h" /* Module global include */
  16. /************************ CONSTANTS & MACROS ************************/
  17. /*
  18. * Name of the service (socket name) used by IrNET
  19. */
  20. /* IAS object name (or part of it) */
  21. #define IRNET_SERVICE_NAME "IrNetv1"
  22. /* IAS attribute */
  23. #define IRNET_IAS_VALUE "IrDA:TinyTP:LsapSel"
  24. /* LMP notify name for client (only for /proc/net/irda/irlmp) */
  25. #define IRNET_NOTIFY_NAME "IrNET socket"
  26. /* LMP notify name for server (only for /proc/net/irda/irlmp) */
  27. #define IRNET_NOTIFY_NAME_SERV "IrNET server"
  28. /****************************** TYPES ******************************/
  29. /*
  30. * This is the main structure where we store all the data pertaining to
  31. * the IrNET server (listen for connection requests) and the root
  32. * of the IrNET socket list
  33. */
  34. typedef struct irnet_root
  35. {
  36. irnet_socket s; /* To pretend we are a client... */
  37. /* Generic stuff */
  38. int magic; /* Paranoia */
  39. int running; /* Are we operational ? */
  40. /* Link list of all IrNET instances opened */
  41. hashbin_t * list;
  42. spinlock_t spinlock; /* Serialize access to the list */
  43. /* Note : the way hashbin has been designed is absolutely not
  44. * reentrant, beware... So, we blindly protect all with spinlock */
  45. /* Handle for the hint bit advertised in IrLMP */
  46. void * skey;
  47. /* Server socket part */
  48. struct ias_object * ias_obj; /* Our service name + lsap in IAS */
  49. } irnet_root;
  50. /**************************** PROTOTYPES ****************************/
  51. /* ----------------------- CONTROL CHANNEL ----------------------- */
  52. static void
  53. irnet_post_event(irnet_socket *,
  54. irnet_event,
  55. __u32,
  56. __u32,
  57. char *,
  58. __u16);
  59. /* ----------------------- IRDA SUBROUTINES ----------------------- */
  60. static inline int
  61. irnet_open_tsap(irnet_socket *);
  62. static inline __u8
  63. irnet_ias_to_tsap(irnet_socket *,
  64. int,
  65. struct ias_value *);
  66. static inline int
  67. irnet_find_lsap_sel(irnet_socket *);
  68. static inline int
  69. irnet_connect_tsap(irnet_socket *);
  70. static inline int
  71. irnet_discover_next_daddr(irnet_socket *);
  72. static inline int
  73. irnet_discover_daddr_and_lsap_sel(irnet_socket *);
  74. static inline int
  75. irnet_dname_to_daddr(irnet_socket *);
  76. /* ------------------------ SERVER SOCKET ------------------------ */
  77. static inline int
  78. irnet_daddr_to_dname(irnet_socket *);
  79. static inline irnet_socket *
  80. irnet_find_socket(irnet_socket *);
  81. static inline int
  82. irnet_connect_socket(irnet_socket *,
  83. irnet_socket *,
  84. struct qos_info *,
  85. __u32,
  86. __u8);
  87. static inline void
  88. irnet_disconnect_server(irnet_socket *,
  89. struct sk_buff *);
  90. static inline int
  91. irnet_setup_server(void);
  92. static inline void
  93. irnet_destroy_server(void);
  94. /* ---------------------- IRDA-TTP CALLBACKS ---------------------- */
  95. static int
  96. irnet_data_indication(void *, /* instance */
  97. void *, /* sap */
  98. struct sk_buff *);
  99. static void
  100. irnet_disconnect_indication(void *,
  101. void *,
  102. LM_REASON,
  103. struct sk_buff *);
  104. static void
  105. irnet_connect_confirm(void *,
  106. void *,
  107. struct qos_info *,
  108. __u32,
  109. __u8,
  110. struct sk_buff *);
  111. static void
  112. irnet_flow_indication(void *,
  113. void *,
  114. LOCAL_FLOW);
  115. static void
  116. irnet_status_indication(void *,
  117. LINK_STATUS,
  118. LOCK_STATUS);
  119. static void
  120. irnet_connect_indication(void *,
  121. void *,
  122. struct qos_info *,
  123. __u32,
  124. __u8,
  125. struct sk_buff *);
  126. /* -------------------- IRDA-IAS/LMP CALLBACKS -------------------- */
  127. static void
  128. irnet_getvalue_confirm(int,
  129. __u16,
  130. struct ias_value *,
  131. void *);
  132. static void
  133. irnet_discovervalue_confirm(int,
  134. __u16,
  135. struct ias_value *,
  136. void *);
  137. #ifdef DISCOVERY_EVENTS
  138. static void
  139. irnet_discovery_indication(discinfo_t *,
  140. DISCOVERY_MODE,
  141. void *);
  142. static void
  143. irnet_expiry_indication(discinfo_t *,
  144. DISCOVERY_MODE,
  145. void *);
  146. #endif
  147. /**************************** VARIABLES ****************************/
  148. /*
  149. * The IrNET server. Listen to connection requests and co...
  150. */
  151. static struct irnet_root irnet_server;
  152. /* Control channel stuff (note : extern) */
  153. struct irnet_ctrl_channel irnet_events;
  154. /* The /proc/net/irda directory, defined elsewhere... */
  155. #ifdef CONFIG_PROC_FS
  156. extern struct proc_dir_entry *proc_irda;
  157. #endif /* CONFIG_PROC_FS */
  158. #endif /* IRNET_IRDA_H */