l2cap.h (589d27464846c7cb758f93d9ee380c8ff05a161c) l2cap.h (47ec1dcd696d56a7c396e5838516a566ecd4b03d)
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
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

--- 12 unchanged lines hidden (view full) ---

21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED.
23*/
24
25#ifndef __L2CAP_H
26#define __L2CAP_H
27
28/* L2CAP defaults */
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
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

--- 12 unchanged lines hidden (view full) ---

21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED.
23*/
24
25#ifndef __L2CAP_H
26#define __L2CAP_H
27
28/* L2CAP defaults */
29#define L2CAP_DEFAULT_MTU 672
30#define L2CAP_DEFAULT_FLUSH_TO 0xFFFF
29#define L2CAP_DEFAULT_MTU 672
30#define L2CAP_DEFAULT_FLUSH_TO 0xffff
31#define L2CAP_DEFAULT_RX_WINDOW 1
32#define L2CAP_DEFAULT_MAX_RECEIVE 1
33#define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */
34#define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */
35#define L2CAP_DEFAULT_MAX_RX_APDU 0xfff7
31
32#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
33#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
34
35/* L2CAP socket address */
36struct sockaddr_l2 {
37 sa_family_t l2_family;
38 __le16 l2_psm;

--- 20 unchanged lines hidden (view full) ---

59#define L2CAP_LM_MASTER 0x0001
60#define L2CAP_LM_AUTH 0x0002
61#define L2CAP_LM_ENCRYPT 0x0004
62#define L2CAP_LM_TRUSTED 0x0008
63#define L2CAP_LM_RELIABLE 0x0010
64#define L2CAP_LM_SECURE 0x0020
65
66/* L2CAP command codes */
36
37#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
38#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
39
40/* L2CAP socket address */
41struct sockaddr_l2 {
42 sa_family_t l2_family;
43 __le16 l2_psm;

--- 20 unchanged lines hidden (view full) ---

64#define L2CAP_LM_MASTER 0x0001
65#define L2CAP_LM_AUTH 0x0002
66#define L2CAP_LM_ENCRYPT 0x0004
67#define L2CAP_LM_TRUSTED 0x0008
68#define L2CAP_LM_RELIABLE 0x0010
69#define L2CAP_LM_SECURE 0x0020
70
71/* L2CAP command codes */
67#define L2CAP_COMMAND_REJ 0x01
68#define L2CAP_CONN_REQ 0x02
69#define L2CAP_CONN_RSP 0x03
70#define L2CAP_CONF_REQ 0x04
71#define L2CAP_CONF_RSP 0x05
72#define L2CAP_DISCONN_REQ 0x06
73#define L2CAP_DISCONN_RSP 0x07
74#define L2CAP_ECHO_REQ 0x08
75#define L2CAP_ECHO_RSP 0x09
76#define L2CAP_INFO_REQ 0x0a
77#define L2CAP_INFO_RSP 0x0b
72#define L2CAP_COMMAND_REJ 0x01
73#define L2CAP_CONN_REQ 0x02
74#define L2CAP_CONN_RSP 0x03
75#define L2CAP_CONF_REQ 0x04
76#define L2CAP_CONF_RSP 0x05
77#define L2CAP_DISCONN_REQ 0x06
78#define L2CAP_DISCONN_RSP 0x07
79#define L2CAP_ECHO_REQ 0x08
80#define L2CAP_ECHO_RSP 0x09
81#define L2CAP_INFO_REQ 0x0a
82#define L2CAP_INFO_RSP 0x0b
78
83
84/* L2CAP feature mask */
85#define L2CAP_FEAT_FLOWCTL 0x00000001
86#define L2CAP_FEAT_RETRANS 0x00000002
87#define L2CAP_FEAT_ERTM 0x00000008
88#define L2CAP_FEAT_STREAMING 0x00000010
89#define L2CAP_FEAT_FCS 0x00000020
90#define L2CAP_FEAT_FIXED_CHAN 0x00000080
91
92/* L2CAP checksum option */
93#define L2CAP_FCS_NONE 0x00
94#define L2CAP_FCS_CRC16 0x01
95
79/* L2CAP structures */
80struct l2cap_hdr {
81 __le16 len;
82 __le16 cid;
83} __attribute__ ((packed));
84#define L2CAP_HDR_SIZE 4
85
86struct l2cap_cmd_hdr {

--- 21 unchanged lines hidden (view full) ---

108
109/* channel indentifier */
110#define L2CAP_CID_SIGNALING 0x0001
111#define L2CAP_CID_CONN_LESS 0x0002
112#define L2CAP_CID_DYN_START 0x0040
113#define L2CAP_CID_DYN_END 0xffff
114
115/* connect result */
96/* L2CAP structures */
97struct l2cap_hdr {
98 __le16 len;
99 __le16 cid;
100} __attribute__ ((packed));
101#define L2CAP_HDR_SIZE 4
102
103struct l2cap_cmd_hdr {

--- 21 unchanged lines hidden (view full) ---

125
126/* channel indentifier */
127#define L2CAP_CID_SIGNALING 0x0001
128#define L2CAP_CID_CONN_LESS 0x0002
129#define L2CAP_CID_DYN_START 0x0040
130#define L2CAP_CID_DYN_END 0xffff
131
132/* connect result */
116#define L2CAP_CR_SUCCESS 0x0000
117#define L2CAP_CR_PEND 0x0001
118#define L2CAP_CR_BAD_PSM 0x0002
119#define L2CAP_CR_SEC_BLOCK 0x0003
120#define L2CAP_CR_NO_MEM 0x0004
133#define L2CAP_CR_SUCCESS 0x0000
134#define L2CAP_CR_PEND 0x0001
135#define L2CAP_CR_BAD_PSM 0x0002
136#define L2CAP_CR_SEC_BLOCK 0x0003
137#define L2CAP_CR_NO_MEM 0x0004
121
122/* connect status */
138
139/* connect status */
123#define L2CAP_CS_NO_INFO 0x0000
124#define L2CAP_CS_AUTHEN_PEND 0x0001
125#define L2CAP_CS_AUTHOR_PEND 0x0002
140#define L2CAP_CS_NO_INFO 0x0000
141#define L2CAP_CS_AUTHEN_PEND 0x0001
142#define L2CAP_CS_AUTHOR_PEND 0x0002
126
127struct l2cap_conf_req {
128 __le16 dcid;
129 __le16 flags;
130 __u8 data[0];
131} __attribute__ ((packed));
132
133struct l2cap_conf_rsp {

--- 11 unchanged lines hidden (view full) ---

145struct l2cap_conf_opt {
146 __u8 type;
147 __u8 len;
148 __u8 val[0];
149} __attribute__ ((packed));
150#define L2CAP_CONF_OPT_SIZE 2
151
152#define L2CAP_CONF_HINT 0x80
143
144struct l2cap_conf_req {
145 __le16 dcid;
146 __le16 flags;
147 __u8 data[0];
148} __attribute__ ((packed));
149
150struct l2cap_conf_rsp {

--- 11 unchanged lines hidden (view full) ---

162struct l2cap_conf_opt {
163 __u8 type;
164 __u8 len;
165 __u8 val[0];
166} __attribute__ ((packed));
167#define L2CAP_CONF_OPT_SIZE 2
168
169#define L2CAP_CONF_HINT 0x80
170#define L2CAP_CONF_MASK 0x7f
153
154#define L2CAP_CONF_MTU 0x01
155#define L2CAP_CONF_FLUSH_TO 0x02
156#define L2CAP_CONF_QOS 0x03
157#define L2CAP_CONF_RFC 0x04
171
172#define L2CAP_CONF_MTU 0x01
173#define L2CAP_CONF_FLUSH_TO 0x02
174#define L2CAP_CONF_QOS 0x03
175#define L2CAP_CONF_RFC 0x04
176#define L2CAP_CONF_FCS 0x05
158
159#define L2CAP_CONF_MAX_SIZE 22
160
161struct l2cap_conf_rfc {
162 __u8 mode;
163 __u8 txwin_size;
164 __u8 max_transmit;
165 __le16 retrans_timeout;
166 __le16 monitor_timeout;
167 __le16 max_pdu_size;
168} __attribute__ ((packed));
169
170#define L2CAP_MODE_BASIC 0x00
171#define L2CAP_MODE_RETRANS 0x01
172#define L2CAP_MODE_FLOWCTL 0x02
177
178#define L2CAP_CONF_MAX_SIZE 22
179
180struct l2cap_conf_rfc {
181 __u8 mode;
182 __u8 txwin_size;
183 __u8 max_transmit;
184 __le16 retrans_timeout;
185 __le16 monitor_timeout;
186 __le16 max_pdu_size;
187} __attribute__ ((packed));
188
189#define L2CAP_MODE_BASIC 0x00
190#define L2CAP_MODE_RETRANS 0x01
191#define L2CAP_MODE_FLOWCTL 0x02
192#define L2CAP_MODE_ERTM 0x03
193#define L2CAP_MODE_STREAM 0x04
173
174struct l2cap_disconn_req {
175 __le16 dcid;
176 __le16 scid;
177} __attribute__ ((packed));
178
179struct l2cap_disconn_rsp {
180 __le16 dcid;

--- 100 unchanged lines hidden ---
194
195struct l2cap_disconn_req {
196 __le16 dcid;
197 __le16 scid;
198} __attribute__ ((packed));
199
200struct l2cap_disconn_rsp {
201 __le16 dcid;

--- 100 unchanged lines hidden ---