xref: /freebsd/usr.sbin/bluetooth/btpand/bnep.h (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
1 /*	$NetBSD: bnep.h,v 1.1 2008/08/17 13:20:57 plunky Exp $	*/
2 
3 /*-
4  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
5  *
6  * Copyright (c) 2008 Iain Hibbert
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 /* $FreeBSD$ */
31 
32 /*
33  * Constants defined in the Bluetooth Network Encapsulation
34  * Protocol (BNEP) specification v1.0
35  */
36 
37 #define	BNEP_MTU_MIN		1691
38 
39 #define BNEP_EXT		0x80
40 #define	BNEP_TYPE(x)		((x) & 0x7f)
41 #define BNEP_TYPE_EXT(x)	(((x) & BNEP_EXT) == BNEP_EXT)
42 
43 /* BNEP packet types */
44 #define	BNEP_GENERAL_ETHERNET			0x00
45 #define	BNEP_CONTROL				0x01
46 #define	BNEP_COMPRESSED_ETHERNET		0x02
47 #define	BNEP_COMPRESSED_ETHERNET_SRC_ONLY	0x03
48 #define	BNEP_COMPRESSED_ETHERNET_DST_ONLY	0x04
49 
50 /* BNEP extension header types */
51 #define	BNEP_EXTENSION_CONTROL			0x00
52 
53 /* BNEP control types */
54 #define	BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD	0x00
55 #define	BNEP_SETUP_CONNECTION_REQUEST		0x01
56 #define	BNEP_SETUP_CONNECTION_RESPONSE		0x02
57 #define	BNEP_FILTER_NET_TYPE_SET		0x03
58 #define	BNEP_FILTER_NET_TYPE_RESPONSE		0x04
59 #define	BNEP_FILTER_MULTI_ADDR_SET		0x05
60 #define	BNEP_FILTER_MULTI_ADDR_RESPONSE		0x06
61 
62 /* BNEP setup response codes */
63 #define	BNEP_SETUP_SUCCESS		0x0000
64 #define	BNEP_SETUP_INVALID_SRC_UUID	0x0001
65 #define	BNEP_SETUP_INVALID_DST_UUID	0x0002
66 #define	BNEP_SETUP_INVALID_UUID_SIZE	0x0003
67 #define	BNEP_SETUP_NOT_ALLOWED		0x0004
68 
69 /* BNEP filter return codes */
70 #define	BNEP_FILTER_SUCCESS		0x0000
71 #define	BNEP_FILTER_UNSUPPORTED_REQUEST	0x0001
72 #define	BNEP_FILTER_INVALID_RANGE	0x0002
73 #define	BNEP_FILTER_TOO_MANY_FILTERS	0x0003
74 #define	BNEP_FILTER_SECURITY_FAILURE	0x0004
75