xref: /haiku/headers/private/bluetooth/l2cap.h (revision 696b8e46f3434bdffdd5971ee3b3cb4349d3ba0a)
1*696b8e46SOliver Ruiz Dorantes /*
2*696b8e46SOliver Ruiz Dorantes  * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
3*696b8e46SOliver Ruiz Dorantes  * All rights reserved. Distributed under the terms of the MIT License.
4*696b8e46SOliver Ruiz Dorantes  *
5*696b8e46SOliver Ruiz Dorantes  */
6*696b8e46SOliver Ruiz Dorantes 
7*696b8e46SOliver Ruiz Dorantes /*-
8*696b8e46SOliver Ruiz Dorantes  * Copyright (c) Maksim Yevmenkin <m_evmenkin@yahoo.com>
9*696b8e46SOliver Ruiz Dorantes  * All rights reserved.
10*696b8e46SOliver Ruiz Dorantes  *
11*696b8e46SOliver Ruiz Dorantes  * Redistribution and use in source and binary forms, with or without
12*696b8e46SOliver Ruiz Dorantes  * modification, are permitted provided that the following conditions
13*696b8e46SOliver Ruiz Dorantes  * are met:
14*696b8e46SOliver Ruiz Dorantes  * 1. Redistributions of source code must retain the above copyright
15*696b8e46SOliver Ruiz Dorantes  *    notice, this list of conditions and the following disclaimer.
16*696b8e46SOliver Ruiz Dorantes  * 2. Redistributions in binary form must reproduce the above copyright
17*696b8e46SOliver Ruiz Dorantes  *    notice, this list of conditions and the following disclaimer in the
18*696b8e46SOliver Ruiz Dorantes  *    documentation and/or other materials provided with the distribution.
19*696b8e46SOliver Ruiz Dorantes */
20*696b8e46SOliver Ruiz Dorantes 
21*696b8e46SOliver Ruiz Dorantes 
22*696b8e46SOliver Ruiz Dorantes /**************************************************************************
23*696b8e46SOliver Ruiz Dorantes  **************************************************************************
24*696b8e46SOliver Ruiz Dorantes  **                   Common defines and types (L2CAP)
25*696b8e46SOliver Ruiz Dorantes  **************************************************************************
26*696b8e46SOliver Ruiz Dorantes  **************************************************************************/
27*696b8e46SOliver Ruiz Dorantes 
28*696b8e46SOliver Ruiz Dorantes #ifndef _L2CAP_
29*696b8e46SOliver Ruiz Dorantes #define _L2CAP_
30*696b8e46SOliver Ruiz Dorantes 
31*696b8e46SOliver Ruiz Dorantes #include <bluetooth/bluetooth.h>
32*696b8e46SOliver Ruiz Dorantes 
33*696b8e46SOliver Ruiz Dorantes // TODO: from BSD compatibility layer
34*696b8e46SOliver Ruiz Dorantes #define htole16(x) (x)
35*696b8e46SOliver Ruiz Dorantes 
36*696b8e46SOliver Ruiz Dorantes 
37*696b8e46SOliver Ruiz Dorantes /*
38*696b8e46SOliver Ruiz Dorantes  * Channel IDs are assigned relative to the instance of L2CAP node, i.e.
39*696b8e46SOliver Ruiz Dorantes  * relative to the unit. So the total number of channels that unit can have
40*696b8e46SOliver Ruiz Dorantes  * open at the same time is 0xffff - 0x0040 = 0xffbf (65471). This number
41*696b8e46SOliver Ruiz Dorantes  * does not depend on number of connections.
42*696b8e46SOliver Ruiz Dorantes  */
43*696b8e46SOliver Ruiz Dorantes #define L2CAP_NULL_CID		0x0000	/* DO NOT USE THIS CID */
44*696b8e46SOliver Ruiz Dorantes #define L2CAP_SIGNAL_CID	0x0001	/* signaling channel ID */
45*696b8e46SOliver Ruiz Dorantes #define L2CAP_CLT_CID		0x0002	/* connectionless channel ID */
46*696b8e46SOliver Ruiz Dorantes /* 0x0003 - 0x003f Reserved */
47*696b8e46SOliver Ruiz Dorantes #define L2CAP_FIRST_CID		0x0040	/* dynamically alloc. (start) */
48*696b8e46SOliver Ruiz Dorantes #define L2CAP_LAST_CID		0xffff	/* dynamically alloc. (end) */
49*696b8e46SOliver Ruiz Dorantes 
50*696b8e46SOliver Ruiz Dorantes 
51*696b8e46SOliver Ruiz Dorantes /*
52*696b8e46SOliver Ruiz Dorantes  * L2CAP signaling command ident's are assigned relative to the connection,
53*696b8e46SOliver Ruiz Dorantes  * because there is only one signaling channel (cid == 0x01) for every
54*696b8e46SOliver Ruiz Dorantes  * connection. So up to 254 (0xff - 0x01) L2CAP commands can be pending at the
55*696b8e46SOliver Ruiz Dorantes  * same time for the same connection.
56*696b8e46SOliver Ruiz Dorantes  */
57*696b8e46SOliver Ruiz Dorantes #define L2CAP_NULL_IDENT		0x00        /* DO NOT USE THIS IDENT */
58*696b8e46SOliver Ruiz Dorantes #define L2CAP_FIRST_IDENT		0x01        /* dynamically alloc. (start) */
59*696b8e46SOliver Ruiz Dorantes #define L2CAP_LAST_IDENT		0xff        /* dynamically alloc. (end) */
60*696b8e46SOliver Ruiz Dorantes 
61*696b8e46SOliver Ruiz Dorantes 
62*696b8e46SOliver Ruiz Dorantes /* L2CAP MTU */
63*696b8e46SOliver Ruiz Dorantes #define L2CAP_MTU_MINIMUM		48
64*696b8e46SOliver Ruiz Dorantes #define L2CAP_MTU_DEFAULT		672
65*696b8e46SOliver Ruiz Dorantes #define L2CAP_MTU_MAXIMUM		0xffff
66*696b8e46SOliver Ruiz Dorantes 
67*696b8e46SOliver Ruiz Dorantes /* L2CAP flush and link timeouts */
68*696b8e46SOliver Ruiz Dorantes #define L2CAP_FLUSH_TIMO_DEFAULT	0xffff /* always retransmit */
69*696b8e46SOliver Ruiz Dorantes #define L2CAP_LINK_TIMO_DEFAULT		0xffff
70*696b8e46SOliver Ruiz Dorantes 
71*696b8e46SOliver Ruiz Dorantes /* L2CAP Command Reject reasons */
72*696b8e46SOliver Ruiz Dorantes #define L2CAP_REJ_NOT_UNDERSTOOD	0x0000
73*696b8e46SOliver Ruiz Dorantes #define L2CAP_REJ_MTU_EXCEEDED		0x0001
74*696b8e46SOliver Ruiz Dorantes #define L2CAP_REJ_INVALID_CID		0x0002
75*696b8e46SOliver Ruiz Dorantes /* 0x0003 - 0xffff - reserved for future use */
76*696b8e46SOliver Ruiz Dorantes 
77*696b8e46SOliver Ruiz Dorantes /* Protocol/Service Multioplexor (PSM) values */
78*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_ANY		0x0000	/* Any/Invalid PSM */
79*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_SDP		0x0001	/* Service Discovery Protocol */
80*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_RFCOMM	0x0003	/* RFCOMM protocol */
81*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_TCP		0x0005	/* Telephony Control Protocol */
82*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_TCS		0x0007	/* TCS cordless */
83*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_BNEP		0x000F	/* BNEP */
84*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_HID_CTRL	0x0011	/* HID Control */
85*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_HID_INT	0x0013	/* HID Interrupt */
86*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_UPnP		0x0015	/* UPnP (ESDP) */
87*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_AVCTP		0x0017	/* AVCTP */
88*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_AVDTP		0x0019	/* AVDTP */
89*696b8e46SOliver Ruiz Dorantes /*  < 0x1000 - reserved for future use */
90*696b8e46SOliver Ruiz Dorantes /*  0x1001 < x < 0xFFFF dinamically assigned */
91*696b8e46SOliver Ruiz Dorantes 
92*696b8e46SOliver Ruiz Dorantes /* L2CAP Connection response command result codes */
93*696b8e46SOliver Ruiz Dorantes #define L2CAP_SUCCESS		0x0000
94*696b8e46SOliver Ruiz Dorantes #define L2CAP_PENDING		0x0001
95*696b8e46SOliver Ruiz Dorantes #define L2CAP_PSM_NOT_SUPPORTED	0x0002
96*696b8e46SOliver Ruiz Dorantes #define L2CAP_SEQUIRY_BLOCK	0x0003
97*696b8e46SOliver Ruiz Dorantes #define L2CAP_NO_RESOURCES	0x0004
98*696b8e46SOliver Ruiz Dorantes #define L2CAP_TIMEOUT		0xeeee
99*696b8e46SOliver Ruiz Dorantes #define L2CAP_UNKNOWN		0xffff
100*696b8e46SOliver Ruiz Dorantes /* 0x0005 - 0xffff - reserved for future use */
101*696b8e46SOliver Ruiz Dorantes 
102*696b8e46SOliver Ruiz Dorantes /* L2CAP Connection response status codes */
103*696b8e46SOliver Ruiz Dorantes #define L2CAP_NO_INFO		0x0000
104*696b8e46SOliver Ruiz Dorantes #define L2CAP_AUTH_PENDING		0x0001
105*696b8e46SOliver Ruiz Dorantes #define L2CAP_AUTZ_PENDING		0x0002
106*696b8e46SOliver Ruiz Dorantes /* 0x0003 - 0xffff - reserved for future use */
107*696b8e46SOliver Ruiz Dorantes 
108*696b8e46SOliver Ruiz Dorantes /* L2CAP Configuration response result codes */
109*696b8e46SOliver Ruiz Dorantes #define L2CAP_UNACCEPTABLE_PARAMS	0x0001
110*696b8e46SOliver Ruiz Dorantes #define L2CAP_REJECT			0x0002
111*696b8e46SOliver Ruiz Dorantes #define L2CAP_UNKNOWN_OPTION		0x0003
112*696b8e46SOliver Ruiz Dorantes /* 0x0003 - 0xffff - reserved for future use */
113*696b8e46SOliver Ruiz Dorantes 
114*696b8e46SOliver Ruiz Dorantes /* L2CAP Configuration options */
115*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_CFLAG_BIT		0x0001
116*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_CFLAG(flags)		((flags) & L2CAP_OPT_CFLAG_BIT)
117*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_HINT_BIT		0x80
118*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_HINT(type)		((type) & L2CAP_OPT_HINT_BIT)
119*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_HINT_MASK		0x7f
120*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_MTU			0x01
121*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_MTU_SIZE		sizeof(uint16)
122*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_FLUSH_TIMO		0x02
123*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_FLUSH_TIMO_SIZE	sizeof(uint16)
124*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_QOS			0x03
125*696b8e46SOliver Ruiz Dorantes #define L2CAP_OPT_QOS_SIZE		sizeof(l2cap_qos)
126*696b8e46SOliver Ruiz Dorantes /* 0x4 - 0xff - reserved for future use */
127*696b8e46SOliver Ruiz Dorantes 
128*696b8e46SOliver Ruiz Dorantes /* L2CAP Information request type codes */
129*696b8e46SOliver Ruiz Dorantes #define L2CAP_CONNLESS_MTU		0x0001
130*696b8e46SOliver Ruiz Dorantes #define L2CAP_EXTENDED_MASK	0x0002
131*696b8e46SOliver Ruiz Dorantes /* 0x0003 - 0xffff - reserved for future use */
132*696b8e46SOliver Ruiz Dorantes 
133*696b8e46SOliver Ruiz Dorantes /* L2CAP Information response codes */
134*696b8e46SOliver Ruiz Dorantes #define L2CAP_NOT_SUPPORTED		0x0001
135*696b8e46SOliver Ruiz Dorantes /* 0x0002 - 0xffff - reserved for future use */
136*696b8e46SOliver Ruiz Dorantes 
137*696b8e46SOliver Ruiz Dorantes /* L2CAP flow (QoS) */
138*696b8e46SOliver Ruiz Dorantes typedef struct {
139*696b8e46SOliver Ruiz Dorantes 	uint8	flags;             /* reserved for future use */
140*696b8e46SOliver Ruiz Dorantes 	uint8	service_type;      /* service type */
141*696b8e46SOliver Ruiz Dorantes 	uint32	token_rate;        /* bytes per second */
142*696b8e46SOliver Ruiz Dorantes 	uint32	token_bucket_size; /* bytes */
143*696b8e46SOliver Ruiz Dorantes 	uint32	peak_bandwidth;    /* bytes per second */
144*696b8e46SOliver Ruiz Dorantes 	uint32	latency;           /* microseconds */
145*696b8e46SOliver Ruiz Dorantes 	uint32	delay_variation;   /* microseconds */
146*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_flow_t;
147*696b8e46SOliver Ruiz Dorantes 
148*696b8e46SOliver Ruiz Dorantes 
149*696b8e46SOliver Ruiz Dorantes /**************************************************************************
150*696b8e46SOliver Ruiz Dorantes  **************************************************************************
151*696b8e46SOliver Ruiz Dorantes  **                 Link level defines, headers and types
152*696b8e46SOliver Ruiz Dorantes  **************************************************************************
153*696b8e46SOliver Ruiz Dorantes  **************************************************************************/
154*696b8e46SOliver Ruiz Dorantes 
155*696b8e46SOliver Ruiz Dorantes /* L2CAP header */
156*696b8e46SOliver Ruiz Dorantes typedef struct {
157*696b8e46SOliver Ruiz Dorantes 	uint16	length;	/* payload size */
158*696b8e46SOliver Ruiz Dorantes 	uint16	dcid;	/* destination channel ID */
159*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_hdr_t;
160*696b8e46SOliver Ruiz Dorantes 
161*696b8e46SOliver Ruiz Dorantes 
162*696b8e46SOliver Ruiz Dorantes /* L2CAP ConnectionLess Traffic (CLT) (if destination cid == 0x2) */
163*696b8e46SOliver Ruiz Dorantes typedef struct {
164*696b8e46SOliver Ruiz Dorantes 	uint16	psm; /* Protocol/Service Multiplexor */
165*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_clt_hdr_t;
166*696b8e46SOliver Ruiz Dorantes 
167*696b8e46SOliver Ruiz Dorantes #define L2CAP_CLT_MTU_MAXIMUM (L2CAP_MTU_MAXIMUM - sizeof(l2cap_clt_hdr_t))
168*696b8e46SOliver Ruiz Dorantes 
169*696b8e46SOliver Ruiz Dorantes /* L2CAP command header */
170*696b8e46SOliver Ruiz Dorantes typedef struct {
171*696b8e46SOliver Ruiz Dorantes 	uint8	code;   /* command OpCode */
172*696b8e46SOliver Ruiz Dorantes 	uint8	ident;  /* identifier to match request and response */
173*696b8e46SOliver Ruiz Dorantes 	uint16	length; /* command parameters length */
174*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_cmd_hdr_t;
175*696b8e46SOliver Ruiz Dorantes 
176*696b8e46SOliver Ruiz Dorantes 
177*696b8e46SOliver Ruiz Dorantes /* L2CAP Command Reject */
178*696b8e46SOliver Ruiz Dorantes #define L2CAP_CMD_REJ	0x01
179*696b8e46SOliver Ruiz Dorantes typedef struct {
180*696b8e46SOliver Ruiz Dorantes 	uint16	reason; /* reason to reject command */
181*696b8e46SOliver Ruiz Dorantes /*	uint8	data[]; -- optional data (depends on reason) */
182*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_cmd_rej_cp;
183*696b8e46SOliver Ruiz Dorantes 
184*696b8e46SOliver Ruiz Dorantes /* CommandReject data */
185*696b8e46SOliver Ruiz Dorantes typedef union {
186*696b8e46SOliver Ruiz Dorantes  	/* L2CAP_REJ_MTU_EXCEEDED */
187*696b8e46SOliver Ruiz Dorantes 	struct {
188*696b8e46SOliver Ruiz Dorantes 		uint16	mtu; /* actual signaling MTU */
189*696b8e46SOliver Ruiz Dorantes 	} __attribute__ ((packed)) mtu;
190*696b8e46SOliver Ruiz Dorantes 	/* L2CAP_REJ_INVALID_CID */
191*696b8e46SOliver Ruiz Dorantes 	struct {
192*696b8e46SOliver Ruiz Dorantes 		uint16	scid; /* local CID */
193*696b8e46SOliver Ruiz Dorantes 		uint16	dcid; /* remote CID */
194*696b8e46SOliver Ruiz Dorantes 	} __attribute__ ((packed)) cid;
195*696b8e46SOliver Ruiz Dorantes } l2cap_cmd_rej_data_t;
196*696b8e46SOliver Ruiz Dorantes typedef l2cap_cmd_rej_data_t * l2cap_cmd_rej_data_p;
197*696b8e46SOliver Ruiz Dorantes 
198*696b8e46SOliver Ruiz Dorantes /* L2CAP Connection Request */
199*696b8e46SOliver Ruiz Dorantes #define L2CAP_CON_REQ	0x02
200*696b8e46SOliver Ruiz Dorantes typedef struct {
201*696b8e46SOliver Ruiz Dorantes 	uint16	psm;  /* Protocol/Service Multiplexor (PSM) */
202*696b8e46SOliver Ruiz Dorantes 	uint16	scid; /* source channel ID */
203*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_con_req_cp;
204*696b8e46SOliver Ruiz Dorantes 
205*696b8e46SOliver Ruiz Dorantes /* L2CAP Connection Response */
206*696b8e46SOliver Ruiz Dorantes #define L2CAP_CON_RSP	0x03
207*696b8e46SOliver Ruiz Dorantes typedef struct {
208*696b8e46SOliver Ruiz Dorantes 	uint16	dcid;   /* destination channel ID */
209*696b8e46SOliver Ruiz Dorantes 	uint16	scid;   /* source channel ID */
210*696b8e46SOliver Ruiz Dorantes 	uint16	result; /* 0x00 - success */
211*696b8e46SOliver Ruiz Dorantes 	uint16	status; /* more info if result != 0x00 */
212*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_con_rsp_cp;
213*696b8e46SOliver Ruiz Dorantes 
214*696b8e46SOliver Ruiz Dorantes /* L2CAP Configuration Request */
215*696b8e46SOliver Ruiz Dorantes #define L2CAP_CFG_REQ	0x04
216*696b8e46SOliver Ruiz Dorantes typedef struct {
217*696b8e46SOliver Ruiz Dorantes 	uint16	dcid;  /* destination channel ID */
218*696b8e46SOliver Ruiz Dorantes 	uint16	flags; /* flags */
219*696b8e46SOliver Ruiz Dorantes /*	uint8	options[] --  options */
220*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_cfg_req_cp;
221*696b8e46SOliver Ruiz Dorantes 
222*696b8e46SOliver Ruiz Dorantes /* L2CAP Configuration Response */
223*696b8e46SOliver Ruiz Dorantes #define L2CAP_CFG_RSP	0x05
224*696b8e46SOliver Ruiz Dorantes typedef struct {
225*696b8e46SOliver Ruiz Dorantes 	uint16	scid;   /* source channel ID */
226*696b8e46SOliver Ruiz Dorantes 	uint16	flags;  /* flags */
227*696b8e46SOliver Ruiz Dorantes 	uint16	result; /* 0x00 - success */
228*696b8e46SOliver Ruiz Dorantes /*	uint8	options[] -- options */
229*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_cfg_rsp_cp;
230*696b8e46SOliver Ruiz Dorantes 
231*696b8e46SOliver Ruiz Dorantes /* L2CAP configuration option */
232*696b8e46SOliver Ruiz Dorantes typedef struct {
233*696b8e46SOliver Ruiz Dorantes 	uint8	type;
234*696b8e46SOliver Ruiz Dorantes 	uint8	length;
235*696b8e46SOliver Ruiz Dorantes /*	uint8	value[] -- option value (depends on type) */
236*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_cfg_opt_t;
237*696b8e46SOliver Ruiz Dorantes typedef l2cap_cfg_opt_t * l2cap_cfg_opt_p;
238*696b8e46SOliver Ruiz Dorantes 
239*696b8e46SOliver Ruiz Dorantes /* L2CAP configuration option value */
240*696b8e46SOliver Ruiz Dorantes typedef union {
241*696b8e46SOliver Ruiz Dorantes 	uint16		mtu;		/* L2CAP_OPT_MTU */
242*696b8e46SOliver Ruiz Dorantes 	uint16		flush_timo;	/* L2CAP_OPT_FLUSH_TIMO */
243*696b8e46SOliver Ruiz Dorantes 	l2cap_flow_t	flow;		/* L2CAP_OPT_QOS */
244*696b8e46SOliver Ruiz Dorantes } l2cap_cfg_opt_val_t;
245*696b8e46SOliver Ruiz Dorantes typedef l2cap_cfg_opt_val_t * l2cap_cfg_opt_val_p;
246*696b8e46SOliver Ruiz Dorantes 
247*696b8e46SOliver Ruiz Dorantes /* L2CAP Disconnect Request */
248*696b8e46SOliver Ruiz Dorantes #define L2CAP_DISCON_REQ	0x06
249*696b8e46SOliver Ruiz Dorantes typedef struct {
250*696b8e46SOliver Ruiz Dorantes 	uint16	dcid; /* destination channel ID */
251*696b8e46SOliver Ruiz Dorantes 	uint16	scid; /* source channel ID */
252*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_discon_req_cp;
253*696b8e46SOliver Ruiz Dorantes 
254*696b8e46SOliver Ruiz Dorantes /* L2CAP Disconnect Response */
255*696b8e46SOliver Ruiz Dorantes #define L2CAP_DISCON_RSP	0x07
256*696b8e46SOliver Ruiz Dorantes typedef l2cap_discon_req_cp	l2cap_discon_rsp_cp;
257*696b8e46SOliver Ruiz Dorantes 
258*696b8e46SOliver Ruiz Dorantes /* L2CAP Echo Request */
259*696b8e46SOliver Ruiz Dorantes #define L2CAP_ECHO_REQ	0x08
260*696b8e46SOliver Ruiz Dorantes /* No command parameters, only optional data */
261*696b8e46SOliver Ruiz Dorantes 
262*696b8e46SOliver Ruiz Dorantes /* L2CAP Echo Response */
263*696b8e46SOliver Ruiz Dorantes #define L2CAP_ECHO_RSP	0x09
264*696b8e46SOliver Ruiz Dorantes #define L2CAP_MAX_ECHO_SIZE \
265*696b8e46SOliver Ruiz Dorantes 	(L2CAP_MTU_MAXIMUM - sizeof(l2cap_cmd_hdr_t))
266*696b8e46SOliver Ruiz Dorantes /* No command parameters, only optional data */
267*696b8e46SOliver Ruiz Dorantes 
268*696b8e46SOliver Ruiz Dorantes /* L2CAP Information Request */
269*696b8e46SOliver Ruiz Dorantes #define L2CAP_INFO_REQ	0x0a
270*696b8e46SOliver Ruiz Dorantes typedef struct {
271*696b8e46SOliver Ruiz Dorantes 	uint16	type; /* requested information type */
272*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_info_req_cp;
273*696b8e46SOliver Ruiz Dorantes 
274*696b8e46SOliver Ruiz Dorantes /* L2CAP Information Response */
275*696b8e46SOliver Ruiz Dorantes #define L2CAP_INFO_RSP	0x0b
276*696b8e46SOliver Ruiz Dorantes typedef struct {
277*696b8e46SOliver Ruiz Dorantes 	uint16	type;   /* requested information type */
278*696b8e46SOliver Ruiz Dorantes 	uint16	result; /* 0x00 - success */
279*696b8e46SOliver Ruiz Dorantes /*	uint8	info[]  -- info data (depends on type)
280*696b8e46SOliver Ruiz Dorantes  *
281*696b8e46SOliver Ruiz Dorantes  * L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU
282*696b8e46SOliver Ruiz Dorantes  */
283*696b8e46SOliver Ruiz Dorantes } __attribute__ ((packed)) l2cap_info_rsp_cp;
284*696b8e46SOliver Ruiz Dorantes 
285*696b8e46SOliver Ruiz Dorantes typedef union {
286*696b8e46SOliver Ruiz Dorantes  	/* L2CAP_CONNLESS_MTU */
287*696b8e46SOliver Ruiz Dorantes 	struct {
288*696b8e46SOliver Ruiz Dorantes 		uint16	mtu;
289*696b8e46SOliver Ruiz Dorantes 	} __attribute__ ((packed)) mtu;
290*696b8e46SOliver Ruiz Dorantes } l2cap_info_rsp_data_t;
291*696b8e46SOliver Ruiz Dorantes typedef l2cap_info_rsp_data_t *	l2cap_info_rsp_data_p;
292*696b8e46SOliver Ruiz Dorantes 
293*696b8e46SOliver Ruiz Dorantes 
294*696b8e46SOliver Ruiz Dorantes #endif
295*696b8e46SOliver Ruiz Dorantes 
296