Bluetooth: A2MP: Process A2MP Get AMP Assoc Rsp
[deliverable/linux.git] / include / net / bluetooth / a2mp.h
CommitLineData
9740e49d
AE
1/*
2 Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved.
3 Copyright (c) 2011,2012 Intel Corp.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 and
7 only version 2 as published by the Free Software Foundation.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13*/
14
15#ifndef __A2MP_H
16#define __A2MP_H
17
97e8e89d
AE
18#include <net/bluetooth/l2cap.h>
19
8598d064
AE
20#define A2MP_FEAT_EXT 0x8000
21
f97268fc
AE
22enum amp_mgr_state {
23 READ_LOC_AMP_INFO,
903e4541 24 READ_LOC_AMP_ASSOC,
f97268fc
AE
25};
26
9740e49d 27struct amp_mgr {
f97268fc 28 struct list_head list;
9740e49d
AE
29 struct l2cap_conn *l2cap_conn;
30 struct l2cap_chan *a2mp_chan;
31 struct kref kref;
32 __u8 ident;
33 __u8 handle;
f97268fc 34 enum amp_mgr_state state;
9740e49d 35 unsigned long flags;
52c0d6e5
AE
36
37 struct list_head amp_ctrls;
38 struct mutex amp_ctrls_lock;
9740e49d
AE
39};
40
f6d3c6e7
AE
41struct a2mp_cmd {
42 __u8 code;
43 __u8 ident;
44 __le16 len;
45 __u8 data[0];
46} __packed;
47
b9058fb6
AE
48/* A2MP command codes */
49#define A2MP_COMMAND_REJ 0x01
50struct a2mp_cmd_rej {
51 __le16 reason;
52 __u8 data[0];
53} __packed;
54
55#define A2MP_DISCOVER_REQ 0x02
56struct a2mp_discov_req {
57 __le16 mtu;
58 __le16 ext_feat;
59} __packed;
60
61struct a2mp_cl {
62 __u8 id;
63 __u8 type;
64 __u8 status;
65} __packed;
66
67#define A2MP_DISCOVER_RSP 0x03
68struct a2mp_discov_rsp {
69 __le16 mtu;
70 __le16 ext_feat;
71 struct a2mp_cl cl[0];
72} __packed;
73
74#define A2MP_CHANGE_NOTIFY 0x04
75#define A2MP_CHANGE_RSP 0x05
76
77#define A2MP_GETINFO_REQ 0x06
78struct a2mp_info_req {
79 __u8 id;
80} __packed;
81
82#define A2MP_GETINFO_RSP 0x07
83struct a2mp_info_rsp {
84 __u8 id;
85 __u8 status;
86 __le32 total_bw;
87 __le32 max_bw;
88 __le32 min_latency;
89 __le16 pal_cap;
90 __le16 assoc_size;
91} __packed;
92
93#define A2MP_GETAMPASSOC_REQ 0x08
94struct a2mp_amp_assoc_req {
95 __u8 id;
96} __packed;
97
98#define A2MP_GETAMPASSOC_RSP 0x09
99struct a2mp_amp_assoc_rsp {
100 __u8 id;
101 __u8 status;
102 __u8 amp_assoc[0];
103} __packed;
104
105#define A2MP_CREATEPHYSLINK_REQ 0x0A
106#define A2MP_DISCONNPHYSLINK_REQ 0x0C
107struct a2mp_physlink_req {
108 __u8 local_id;
109 __u8 remote_id;
110 __u8 amp_assoc[0];
111} __packed;
112
113#define A2MP_CREATEPHYSLINK_RSP 0x0B
114#define A2MP_DISCONNPHYSLINK_RSP 0x0D
115struct a2mp_physlink_rsp {
116 __u8 local_id;
117 __u8 remote_id;
118 __u8 status;
119} __packed;
120
e7af522e
AE
121/* A2MP response status */
122#define A2MP_STATUS_SUCCESS 0x00
123#define A2MP_STATUS_INVALID_CTRL_ID 0x01
124#define A2MP_STATUS_UNABLE_START_LINK_CREATION 0x02
125#define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
126#define A2MP_STATUS_COLLISION_OCCURED 0x03
127#define A2MP_STATUS_DISCONN_REQ_RECVD 0x04
128#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
129#define A2MP_STATUS_SECURITY_VIOLATION 0x06
130
f97268fc
AE
131extern struct list_head amp_mgr_list;
132extern struct mutex amp_mgr_list_lock;
133
9740e49d
AE
134void amp_mgr_get(struct amp_mgr *mgr);
135int amp_mgr_put(struct amp_mgr *mgr);
97e8e89d
AE
136struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
137 struct sk_buff *skb);
f97268fc 138struct amp_mgr *amp_mgr_lookup_by_state(u8 state);
8e2a0d92
AE
139void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data);
140void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
903e4541 141void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
9740e49d
AE
142
143#endif /* __A2MP_H */
This page took 0.046922 seconds and 5 git commands to generate.