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