irda.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*********************************************************************
  2. *
  3. * Filename: irda.h
  4. * Version:
  5. * Description:
  6. * Status: Experimental.
  7. * Author: Dag Brattli <dagb@cs.uit.no>
  8. * Created at: Mon Mar 8 14:06:12 1999
  9. * Modified at: Sat Dec 25 16:06:42 1999
  10. * Modified by: Dag Brattli <dagb@cs.uit.no>
  11. *
  12. * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License as
  16. * published by the Free Software Foundation; either version 2 of
  17. * the License, or (at your option) any later version.
  18. *
  19. * Neither Dag Brattli nor University of Tromsø admit liability nor
  20. * provide warranty for any of this software. This material is
  21. * provided "AS-IS" and at no charge.
  22. *
  23. ********************************************************************/
  24. #ifndef KERNEL_IRDA_H
  25. #define KERNEL_IRDA_H
  26. #include <linux/types.h>
  27. #include <linux/socket.h>
  28. /* Note that this file is shared with user space. */
  29. /* Hint bit positions for first hint byte */
  30. #define HINT_PNP 0x01
  31. #define HINT_PDA 0x02
  32. #define HINT_COMPUTER 0x04
  33. #define HINT_PRINTER 0x08
  34. #define HINT_MODEM 0x10
  35. #define HINT_FAX 0x20
  36. #define HINT_LAN 0x40
  37. #define HINT_EXTENSION 0x80
  38. /* Hint bit positions for second hint byte (first extension byte) */
  39. #define HINT_TELEPHONY 0x01
  40. #define HINT_FILE_SERVER 0x02
  41. #define HINT_COMM 0x04
  42. #define HINT_MESSAGE 0x08
  43. #define HINT_HTTP 0x10
  44. #define HINT_OBEX 0x20
  45. /* IrLMP character code values */
  46. #define CS_ASCII 0x00
  47. #define CS_ISO_8859_1 0x01
  48. #define CS_ISO_8859_2 0x02
  49. #define CS_ISO_8859_3 0x03
  50. #define CS_ISO_8859_4 0x04
  51. #define CS_ISO_8859_5 0x05
  52. #define CS_ISO_8859_6 0x06
  53. #define CS_ISO_8859_7 0x07
  54. #define CS_ISO_8859_8 0x08
  55. #define CS_ISO_8859_9 0x09
  56. #define CS_UNICODE 0xff
  57. /* These are the currently known dongles */
  58. typedef enum {
  59. IRDA_TEKRAM_DONGLE = 0,
  60. IRDA_ESI_DONGLE = 1,
  61. IRDA_ACTISYS_DONGLE = 2,
  62. IRDA_ACTISYS_PLUS_DONGLE = 3,
  63. IRDA_GIRBIL_DONGLE = 4,
  64. IRDA_LITELINK_DONGLE = 5,
  65. IRDA_AIRPORT_DONGLE = 6,
  66. IRDA_OLD_BELKIN_DONGLE = 7,
  67. IRDA_EP7211_IR = 8,
  68. IRDA_MCP2120_DONGLE = 9,
  69. IRDA_ACT200L_DONGLE = 10,
  70. IRDA_MA600_DONGLE = 11,
  71. IRDA_TOIM3232_DONGLE = 12,
  72. IRDA_EP7211_DONGLE = 13,
  73. } IRDA_DONGLE;
  74. /* Protocol types to be used for SOCK_DGRAM */
  75. enum {
  76. IRDAPROTO_UNITDATA = 0,
  77. IRDAPROTO_ULTRA = 1,
  78. IRDAPROTO_MAX
  79. };
  80. #define SOL_IRLMP 266 /* Same as SOL_IRDA for now */
  81. #define SOL_IRTTP 266 /* Same as SOL_IRDA for now */
  82. #define IRLMP_ENUMDEVICES 1 /* Return discovery log */
  83. #define IRLMP_IAS_SET 2 /* Set an attribute in local IAS */
  84. #define IRLMP_IAS_QUERY 3 /* Query remote IAS for attribute */
  85. #define IRLMP_HINTS_SET 4 /* Set hint bits advertised */
  86. #define IRLMP_QOS_SET 5
  87. #define IRLMP_QOS_GET 6
  88. #define IRLMP_MAX_SDU_SIZE 7
  89. #define IRLMP_IAS_GET 8 /* Get an attribute from local IAS */
  90. #define IRLMP_IAS_DEL 9 /* Remove attribute from local IAS */
  91. #define IRLMP_HINT_MASK_SET 10 /* Set discovery filter */
  92. #define IRLMP_WAITDEVICE 11 /* Wait for a new discovery */
  93. #define IRTTP_MAX_SDU_SIZE IRLMP_MAX_SDU_SIZE /* Compatibility */
  94. #define IAS_MAX_STRING 256 /* See IrLMP 1.1, 4.3.3.2 */
  95. #define IAS_MAX_OCTET_STRING 1024 /* See IrLMP 1.1, 4.3.3.2 */
  96. #define IAS_MAX_CLASSNAME 60 /* See IrLMP 1.1, 4.3.1 */
  97. #define IAS_MAX_ATTRIBNAME 60 /* See IrLMP 1.1, 4.3.3.1 */
  98. #define IAS_MAX_ATTRIBNUMBER 256 /* See IrLMP 1.1, 4.3.3.1 */
  99. /* For user space backward compatibility - may be fixed in kernel 2.5.X
  100. * Note : need 60+1 ('\0'), make it 64 for alignement - Jean II */
  101. #define IAS_EXPORT_CLASSNAME 64
  102. #define IAS_EXPORT_ATTRIBNAME 256
  103. /* Attribute type needed for struct irda_ias_set */
  104. #define IAS_MISSING 0
  105. #define IAS_INTEGER 1
  106. #define IAS_OCT_SEQ 2
  107. #define IAS_STRING 3
  108. #define LSAP_ANY 0xff
  109. struct sockaddr_irda {
  110. __kernel_sa_family_t sir_family; /* AF_IRDA */
  111. __u8 sir_lsap_sel; /* LSAP selector */
  112. __u32 sir_addr; /* Device address */
  113. char sir_name[25]; /* Usually <service>:IrDA:TinyTP */
  114. };
  115. struct irda_device_info {
  116. __u32 saddr; /* Address of local interface */
  117. __u32 daddr; /* Address of remote device */
  118. char info[22]; /* Description */
  119. __u8 charset; /* Charset used for description */
  120. __u8 hints[2]; /* Hint bits */
  121. };
  122. struct irda_device_list {
  123. __u32 len;
  124. struct irda_device_info dev[1];
  125. };
  126. struct irda_ias_set {
  127. char irda_class_name[IAS_EXPORT_CLASSNAME];
  128. char irda_attrib_name[IAS_EXPORT_ATTRIBNAME];
  129. unsigned int irda_attrib_type;
  130. union {
  131. unsigned int irda_attrib_int;
  132. struct {
  133. unsigned short len;
  134. __u8 octet_seq[IAS_MAX_OCTET_STRING];
  135. } irda_attrib_octet_seq;
  136. struct {
  137. __u8 len;
  138. __u8 charset;
  139. __u8 string[IAS_MAX_STRING];
  140. } irda_attrib_string;
  141. } attribute;
  142. __u32 daddr; /* Address of device (for some queries only) */
  143. };
  144. /* Some private IOCTL's (max 16) */
  145. #define SIOCSDONGLE (SIOCDEVPRIVATE + 0)
  146. #define SIOCGDONGLE (SIOCDEVPRIVATE + 1)
  147. #define SIOCSBANDWIDTH (SIOCDEVPRIVATE + 2)
  148. #define SIOCSMEDIABUSY (SIOCDEVPRIVATE + 3)
  149. #define SIOCGMEDIABUSY (SIOCDEVPRIVATE + 4)
  150. #define SIOCGRECEIVING (SIOCDEVPRIVATE + 5)
  151. #define SIOCSMODE (SIOCDEVPRIVATE + 6)
  152. #define SIOCGMODE (SIOCDEVPRIVATE + 7)
  153. #define SIOCSDTRRTS (SIOCDEVPRIVATE + 8)
  154. #define SIOCGQOS (SIOCDEVPRIVATE + 9)
  155. /* No reason to include <linux/if.h> just because of this one ;-) */
  156. #define IRNAMSIZ 16
  157. /* IrDA quality of service information (must not exceed 16 bytes) */
  158. struct if_irda_qos {
  159. unsigned long baudrate;
  160. unsigned short data_size;
  161. unsigned short window_size;
  162. unsigned short min_turn_time;
  163. unsigned short max_turn_time;
  164. unsigned char add_bofs;
  165. unsigned char link_disc;
  166. };
  167. /* For setting RTS and DTR lines of a dongle */
  168. struct if_irda_line {
  169. __u8 dtr;
  170. __u8 rts;
  171. };
  172. /* IrDA interface configuration (data part must not exceed 16 bytes) */
  173. struct if_irda_req {
  174. union {
  175. char ifrn_name[IRNAMSIZ]; /* if name, e.g. "irda0" */
  176. } ifr_ifrn;
  177. /* Data part */
  178. union {
  179. struct if_irda_line ifru_line;
  180. struct if_irda_qos ifru_qos;
  181. unsigned short ifru_flags;
  182. unsigned int ifru_receiving;
  183. unsigned int ifru_mode;
  184. unsigned int ifru_dongle;
  185. } ifr_ifru;
  186. };
  187. #define ifr_baudrate ifr_ifru.ifru_qos.baudrate
  188. #define ifr_receiving ifr_ifru.ifru_receiving
  189. #define ifr_dongle ifr_ifru.ifru_dongle
  190. #define ifr_mode ifr_ifru.ifru_mode
  191. #define ifr_dtr ifr_ifru.ifru_line.dtr
  192. #define ifr_rts ifr_ifru.ifru_line.rts
  193. /* IrDA netlink definitions */
  194. #define IRDA_NL_NAME "irda"
  195. #define IRDA_NL_VERSION 1
  196. enum irda_nl_commands {
  197. IRDA_NL_CMD_UNSPEC,
  198. IRDA_NL_CMD_SET_MODE,
  199. IRDA_NL_CMD_GET_MODE,
  200. __IRDA_NL_CMD_AFTER_LAST
  201. };
  202. #define IRDA_NL_CMD_MAX (__IRDA_NL_CMD_AFTER_LAST - 1)
  203. enum nl80211_attrs {
  204. IRDA_NL_ATTR_UNSPEC,
  205. IRDA_NL_ATTR_IFNAME,
  206. IRDA_NL_ATTR_MODE,
  207. __IRDA_NL_ATTR_AFTER_LAST
  208. };
  209. #define IRDA_NL_ATTR_MAX (__IRDA_NL_ATTR_AFTER_LAST - 1)
  210. /* IrDA modes */
  211. #define IRDA_MODE_PRIMARY 0x1
  212. #define IRDA_MODE_SECONDARY 0x2
  213. #define IRDA_MODE_MONITOR 0x4
  214. #endif /* KERNEL_IRDA_H */