xref: /freebsd/lib/libbluetooth/bluetooth.h (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1 /*
2  * bluetooth.h
3  *
4  * Copyright (c) 2001-2003 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
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
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 $
29  * $FreeBSD$
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>
38 #include <sys/socket.h>
39 #include <sys/un.h>
40 #include <netdb.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
49  */
50 
51 #define	bacmp(ba1, ba2)	memcmp((ba1), (ba2), sizeof(bdaddr_t))
52 #define	bacpy(dst, src)	memcpy((dst), (src), sizeof(bdaddr_t))
53 #define ba2str(ba, str)	bt_ntoa((ba), (str))
54 #define str2ba(str, ba)	(bt_aton((str), (ba)) == 1? 0 : -1)
55 
56 /*
57  * Interface to the outside world
58  */
59 
60 struct hostent *  bt_gethostbyname    (char const *name);
61 struct hostent *  bt_gethostbyaddr    (char const *addr, int len, int type);
62 struct hostent *  bt_gethostent       (void);
63 void              bt_sethostent       (int stayopen);
64 void              bt_endhostent       (void);
65 
66 struct protoent * bt_getprotobyname   (char const *name);
67 struct protoent * bt_getprotobynumber (int proto);
68 struct protoent * bt_getprotoent      (void);
69 void              bt_setprotoent      (int stayopen);
70 void              bt_endprotoent      (void);
71 
72 char const *      bt_ntoa             (bdaddr_t const *ba, char *str);
73 int               bt_aton             (char const *str, bdaddr_t *ba);
74 
75 __END_DECLS
76 
77 #endif /* ndef _BLUETOOTH_H_ */
78 
79