OSDN Git Service

build: Add --enable-midi to bootstrap-configure
[android-x86/external-bluetooth-bluez.git] / lib / bnep.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
6  *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
7  *
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24
25 #ifndef __BNEP_H
26 #define __BNEP_H
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #include <bluetooth/bluetooth.h>
33
34 #ifndef ETH_ALEN
35 #define ETH_ALEN        6               /* from <net/ethernet.h> */
36 #endif
37
38 /* BNEP UUIDs */
39 #define BNEP_BASE_UUID 0x0000000000001000800000805F9B34FB
40 #define BNEP_UUID16    0x02
41 #define BNEP_UUID32    0x04
42 #define BNEP_UUID128   0x16
43
44 #define BNEP_SVC_PANU  0x1115
45 #define BNEP_SVC_NAP   0x1116
46 #define BNEP_SVC_GN    0x1117
47
48 /* BNEP packet types */
49 #define BNEP_GENERAL               0x00
50 #define BNEP_CONTROL               0x01
51 #define BNEP_COMPRESSED            0x02
52 #define BNEP_COMPRESSED_SRC_ONLY   0x03
53 #define BNEP_COMPRESSED_DST_ONLY   0x04
54
55 /* BNEP control types */
56 #define BNEP_CMD_NOT_UNDERSTOOD    0x00
57 #define BNEP_SETUP_CONN_REQ        0x01
58 #define BNEP_SETUP_CONN_RSP        0x02
59 #define BNEP_FILTER_NET_TYPE_SET   0x03
60 #define BNEP_FILTER_NET_TYPE_RSP   0x04
61 #define BNEP_FILTER_MULT_ADDR_SET  0x05
62 #define BNEP_FILTER_MULT_ADDR_RSP  0x06
63
64 /* BNEP response messages */
65 #define BNEP_SUCCESS               0x00
66
67 #define BNEP_CONN_INVALID_DST      0x01
68 #define BNEP_CONN_INVALID_SRC      0x02
69 #define BNEP_CONN_INVALID_SVC      0x03
70 #define BNEP_CONN_NOT_ALLOWED      0x04
71
72 #define BNEP_FILTER_UNSUPPORTED_REQ    0x01
73 #define BNEP_FILTER_INVALID_RANGE      0x02
74 #define BNEP_FILTER_INVALID_MCADDR     0x02
75 #define BNEP_FILTER_LIMIT_REACHED      0x03
76 #define BNEP_FILTER_DENIED_SECURITY    0x04
77
78 /* L2CAP settings */
79 #define BNEP_MTU         1691
80 #define BNEP_FLUSH_TO    0xffff
81 #define BNEP_CONNECT_TO  15
82 #define BNEP_FILTER_TO   15
83
84 #ifndef BNEP_PSM
85 #define BNEP_PSM         0x0f
86 #endif
87
88 /* BNEP headers */
89 #define BNEP_TYPE_MASK   0x7f
90 #define BNEP_EXT_HEADER  0x80
91
92 struct bnep_setup_conn_req {
93         uint8_t  type;
94         uint8_t  ctrl;
95         uint8_t  uuid_size;
96         uint8_t  service[0];
97 } __attribute__((packed));
98
99 struct bnep_set_filter_req {
100         uint8_t  type;
101         uint8_t  ctrl;
102         uint16_t len;
103         uint8_t  list[0];
104 } __attribute__((packed));
105
106 struct bnep_ctrl_cmd_not_understood_cmd {
107         uint8_t type;
108         uint8_t ctrl;
109         uint8_t unkn_ctrl;
110 } __attribute__((packed));
111
112 struct bnep_control_rsp {
113         uint8_t  type;
114         uint8_t  ctrl;
115         uint16_t resp;
116 } __attribute__((packed));
117
118 struct bnep_ext_hdr {
119         uint8_t  type;
120         uint8_t  len;
121         uint8_t  data[0];
122 } __attribute__((packed));
123
124 /* BNEP ioctl defines */
125 #define BNEPCONNADD     _IOW('B', 200, int)
126 #define BNEPCONNDEL     _IOW('B', 201, int)
127 #define BNEPGETCONNLIST _IOR('B', 210, int)
128 #define BNEPGETCONNINFO _IOR('B', 211, int)
129 #define BNEPGETSUPPFEAT _IOR('B', 212, int)
130
131 #define BNEP_SETUP_RESPONSE     0
132
133 struct bnep_connadd_req {
134         int      sock;          /* Connected socket */
135         uint32_t flags;
136         uint16_t role;
137         char     device[16];    /* Name of the Ethernet device */
138 };
139
140 struct bnep_conndel_req {
141         uint32_t flags;
142         uint8_t  dst[ETH_ALEN];
143 };
144
145 struct bnep_conninfo {
146         uint32_t flags;
147         uint16_t role;
148         uint16_t state;
149         uint8_t  dst[ETH_ALEN];
150         char     device[16];
151 };
152
153 struct bnep_connlist_req {
154         uint32_t cnum;
155         struct bnep_conninfo *ci;
156 };
157
158 #ifdef __cplusplus
159 }
160 #endif
161
162 #endif /* __BNEP_H */