Implemented connection type "tcp" (GCT_TCP), use <hostname>:<port> as "port"
[gnokii.git] / include / 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  * GNOKII modifications:
29  *
30  * $Log$
31  * Revision 1.1.1.1  2001/11/25 21:59:20  short
32  * :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
33  *
34  * Revision 1.3  2001/07/05 10:54:53  pkot
35  * Solaris 2.7 fixes - should be harmless for other OSes (Michael Wiedmann)
36  *
37  * Revision 1.2  2001/07/03 00:03:37  pkot
38  * Small fixes to let gnokii compile and work under solaris (thanks to Artur Kubiak)
39  *
40  */
41
42 #ifndef IRDA_H
43 #define IRDA_H
44
45 #include <sys/types.h>
46 #include <inttypes.h>
47
48 /* Hint bit positions for first hint byte */
49 #define HINT_PNP         0x01
50 #define HINT_PDA         0x02
51 #define HINT_COMPUTER    0x04
52 #define HINT_PRINTER     0x08
53 #define HINT_MODEM       0x10
54 #define HINT_FAX         0x20
55 #define HINT_LAN         0x40
56 #define HINT_EXTENSION   0x80
57
58 /* Hint bit positions for second hint byte (first extension byte) */
59 #define HINT_TELEPHONY   0x01
60 #define HINT_FILE_SERVER 0x02
61 #define HINT_COMM        0x04
62 #define HINT_MESSAGE     0x08
63 #define HINT_HTTP        0x10
64 #define HINT_OBEX        0x20
65
66 /* IrLMP character code values */
67 #define CS_ASCII         0x00
68 #define CS_ISO_8859_1    0x01
69 #define CS_ISO_8859_2    0x02
70 #define CS_ISO_8859_3    0x03
71 #define CS_ISO_8859_4    0x04
72 #define CS_ISO_8859_5    0x05
73 #define CS_ISO_8859_6    0x06
74 #define CS_ISO_8859_7    0x07
75 #define CS_ISO_8859_8    0x08
76 #define CS_ISO_8859_9    0x09
77 #define CS_UNICODE       0xff
78
79 /* These are the currently known dongles */
80 typedef enum {
81         IRDA_TEKRAM_DONGLE       = 0,
82         IRDA_ESI_DONGLE          = 1,
83         IRDA_ACTISYS_DONGLE      = 2,
84         IRDA_ACTISYS_PLUS_DONGLE = 3,
85         IRDA_GIRBIL_DONGLE       = 4,
86         IRDA_LITELINK_DONGLE     = 5,
87         IRDA_AIRPORT_DONGLE      = 6,
88         IRDA_OLD_BELKIN_DONGLE   = 7,
89 } IRDA_DONGLE;
90
91 /* Protocol types to be used for SOCK_DGRAM */
92 enum {
93         IRDAPROTO_UNITDATA = 0,
94         IRDAPROTO_ULTRA    = 1,
95         IRDAPROTO_MAX
96 };
97
98 #define SOL_IRLMP      266 /* Same as SOL_IRDA for now */
99 #define SOL_IRTTP      266 /* Same as SOL_IRDA for now */
100
101 #define IRLMP_ENUMDEVICES        1
102 #define IRLMP_IAS_SET            2
103 #define IRLMP_IAS_QUERY          3
104 #define IRLMP_HINTS_SET          4
105 #define IRLMP_QOS_SET            5
106 #define IRLMP_QOS_GET            6
107 #define IRLMP_MAX_SDU_SIZE       7
108 #define IRLMP_IAS_GET            8
109
110 #define IRTTP_MAX_SDU_SIZE IRLMP_MAX_SDU_SIZE /* Compatibility */
111
112 /* LM-IAS Limits */
113 #define IAS_MAX_STRING        256
114 #define IAS_MAX_OCTET_STRING 1024
115 #define IAS_MAX_CLASSNAME      64
116 #define IAS_MAX_ATTRIBNAME    256
117
118 /* LM-IAS Attribute types */
119 #define IAS_MISSING 0
120 #define IAS_INTEGER 1
121 #define IAS_OCT_SEQ 2
122 #define IAS_STRING  3
123
124 #define LSAP_ANY              0xff
125 #define DEV_ADDR_ANY  0xffffffff
126
127 struct sockaddr_irda {
128         sa_family_t   sir_family;   /* AF_IRDA */
129         uint8_t      sir_lsap_sel; /* LSAP selector */
130         uint32_t     sir_addr;     /* Device address */
131         char          sir_name[25]; /* Usually <service>:IrDA:TinyTP */
132 };
133
134 struct irda_device_info {
135         uint32_t     saddr;    /* Address of local interface */
136         uint32_t     daddr;    /* Address of remote device */
137         char          info[22]; /* Description */
138         uint8_t      charset;  /* Charset used for description */
139         uint8_t      hints[2]; /* Hint bits */
140 };
141
142 struct irda_device_list {
143         uint32_t len;
144         struct irda_device_info dev[1];
145 };
146
147 struct irda_ias_set {
148         char irda_class_name[IAS_MAX_CLASSNAME];
149         char irda_attrib_name[IAS_MAX_ATTRIBNAME];
150         unsigned int irda_attrib_type;
151         union {
152                 unsigned int irda_attrib_int;
153                 struct {
154                         unsigned short len;
155                         u_char octet_seq[IAS_MAX_OCTET_STRING];
156                 } irda_attrib_octet_seq;
157                 struct {
158                         unsigned char len;
159                         unsigned char charset;
160                         unsigned char string[IAS_MAX_STRING];
161                 } irda_attrib_string;
162         } attribute;
163         uint32_t       daddr;
164
165 };
166
167 /* Some private IOCTL's (max 16) */
168 #define SIOCSDONGLE    (SIOCDEVPRIVATE + 0)
169 #define SIOCGDONGLE    (SIOCDEVPRIVATE + 1)
170 #define SIOCSBANDWIDTH (SIOCDEVPRIVATE + 2)
171 #define SIOCSMEDIABUSY (SIOCDEVPRIVATE + 3)
172 #define SIOCGMEDIABUSY (SIOCDEVPRIVATE + 4)
173 #define SIOCGRECEIVING (SIOCDEVPRIVATE + 5)
174 #define SIOCSMODE      (SIOCDEVPRIVATE + 6)
175 #define SIOCGMODE      (SIOCDEVPRIVATE + 7)
176 #define SIOCSDTRRTS    (SIOCDEVPRIVATE + 8)
177 #define SIOCGQOS       (SIOCDEVPRIVATE + 9)
178
179 /* No reason to include <linux/if.h> just because of this one ;-) */
180 #define IRNAMSIZ 16 
181
182 /* IrDA quality of service information (must not exceed 16 bytes) */
183 struct if_irda_qos {
184         uint32_t baudrate;
185         uint16_t data_size;
186         uint16_t window_size;
187         uint16_t min_turn_time;
188         uint16_t max_turn_time;
189         uint8_t  add_bofs;
190         uint8_t  link_disc;
191 };
192
193 /* For setting RTS and DTR lines of a dongle */
194 struct if_irda_line {
195         unsigned char dtr;
196         unsigned char rts;
197 };
198
199 /* IrDA interface configuration (data part must not exceed 16 bytes) */
200 struct if_irda_req {
201         union {
202                 char ifrn_name[IRNAMSIZ];  /* if name, e.g. "irda0" */
203         } ifr_ifrn;
204         
205         /* Data part */
206         union {
207                 struct if_irda_line ifru_line;
208                 struct if_irda_qos  ifru_qos;
209                 unsigned short      ifru_flags;
210                 unsigned int        ifru_receiving;
211                 unsigned int        ifru_mode;
212                 unsigned int        ifru_dongle;
213         } ifr_ifru;
214 };
215
216 #define ifr_baudrate  ifr_ifru.ifru_qos.baudrate
217 #define ifr_receiving ifr_ifru.ifru_receiving 
218 #define ifr_dongle    ifr_ifru.ifru_dongle
219 #define ifr_mode      ifr_ifru.ifru_mode
220 #define ifr_dtr       ifr_ifru.ifru_line.dtr
221 #define ifr_rts       ifr_ifru.ifru_line.rts
222
223 #endif /* IRDA_H */