hammer util: avoid running concurrent cleanups
[dragonfly.git] / lib / libbluetooth / bluetooth.h
blobbaadadb43f4e46e5399bffde00317c98422e3755
1 /* $NetBSD: bluetooth.h,v 1.3 2006/09/26 19:18:19 plunky Exp $ */
2 /* $DragonFly: src/lib/libbluetooth/bluetooth.h,v 1.1 2008/01/03 11:47:52 hasso Exp $ */
4 /*
5 * bluetooth.h
7 * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
8 * All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
31 * $Id: bluetooth.h,v 1.3 2006/09/26 19:18:19 plunky Exp $
32 * $FreeBSD: src/lib/libbluetooth/bluetooth.h,v 1.2 2005/03/17 21:39:44 emax Exp $
35 #ifndef _BLUETOOTH_H_
36 #define _BLUETOOTH_H_
38 #include <sys/types.h>
39 #include <sys/endian.h>
40 #include <sys/socket.h>
41 #include <netdb.h>
42 #include <netbt/bluetooth.h>
43 #include <netbt/hci.h>
44 #include <netbt/l2cap.h>
45 #include <stdio.h>
47 __BEGIN_DECLS
50 * Interface to the outside world
53 struct hostent * bt_gethostbyname (char const *);
54 struct hostent * bt_gethostbyaddr (void const *, socklen_t, int);
55 struct hostent * bt_gethostent (void);
56 void bt_sethostent (int);
57 void bt_endhostent (void);
59 struct protoent * bt_getprotobyname (char const *);
60 struct protoent * bt_getprotobynumber (int);
61 struct protoent * bt_getprotoent (void);
62 void bt_setprotoent (int);
63 void bt_endprotoent (void);
65 char const * bt_ntoa (bdaddr_t const *, char *);
66 int bt_aton (char const *, bdaddr_t *);
68 int bt_devaddr (const char *, bdaddr_t *);
69 int bt_devname (char *, const bdaddr_t *);
72 * bthcid(8) PIN Client API
75 /* Client PIN Request packet */
76 typedef struct {
77 bdaddr_t laddr; /* local address */
78 bdaddr_t raddr; /* remote address */
79 uint8_t time; /* validity (seconds) */
80 } __attribute__ ((packed)) bthcid_pin_request_t;
82 /* Client PIN Response packet */
83 typedef struct {
84 bdaddr_t laddr; /* local address */
85 bdaddr_t raddr; /* remote address */
86 uint8_t pin[HCI_PIN_SIZE]; /* PIN */
87 } __attribute__ ((packed)) bthcid_pin_response_t;
89 /* Default socket name */
90 #define BTHCID_SOCKET_NAME "/var/run/bthcid"
92 #define COMPAT_BLUEZ
93 #ifdef COMPAT_BLUEZ
95 * Linux BlueZ compatibility
98 #define bacmp(ba1, ba2) memcmp((ba1), (ba2), sizeof(bdaddr_t))
99 #define bacpy(dst, src) memcpy((dst), (src), sizeof(bdaddr_t))
100 #define ba2str(ba, str) bt_ntoa((ba), (str))
101 #define str2ba(str, ba) (bt_aton((str), (ba)) == 1 ? 0 : -1)
103 #define htobs(x) htole16(x)
104 #define htobl(x) htole32(x)
105 #define btohs(x) le16toh(x)
106 #define btohl(x) le32toh(x)
108 #define bt_malloc(n) malloc(n)
109 #define bt_free(p) free(p)
111 #endif /* COMPAT_BLUEZ */
113 __END_DECLS
115 #endif /* ndef _BLUETOOTH_H_ */