respond to L2CAP Information requests
This commit is contained in:
parent
c221725e98
commit
590bad2347
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: l2cap.h,v 1.9 2009/09/13 18:45:11 pooka Exp $ */
|
||||
/* $NetBSD: l2cap.h,v 1.10 2011/02/06 18:50:59 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 Iain Hibbert.
|
||||
|
@ -54,7 +54,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: l2cap.h,v 1.9 2009/09/13 18:45:11 pooka Exp $
|
||||
* $Id: l2cap.h,v 1.10 2011/02/06 18:50:59 plunky Exp $
|
||||
* $FreeBSD: src/sys/netgraph/bluetooth/include/l2cap.h,v 1.4 2005/08/31 18:13:23 emax Exp $
|
||||
*/
|
||||
|
||||
|
@ -166,7 +166,8 @@
|
|||
/* L2CAP Information request type codes */
|
||||
#define L2CAP_CONNLESS_MTU 0x0001
|
||||
#define L2CAP_EXTENDED_FEATURES 0x0002
|
||||
/* 0x0003 - 0xffff - reserved for future use */
|
||||
#define L2CAP_FIXED_CHANNELS 0x0003
|
||||
/* 0x0004 - 0xffff - reserved for future use */
|
||||
|
||||
/* L2CAP Information response codes */
|
||||
#define L2CAP_NOT_SUPPORTED 0x0001
|
||||
|
@ -320,17 +321,9 @@ typedef struct {
|
|||
uint16_t type; /* requested information type */
|
||||
uint16_t result; /* 0x00 - success */
|
||||
/* uint8_t info[] -- info data (depends on type)
|
||||
*
|
||||
* L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU
|
||||
*/
|
||||
} __packed l2cap_info_rsp_cp;
|
||||
|
||||
typedef union {
|
||||
/* L2CAP_CONNLESS_MTU */
|
||||
struct {
|
||||
uint16_t mtu;
|
||||
} __packed mtu;
|
||||
} l2cap_info_rsp_data_t;
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: l2cap_signal.c,v 1.11 2010/11/17 20:19:25 plunky Exp $ */
|
||||
/* $NetBSD: l2cap_signal.c,v 1.12 2011/02/06 18:51:00 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 Iain Hibbert.
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: l2cap_signal.c,v 1.11 2010/11/17 20:19:25 plunky Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: l2cap_signal.c,v 1.12 2011/02/06 18:51:00 plunky Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -857,15 +857,14 @@ l2cap_recv_disconnect_rsp(struct mbuf *m, struct hci_link *link)
|
|||
}
|
||||
|
||||
/*
|
||||
* Process Received Info Request. We must respond but alas dont
|
||||
* support anything as yet so thats easy.
|
||||
* Process Received Info Request.
|
||||
*/
|
||||
static void
|
||||
l2cap_recv_info_req(struct mbuf *m, struct hci_link *link)
|
||||
{
|
||||
l2cap_cmd_hdr_t cmd;
|
||||
l2cap_info_req_cp cp;
|
||||
l2cap_info_rsp_cp rp;
|
||||
uint8_t rsp[12];
|
||||
|
||||
m_copydata(m, 0, sizeof(cmd), &cmd);
|
||||
m_adj(m, sizeof(cmd));
|
||||
|
@ -873,15 +872,51 @@ l2cap_recv_info_req(struct mbuf *m, struct hci_link *link)
|
|||
m_copydata(m, 0, sizeof(cp), &cp);
|
||||
m_adj(m, sizeof(cp));
|
||||
|
||||
switch(le16toh(cp.type)) {
|
||||
case L2CAP_CONNLESS_MTU:
|
||||
cp.type = le16toh(cp.type);
|
||||
switch(cp.type) {
|
||||
case L2CAP_EXTENDED_FEATURES:
|
||||
default:
|
||||
rp.type = cp.type;
|
||||
rp.result = htole16(L2CAP_NOT_SUPPORTED);
|
||||
/*
|
||||
* 32-bit data field, unused bits set to zero
|
||||
*
|
||||
* octet bit feature
|
||||
* 0 0 Flow control mode
|
||||
* 0 1 Retransmission mode
|
||||
* 0 2 Bi-directional QoS
|
||||
* 0 3 Enhanced retransmission mode
|
||||
* 0 4 Streaming mode
|
||||
* 0 5 FCS option
|
||||
* 0 6 Extended flow specification for BR/EDR
|
||||
* 0 7 Fixed channels (SET)
|
||||
* 1 0 Extended window size
|
||||
* 1 1 Unicast connectionless data reception
|
||||
*/
|
||||
le16enc(rsp + 0, cp.type);
|
||||
le16enc(rsp + 2, L2CAP_SUCCESS);
|
||||
le32enc(rsp + 4, 0x00000080);
|
||||
l2cap_send_signal(link, L2CAP_INFO_RSP, cmd.ident, 8, rsp);
|
||||
break;
|
||||
|
||||
l2cap_send_signal(link, L2CAP_INFO_RSP, cmd.ident,
|
||||
sizeof(rp), &rp);
|
||||
case L2CAP_FIXED_CHANNELS:
|
||||
/*
|
||||
* 64-bit data field, unused bits set to zero
|
||||
*
|
||||
* octet bit channel
|
||||
* 0 0 0x0000 Null
|
||||
* 0 1 0x0001 L2CAP Signalling Channel (SET)
|
||||
* 0 2 0x0002 Connectionless Reception
|
||||
* 0 3 0x0003 AMP Manager Protocol Channel
|
||||
*/
|
||||
le16enc(rsp + 0, cp.type);
|
||||
le16enc(rsp + 2, L2CAP_SUCCESS);
|
||||
le64enc(rsp + 4, 0x0000000000000002);
|
||||
l2cap_send_signal(link, L2CAP_INFO_RSP, cmd.ident, 12, rsp);
|
||||
break;
|
||||
|
||||
case L2CAP_CONNLESS_MTU:
|
||||
default:
|
||||
le16enc(rsp + 0, cp.type);
|
||||
le16enc(rsp + 2, L2CAP_NOT_SUPPORTED);
|
||||
l2cap_send_signal(link, L2CAP_INFO_RSP, cmd.ident, 4, rsp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue