irda.h 7.5 KB

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