]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/blob - include/net/bluetooth/a2mp.h
mm/bootmem.c: remove unused wrapper function reserve_bootmem_generic()
[can-eth-gw-linux.git] / include / net / bluetooth / a2mp.h
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
18 #include <net/bluetooth/l2cap.h>
19
20 #define A2MP_FEAT_EXT   0x8000
21
22 struct amp_mgr {
23         struct l2cap_conn       *l2cap_conn;
24         struct l2cap_chan       *a2mp_chan;
25         struct kref             kref;
26         __u8                    ident;
27         __u8                    handle;
28         unsigned long           flags;
29 };
30
31 struct a2mp_cmd {
32         __u8    code;
33         __u8    ident;
34         __le16  len;
35         __u8    data[0];
36 } __packed;
37
38 /* A2MP command codes */
39 #define A2MP_COMMAND_REJ         0x01
40 struct a2mp_cmd_rej {
41         __le16  reason;
42         __u8    data[0];
43 } __packed;
44
45 #define A2MP_DISCOVER_REQ        0x02
46 struct a2mp_discov_req {
47         __le16  mtu;
48         __le16  ext_feat;
49 } __packed;
50
51 struct a2mp_cl {
52         __u8    id;
53         __u8    type;
54         __u8    status;
55 } __packed;
56
57 #define A2MP_DISCOVER_RSP        0x03
58 struct a2mp_discov_rsp {
59         __le16     mtu;
60         __le16     ext_feat;
61         struct a2mp_cl cl[0];
62 } __packed;
63
64 #define A2MP_CHANGE_NOTIFY       0x04
65 #define A2MP_CHANGE_RSP          0x05
66
67 #define A2MP_GETINFO_REQ         0x06
68 struct a2mp_info_req {
69         __u8       id;
70 } __packed;
71
72 #define A2MP_GETINFO_RSP         0x07
73 struct a2mp_info_rsp {
74         __u8    id;
75         __u8    status;
76         __le32  total_bw;
77         __le32  max_bw;
78         __le32  min_latency;
79         __le16  pal_cap;
80         __le16  assoc_size;
81 } __packed;
82
83 #define A2MP_GETAMPASSOC_REQ     0x08
84 struct a2mp_amp_assoc_req {
85         __u8    id;
86 } __packed;
87
88 #define A2MP_GETAMPASSOC_RSP     0x09
89 struct a2mp_amp_assoc_rsp {
90         __u8    id;
91         __u8    status;
92         __u8    amp_assoc[0];
93 } __packed;
94
95 #define A2MP_CREATEPHYSLINK_REQ  0x0A
96 #define A2MP_DISCONNPHYSLINK_REQ 0x0C
97 struct a2mp_physlink_req {
98         __u8    local_id;
99         __u8    remote_id;
100         __u8    amp_assoc[0];
101 } __packed;
102
103 #define A2MP_CREATEPHYSLINK_RSP  0x0B
104 #define A2MP_DISCONNPHYSLINK_RSP 0x0D
105 struct a2mp_physlink_rsp {
106         __u8    local_id;
107         __u8    remote_id;
108         __u8    status;
109 } __packed;
110
111 /* A2MP response status */
112 #define A2MP_STATUS_SUCCESS                     0x00
113 #define A2MP_STATUS_INVALID_CTRL_ID             0x01
114 #define A2MP_STATUS_UNABLE_START_LINK_CREATION  0x02
115 #define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS     0x02
116 #define A2MP_STATUS_COLLISION_OCCURED           0x03
117 #define A2MP_STATUS_DISCONN_REQ_RECVD           0x04
118 #define A2MP_STATUS_PHYS_LINK_EXISTS            0x05
119 #define A2MP_STATUS_SECURITY_VIOLATION          0x06
120
121 void amp_mgr_get(struct amp_mgr *mgr);
122 int amp_mgr_put(struct amp_mgr *mgr);
123 struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
124                                        struct sk_buff *skb);
125
126 #endif /* __A2MP_H */