mgmt.h revision 8582b8e4cdf85425a40696c2839c44417c798687
1/*
2 *  BlueZ - Bluetooth protocol stack for Linux
3 *
4 *  Copyright (C) 2010  Nokia Corporation
5 *  Copyright (C) 2010  Marcel Holtmann <marcel@holtmann.org>
6 *
7 *
8 *  This program is free software; you can redistribute it and/or modify
9 *  it under the terms of the GNU General Public License as published by
10 *  the Free Software Foundation; either version 2 of the License, or
11 *  (at your option) any later version.
12 *
13 *  This program is distributed in the hope that it will be useful,
14 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *  GNU General Public License for more details.
17 *
18 *  You should have received a copy of the GNU General Public License
19 *  along with this program; if not, write to the Free Software
20 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 *
22 */
23
24#ifndef __packed
25#define __packed __attribute__((packed))
26#endif
27
28struct mgmt_hdr {
29	uint16_t opcode;
30	uint16_t len;
31} __packed;
32#define MGMT_HDR_SIZE	4
33
34#define MGMT_OP_READ_VERSION		0x0001
35struct mgmt_rp_read_version {
36	uint8_t version;
37	uint16_t revision;
38} __packed;
39
40#define MGMT_OP_READ_FEATURES		0x0002
41struct mgmt_rp_read_features {
42	uint8_t features[8];
43} __packed;
44
45#define MGMT_OP_READ_INDEX_LIST		0x0003
46struct mgmt_rp_read_index_list {
47	uint16_t num_controllers;
48	uint16_t index[0];
49} __packed;
50
51#define MGMT_OP_READ_INFO		0x0004
52struct mgmt_cp_read_info {
53	uint16_t index;
54} __packed;
55struct mgmt_rp_read_info {
56	uint16_t index;
57	uint8_t type;
58	uint8_t powered;
59	uint8_t discoverable;
60	uint8_t pairable;
61	uint8_t sec_mode;
62	bdaddr_t bdaddr;
63	uint8_t dev_class[3];
64	uint8_t features[8];
65	uint16_t manufacturer;
66	uint8_t hci_ver;
67	uint16_t hci_rev;
68} __packed;
69
70#define MGMT_OP_READ_STATISTICS		0x0005
71
72#define MGMT_EV_CMD_COMPLETE		0x0001
73struct mgmt_ev_cmd_complete {
74	uint16_t opcode;
75	uint8_t data[0];
76} __packed;
77
78#define MGMT_EV_CMD_STATUS		0x0002
79struct mgmt_ev_cmd_status {
80	uint8_t status;
81	uint16_t opcode;
82} __packed;
83
84#define MGMT_EV_CONTROLLER_ERROR	0x0003
85struct mgmt_ev_controller_error {
86	uint16_t index;
87	uint8_t error_code;
88} __packed;
89
90#define MGMT_EV_INDEX_ADDED		0x0004
91struct mgmt_ev_index_added {
92	uint16_t index;
93} __packed;
94
95#define MGMT_EV_INDEX_REMOVED		0x0005
96struct mgmt_ev_index_removed {
97	uint16_t index;
98} __packed;
99
100#define MGMT_EV_POWERED			0x0006
101struct mgmt_ev_powered {
102	uint16_t index;
103	uint8_t powered;
104} __packed;
105