2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation;
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED.
26 * $Id: l2cap.h,v 1.1.1.1 2002/03/08 21:03:15 maxk Exp $
33 #define L2CAP_DEFAULT_MTU 672
34 #define L2CAP_DEFAULT_FLUSH_TO 0xFFFF
36 #define L2CAP_CONN_TIMEOUT (HZ * 40)
38 /* L2CAP socket address */
40 sa_family_t l2_family;
41 unsigned short l2_psm;
46 #define L2CAP_OPTIONS 0x01
47 struct l2cap_options {
53 #define L2CAP_CONNINFO 0x02
54 struct l2cap_conninfo {
59 #define L2CAP_LM_MASTER 0x0001
60 #define L2CAP_LM_AUTH 0x0002
61 #define L2CAP_LM_ENCRYPT 0x0004
62 #define L2CAP_LM_TRUSTED 0x0008
64 #define L2CAP_QOS 0x04
68 __u32 token_bucket_size;
71 __u32 delay_variation;
74 #define L2CAP_SERV_NO_TRAFFIC 0x00
75 #define L2CAP_SERV_BEST_EFFORT 0x01
76 #define L2CAP_SERV_GUARANTEED 0x02
78 /* L2CAP command codes */
79 #define L2CAP_COMMAND_REJ 0x01
80 #define L2CAP_CONN_REQ 0x02
81 #define L2CAP_CONN_RSP 0x03
82 #define L2CAP_CONF_REQ 0x04
83 #define L2CAP_CONF_RSP 0x05
84 #define L2CAP_DISCONN_REQ 0x06
85 #define L2CAP_DISCONN_RSP 0x07
86 #define L2CAP_ECHO_REQ 0x08
87 #define L2CAP_ECHO_RSP 0x09
88 #define L2CAP_INFO_REQ 0x0a
89 #define L2CAP_INFO_RSP 0x0b
91 /* L2CAP structures */
95 } __attribute__ ((packed));
96 #define L2CAP_HDR_SIZE 4
98 struct l2cap_cmd_hdr {
102 } __attribute__ ((packed));
103 #define L2CAP_CMD_HDR_SIZE 4
105 struct l2cap_cmd_rej {
107 } __attribute__ ((packed));
109 struct l2cap_conn_req {
112 } __attribute__ ((packed));
114 struct l2cap_conn_rsp {
119 } __attribute__ ((packed));
122 #define L2CAP_CR_SUCCESS 0x0000
123 #define L2CAP_CR_PEND 0x0001
124 #define L2CAP_CR_BAD_PSM 0x0002
125 #define L2CAP_CR_SEC_BLOCK 0x0003
126 #define L2CAP_CR_NO_MEM 0x0004
129 #define L2CAP_CS_NO_INFO 0x0000
130 #define L2CAP_CS_AUTHEN_PEND 0x0001
131 #define L2CAP_CS_AUTHOR_PEND 0x0002
133 struct l2cap_conf_req {
137 } __attribute__ ((packed));
139 struct l2cap_conf_rsp {
144 } __attribute__ ((packed));
146 #define L2CAP_CONF_SUCCESS 0x00
147 #define L2CAP_CONF_UNACCEPT 0x01
149 struct l2cap_conf_opt {
153 } __attribute__ ((packed));
154 #define L2CAP_CONF_OPT_SIZE 2
156 #define L2CAP_CONF_MTU 0x01
157 #define L2CAP_CONF_FLUSH_TO 0x02
158 #define L2CAP_CONF_QOS 0x03
160 #define L2CAP_CONF_MAX_SIZE 22
162 struct l2cap_disconn_req {
165 } __attribute__ ((packed));
167 struct l2cap_disconn_rsp {
170 } __attribute__ ((packed));
172 struct l2cap_info_req {
175 } __attribute__ ((packed));
177 struct l2cap_info_rsp {
181 } __attribute__ ((packed));
183 /* ----- L2CAP connections ----- */
184 struct l2cap_chan_list {
191 struct hci_conn *hcon;
200 struct sk_buff *rx_skb;
205 struct l2cap_chan_list chan_list;
208 /* ----- L2CAP channel and socket info ----- */
209 #define l2cap_pi(sk) ((struct l2cap_pinfo *)sk->sk_protinfo)
230 struct l2cap_conn *conn;
235 #define L2CAP_CONF_REQ_SENT 0x01
236 #define L2CAP_CONF_INPUT_DONE 0x02
237 #define L2CAP_CONF_OUTPUT_DONE 0x04
238 #define L2CAP_CONF_MAX_RETRIES 2
240 void l2cap_load(void);
242 #endif /* __L2CAP_H */