This commit was manufactured by cvs2svn to create branch 'uc'.
[gnokii.git] / include / devices / linuxirda.h
1 /*********************************************************************
2  *                
3  * Filename:      irda.h
4  * Version:       1.0
5  * Description:   IrDA header file to be used by IrDA applications
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:07:54 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 /*
26  * $Id$
27  *
28  */
29
30 #ifndef IRDA_H
31 #define IRDA_H
32
33 #include <sys/types.h>
34 #include <inttypes.h>
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_DONGLE;
78
79 /* Protocol types to be used for SOCK_DGRAM */
80 enum {
81         IRDAPROTO_UNITDATA = 0,
82         IRDAPROTO_ULTRA    = 1,
83         IRDAPROTO_MAX
84 };
85
86 #define SOL_IRLMP      266 /* Same as SOL_IRDA for now */
87 #define SOL_IRTTP      266 /* Same as SOL_IRDA for now */
88
89 #define IRLMP_ENUMDEVICES        1
90 #define IRLMP_IAS_SET            2
91 #define IRLMP_IAS_QUERY          3
92 #define IRLMP_HINTS_SET          4
93 #define IRLMP_QOS_SET            5
94 #define IRLMP_QOS_GET            6
95 #define IRLMP_MAX_SDU_SIZE       7
96 #define IRLMP_IAS_GET            8
97
98 #define IRTTP_MAX_SDU_SIZE IRLMP_MAX_SDU_SIZE /* Compatibility */
99
100 /* LM-IAS Limits */
101 #define IAS_MAX_STRING        256
102 #define IAS_MAX_OCTET_STRING 1024
103 #define IAS_MAX_CLASSNAME      64
104 #define IAS_MAX_ATTRIBNAME    256
105
106 /* LM-IAS Attribute types */
107 #define IAS_MISSING 0
108 #define IAS_INTEGER 1
109 #define IAS_OCT_SEQ 2
110 #define IAS_STRING  3
111
112 #define LSAP_ANY              0xff
113 #define DEV_ADDR_ANY  0xffffffff
114
115 struct sockaddr_irda {
116         sa_family_t   sir_family;   /* AF_IRDA */
117         uint8_t      sir_lsap_sel; /* LSAP selector */
118         uint32_t     sir_addr;     /* Device address */
119         char          sir_name[25]; /* Usually <service>:IrDA:TinyTP */
120 };
121
122 struct irda_device_info {
123         uint32_t     saddr;    /* Address of local interface */
124         uint32_t     daddr;    /* Address of remote device */
125         char          info[22]; /* Description */
126         uint8_t      charset;  /* Charset used for description */
127         uint8_t      hints[2]; /* Hint bits */
128 };
129
130 struct irda_device_list {
131         uint32_t len;
132         struct irda_device_info dev[1];
133 };
134
135 struct irda_ias_set {
136         char irda_class_name[IAS_MAX_CLASSNAME];
137         char irda_attrib_name[IAS_MAX_ATTRIBNAME];
138         unsigned int irda_attrib_type;
139         union {
140                 unsigned int irda_attrib_int;
141                 struct {
142                         unsigned short len;
143                         u_char octet_seq[IAS_MAX_OCTET_STRING];
144                 } irda_attrib_octet_seq;
145                 struct {
146                         unsigned char len;
147                         unsigned char charset;
148                         unsigned char string[IAS_MAX_STRING];
149                 } irda_attrib_string;
150         } attribute;
151         uint32_t       daddr;
152
153 };
154
155 /* Some private IOCTL's (max 16) */
156 #define SIOCSDONGLE    (SIOCDEVPRIVATE + 0)
157 #define SIOCGDONGLE    (SIOCDEVPRIVATE + 1)
158 #define SIOCSBANDWIDTH (SIOCDEVPRIVATE + 2)
159 #define SIOCSMEDIABUSY (SIOCDEVPRIVATE + 3)
160 #define SIOCGMEDIABUSY (SIOCDEVPRIVATE + 4)
161 #define SIOCGRECEIVING (SIOCDEVPRIVATE + 5)
162 #define SIOCSMODE      (SIOCDEVPRIVATE + 6)
163 #define SIOCGMODE      (SIOCDEVPRIVATE + 7)
164 #define SIOCSDTRRTS    (SIOCDEVPRIVATE + 8)
165 #define SIOCGQOS       (SIOCDEVPRIVATE + 9)
166
167 /* No reason to include <linux/if.h> just because of this one ;-) */
168 #define IRNAMSIZ 16 
169
170 /* IrDA quality of service information (must not exceed 16 bytes) */
171 struct if_irda_qos {
172         uint32_t baudrate;
173         uint16_t data_size;
174         uint16_t window_size;
175         uint16_t min_turn_time;
176         uint16_t max_turn_time;
177         uint8_t  add_bofs;
178         uint8_t  link_disc;
179 };
180
181 /* For setting RTS and DTR lines of a dongle */
182 struct if_irda_line {
183         unsigned char dtr;
184         unsigned char rts;
185 };
186
187 /* IrDA interface configuration (data part must not exceed 16 bytes) */
188 struct if_irda_req {
189         union {
190                 char ifrn_name[IRNAMSIZ];  /* if name, e.g. "irda0" */
191         } ifr_ifrn;
192         
193         /* Data part */
194         union {
195                 struct if_irda_line ifru_line;
196                 struct if_irda_qos  ifru_qos;
197                 unsigned short      ifru_flags;
198                 unsigned int        ifru_receiving;
199                 unsigned int        ifru_mode;
200                 unsigned int        ifru_dongle;
201         } ifr_ifru;
202 };
203
204 #define ifr_baudrate  ifr_ifru.ifru_qos.baudrate
205 #define ifr_receiving ifr_ifru.ifru_receiving 
206 #define ifr_dongle    ifr_ifru.ifru_dongle
207 #define ifr_mode      ifr_ifru.ifru_mode
208 #define ifr_dtr       ifr_ifru.ifru_line.dtr
209 #define ifr_rts       ifr_ifru.ifru_line.rts
210
211 #endif /* IRDA_H */