Deleted Added
full compact
bluetooth.h (181698) bluetooth.h (189462)
1/*
2 * bluetooth.h
1/*
2 * bluetooth.h
3 *
4 * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
3 */
4
5/*-
6 * Copyright (c) 2001-2009 Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright

--- 8 unchanged lines hidden (view full) ---

21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: bluetooth.h,v 1.5 2003/09/14 23:28:42 max Exp $
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

--- 8 unchanged lines hidden (view full) ---

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * $Id: bluetooth.h,v 1.5 2003/09/14 23:28:42 max Exp $
29 * $FreeBSD: head/lib/libbluetooth/bluetooth.h 181698 2008-08-13 19:35:31Z emax $
31 * $FreeBSD: head/lib/libbluetooth/bluetooth.h 189462 2009-03-06 23:30:07Z emax $
30 */
31
32#ifndef _BLUETOOTH_H_
33#define _BLUETOOTH_H_
34
35#include <sys/types.h>
36#include <sys/bitstring.h>
37#include <sys/endian.h>
32 */
33
34#ifndef _BLUETOOTH_H_
35#define _BLUETOOTH_H_
36
37#include <sys/types.h>
38#include <sys/bitstring.h>
39#include <sys/endian.h>
40#include <sys/ioctl.h>
38#include <sys/socket.h>
39#include <sys/un.h>
41#include <sys/socket.h>
42#include <sys/un.h>
43#include <errno.h>
40#include <netdb.h>
44#include <netdb.h>
45#include <netgraph/ng_message.h>
41#include <netgraph/bluetooth/include/ng_hci.h>
42#include <netgraph/bluetooth/include/ng_l2cap.h>
43#include <netgraph/bluetooth/include/ng_btsocket.h>
44
45__BEGIN_DECLS
46
47/*
48 * Linux BlueZ compatibility

--- 18 unchanged lines hidden (view full) ---

67struct protoent * bt_getprotobynumber (int proto);
68struct protoent * bt_getprotoent (void);
69void bt_setprotoent (int stayopen);
70void bt_endprotoent (void);
71
72char const * bt_ntoa (bdaddr_t const *ba, char *str);
73int bt_aton (char const *str, bdaddr_t *ba);
74
46#include <netgraph/bluetooth/include/ng_hci.h>
47#include <netgraph/bluetooth/include/ng_l2cap.h>
48#include <netgraph/bluetooth/include/ng_btsocket.h>
49
50__BEGIN_DECLS
51
52/*
53 * Linux BlueZ compatibility

--- 18 unchanged lines hidden (view full) ---

72struct protoent * bt_getprotobynumber (int proto);
73struct protoent * bt_getprotoent (void);
74void bt_setprotoent (int stayopen);
75void bt_endprotoent (void);
76
77char const * bt_ntoa (bdaddr_t const *ba, char *str);
78int bt_aton (char const *str, bdaddr_t *ba);
79
80/* bt_devXXXX() functions (inspired by NetBSD) */
81int bt_devaddr (char const *devname, bdaddr_t *addr);
82int bt_devname (char *devname, bdaddr_t const *addr);
83
84/*
85 * Bluetooth HCI functions
86 */
87
88#define HCI_DEVMAX 32 /* arbitrary */
89#define HCI_DEVNAME_SIZE NG_NODESIZ
90#define HCI_DEVFEATURES_SIZE NG_HCI_FEATURES_SIZE
91
92struct bt_devinfo
93{
94 char devname[HCI_DEVNAME_SIZE];
95
96 uint32_t state; /* device/implementation specific */
97
98 bdaddr_t bdaddr;
99 uint16_t _reserved0;
100
101 uint8_t features[HCI_DEVFEATURES_SIZE];
102
103 /* buffer info */
104 uint16_t _reserved1;
105 uint16_t cmd_free;
106 uint16_t sco_size;
107 uint16_t sco_pkts;
108 uint16_t sco_free;
109 uint16_t acl_size;
110 uint16_t acl_pkts;
111 uint16_t acl_free;
112
113 /* stats */
114 uint32_t cmd_sent;
115 uint32_t evnt_recv;
116 uint32_t acl_recv;
117 uint32_t acl_sent;
118 uint32_t sco_recv;
119 uint32_t sco_sent;
120 uint32_t bytes_recv;
121 uint32_t bytes_sent;
122
123 /* misc/specific */
124 uint16_t link_policy_info;
125 uint16_t packet_type_info;
126 uint16_t role_switch_info;
127 uint16_t debug;
128
129 uint8_t _padding[20]; /* leave space for future additions */
130};
131
132typedef int (bt_devenum_cb_t)(int, struct bt_devinfo const *, void *);
133
134int bt_devinfo (struct bt_devinfo *di);
135int bt_devenum (bt_devenum_cb_t *cb, void *arg);
136
75/*
76 * bdaddr utility functions (from NetBSD)
77 */
78
79static __inline int
80bdaddr_same(const bdaddr_t *a, const bdaddr_t *b)
81{
82 return (a->b[0] == b->b[0] && a->b[1] == b->b[1] &&

--- 26 unchanged lines hidden ---
137/*
138 * bdaddr utility functions (from NetBSD)
139 */
140
141static __inline int
142bdaddr_same(const bdaddr_t *a, const bdaddr_t *b)
143{
144 return (a->b[0] == b->b[0] && a->b[1] == b->b[1] &&

--- 26 unchanged lines hidden ---