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