This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / net / bluetooth / hidp / hidp.h
1 /* 
2    HIDP implementation for Linux Bluetooth stack (BlueZ).
3    Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org>
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License version 2 as
7    published by the Free Software Foundation;
8
9    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
12    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
13    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 
14    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 
15    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
16    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
19    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
20    SOFTWARE IS DISCLAIMED.
21 */
22
23 #ifndef __HIDP_H
24 #define __HIDP_H
25
26 #include <linux/types.h>
27 #include <net/bluetooth/bluetooth.h>
28
29 /* HIDP ioctl defines */
30 #define HIDPCONNADD     _IOW('H', 200, int)
31 #define HIDPCONNDEL     _IOW('H', 201, int)
32 #define HIDPGETCONNLIST _IOR('H', 210, int)
33 #define HIDPGETCONNINFO _IOR('H', 211, int)
34
35 #define HIDP_VIRTUAL_CABLE_UNPLUG       0
36 #define HIDP_BOOT_PROTOCOL_MODE         1
37 #define HIDP_BLUETOOTH_VENDOR_ID        9
38
39 struct hidp_connadd_req {
40         int   ctrl_sock;        // Connected control socket
41         int   intr_sock;        // Connteted interrupt socket
42         __u16 parser;
43         __u16 rd_size;
44         __u8 *rd_data;
45         __u8  country;
46         __u8  subclass;
47         __u16 vendor;
48         __u16 product;
49         __u16 version;
50         __u32 flags;
51         __u32 idle_to;
52         char  name[128];
53 };
54
55 struct hidp_conndel_req {
56         bdaddr_t bdaddr;
57         __u32    flags;
58 };
59
60 struct hidp_conninfo {
61         bdaddr_t bdaddr;
62         __u32    flags;
63         __u16    state;
64         __u16    vendor;
65         __u16    product;
66         __u16    version;
67         char     name[128];
68 };
69
70 struct hidp_connlist_req {
71         __u32  cnum;
72         struct hidp_conninfo __user *ci;
73 };
74
75 int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock);
76 int hidp_del_connection(struct hidp_conndel_req *req);
77 int hidp_get_connlist(struct hidp_connlist_req *req);
78 int hidp_get_conninfo(struct hidp_conninfo *ci);
79
80 /* HIDP session defines */
81 struct hidp_session {
82         struct list_head list;
83
84         struct socket *ctrl_sock;
85         struct socket *intr_sock;
86
87         bdaddr_t bdaddr;
88
89         unsigned long state;
90         unsigned long flags;
91         unsigned long idle_to;
92
93         uint ctrl_mtu;
94         uint intr_mtu;
95
96         atomic_t terminate;
97
98         unsigned char keys[8];
99         unsigned char leds;
100
101         struct input_dev *input;
102
103         struct timer_list timer;
104
105         struct sk_buff_head ctrl_transmit;
106         struct sk_buff_head intr_transmit;
107 };
108
109 static inline void hidp_schedule(struct hidp_session *session)
110 {
111         struct sock *ctrl_sk = session->ctrl_sock->sk;
112         struct sock *intr_sk = session->intr_sock->sk;
113
114         wake_up_interruptible(ctrl_sk->sk_sleep);
115         wake_up_interruptible(intr_sk->sk_sleep);
116 }
117
118 /* HIDP init defines */
119 extern int __init hidp_init_sockets(void);
120 extern void __exit hidp_cleanup_sockets(void);
121
122 #endif /* __HIDP_H */