2 BNEP protocol definition for Linux Bluetooth stack (BlueZ).
3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
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, as
7 published by the Free Software Foundation.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include <linux/types.h>
22 #include <linux/crc32.h>
23 #include <net/bluetooth/bluetooth.h>
26 #define BNEP_MAX_PROTO_FILTERS 5
27 #define BNEP_MAX_MULTICAST_FILTERS 20
30 #define BNEP_BASE_UUID 0x0000000000001000800000805F9B34FB
31 #define BNEP_UUID16 0x02
32 #define BNEP_UUID32 0x04
33 #define BNEP_UUID128 0x16
35 #define BNEP_SVC_PANU 0x1115
36 #define BNEP_SVC_NAP 0x1116
37 #define BNEP_SVC_GN 0x1117
40 #define BNEP_GENERAL 0x00
41 #define BNEP_CONTROL 0x01
42 #define BNEP_COMPRESSED 0x02
43 #define BNEP_COMPRESSED_SRC_ONLY 0x03
44 #define BNEP_COMPRESSED_DST_ONLY 0x04
47 #define BNEP_CMD_NOT_UNDERSTOOD 0x00
48 #define BNEP_SETUP_CONN_REQ 0x01
49 #define BNEP_SETUP_CONN_RSP 0x02
50 #define BNEP_FILTER_NET_TYPE_SET 0x03
51 #define BNEP_FILTER_NET_TYPE_RSP 0x04
52 #define BNEP_FILTER_MULTI_ADDR_SET 0x05
53 #define BNEP_FILTER_MULTI_ADDR_RSP 0x06
56 #define BNEP_EXT_CONTROL 0x00
58 /* Response messages */
59 #define BNEP_SUCCESS 0x00
61 #define BNEP_CONN_INVALID_DST 0x01
62 #define BNEP_CONN_INVALID_SRC 0x02
63 #define BNEP_CONN_INVALID_SVC 0x03
64 #define BNEP_CONN_NOT_ALLOWED 0x04
66 #define BNEP_FILTER_UNSUPPORTED_REQ 0x01
67 #define BNEP_FILTER_INVALID_RANGE 0x02
68 #define BNEP_FILTER_INVALID_MCADDR 0x02
69 #define BNEP_FILTER_LIMIT_REACHED 0x03
70 #define BNEP_FILTER_DENIED_SECURITY 0x04
75 #define BNEP_FLUSH_TO 0xffff
76 #define BNEP_CONNECT_TO 15
77 #define BNEP_FILTER_TO 15
80 #define BNEP_TYPE_MASK 0x7f
81 #define BNEP_EXT_HEADER 0x80
83 struct bnep_setup_conn_req
{
90 struct bnep_set_filter_req
{
97 struct bnep_control_rsp
{
103 struct bnep_ext_hdr
{
109 /* BNEP ioctl defines */
110 #define BNEPCONNADD _IOW('B', 200, int)
111 #define BNEPCONNDEL _IOW('B', 201, int)
112 #define BNEPGETCONNLIST _IOR('B', 210, int)
113 #define BNEPGETCONNINFO _IOR('B', 211, int)
114 #define BNEPGETSUPPFEAT _IOR('B', 212, int)
116 #define BNEP_SETUP_RESPONSE 0
117 #define BNEP_SETUP_RSP_SENT 10
119 struct bnep_connadd_req
{
120 int sock
; /* Connected socket */
123 char device
[16]; /* Name of the Ethernet device */
126 struct bnep_conndel_req
{
131 struct bnep_conninfo
{
139 struct bnep_connlist_req
{
141 struct bnep_conninfo __user
*ci
;
144 struct bnep_proto_filter
{
149 int bnep_add_connection(struct bnep_connadd_req
*req
, struct socket
*sock
);
150 int bnep_del_connection(struct bnep_conndel_req
*req
);
151 int bnep_get_connlist(struct bnep_connlist_req
*req
);
152 int bnep_get_conninfo(struct bnep_conninfo
*ci
);
155 struct bnep_session
{
156 struct list_head list
;
162 struct task_struct
*task
;
167 struct bnep_proto_filter proto_filter
[BNEP_MAX_PROTO_FILTERS
];
168 unsigned long long mc_filter
;
171 struct net_device
*dev
;
174 void bnep_net_setup(struct net_device
*dev
);
175 int bnep_sock_init(void);
176 void bnep_sock_cleanup(void);
178 static inline int bnep_mc_hash(__u8
*addr
)
180 return crc32_be(~0, addr
, ETH_ALEN
) >> 26;