10986ab12SMaksim Yevmenkin /* 20986ab12SMaksim Yevmenkin * bluetooth.h 30986ab12SMaksim Yevmenkin * 40986ab12SMaksim Yevmenkin * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com> 50986ab12SMaksim Yevmenkin * All rights reserved. 60986ab12SMaksim Yevmenkin * 70986ab12SMaksim Yevmenkin * Redistribution and use in source and binary forms, with or without 80986ab12SMaksim Yevmenkin * modification, are permitted provided that the following conditions 90986ab12SMaksim Yevmenkin * are met: 100986ab12SMaksim Yevmenkin * 1. Redistributions of source code must retain the above copyright 110986ab12SMaksim Yevmenkin * notice, this list of conditions and the following disclaimer. 120986ab12SMaksim Yevmenkin * 2. Redistributions in binary form must reproduce the above copyright 130986ab12SMaksim Yevmenkin * notice, this list of conditions and the following disclaimer in the 140986ab12SMaksim Yevmenkin * documentation and/or other materials provided with the distribution. 150986ab12SMaksim Yevmenkin * 160986ab12SMaksim Yevmenkin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 170986ab12SMaksim Yevmenkin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 180986ab12SMaksim Yevmenkin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 190986ab12SMaksim Yevmenkin * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 200986ab12SMaksim Yevmenkin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 210986ab12SMaksim Yevmenkin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 220986ab12SMaksim Yevmenkin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 230986ab12SMaksim Yevmenkin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 240986ab12SMaksim Yevmenkin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 250986ab12SMaksim Yevmenkin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 260986ab12SMaksim Yevmenkin * SUCH DAMAGE. 270986ab12SMaksim Yevmenkin * 280986ab12SMaksim Yevmenkin * $Id: bluetooth.h,v 1.5 2003/09/14 23:28:42 max Exp $ 290986ab12SMaksim Yevmenkin * $FreeBSD$ 300986ab12SMaksim Yevmenkin */ 310986ab12SMaksim Yevmenkin 320986ab12SMaksim Yevmenkin #ifndef _BLUETOOTH_H_ 330986ab12SMaksim Yevmenkin #define _BLUETOOTH_H_ 340986ab12SMaksim Yevmenkin 350986ab12SMaksim Yevmenkin #include <sys/types.h> 360986ab12SMaksim Yevmenkin #include <sys/bitstring.h> 370986ab12SMaksim Yevmenkin #include <sys/endian.h> 380986ab12SMaksim Yevmenkin #include <sys/socket.h> 390986ab12SMaksim Yevmenkin #include <sys/un.h> 400986ab12SMaksim Yevmenkin #include <netdb.h> 410986ab12SMaksim Yevmenkin #include <netgraph/bluetooth/include/ng_hci.h> 420986ab12SMaksim Yevmenkin #include <netgraph/bluetooth/include/ng_l2cap.h> 430986ab12SMaksim Yevmenkin #include <netgraph/bluetooth/include/ng_btsocket.h> 440986ab12SMaksim Yevmenkin 450986ab12SMaksim Yevmenkin __BEGIN_DECLS 460986ab12SMaksim Yevmenkin 470986ab12SMaksim Yevmenkin /* 480986ab12SMaksim Yevmenkin * Lunux BlueZ compatibility 490986ab12SMaksim Yevmenkin */ 500986ab12SMaksim Yevmenkin 510986ab12SMaksim Yevmenkin #define bacmp(ba1, ba2) memcmp((ba1), (ba2), sizeof(bdaddr_t)) 520986ab12SMaksim Yevmenkin #define bacpy(dst, src) memcpy((dst), (src), sizeof(bdaddr_t)) 530986ab12SMaksim Yevmenkin #define ba2str(ba, str) bt_ntoa((ba), (str)) 540986ab12SMaksim Yevmenkin #define str2ba(str, ba) (bt_aton((str), (ba)) == 1? 0 : -1) 550986ab12SMaksim Yevmenkin 560986ab12SMaksim Yevmenkin /* 570986ab12SMaksim Yevmenkin * Interface to the outside world 580986ab12SMaksim Yevmenkin */ 590986ab12SMaksim Yevmenkin 600986ab12SMaksim Yevmenkin struct hostent * bt_gethostbyname (char const *name); 610986ab12SMaksim Yevmenkin struct hostent * bt_gethostbyaddr (char const *addr, int len, int type); 620986ab12SMaksim Yevmenkin struct hostent * bt_gethostent (void); 630986ab12SMaksim Yevmenkin void bt_sethostent (int stayopen); 640986ab12SMaksim Yevmenkin void bt_endhostent (void); 650986ab12SMaksim Yevmenkin 660986ab12SMaksim Yevmenkin struct protoent * bt_getprotobyname (char const *name); 670986ab12SMaksim Yevmenkin struct protoent * bt_getprotobynumber (int proto); 680986ab12SMaksim Yevmenkin struct protoent * bt_getprotoent (void); 690986ab12SMaksim Yevmenkin void bt_setprotoent (int stayopen); 700986ab12SMaksim Yevmenkin void bt_endprotoent (void); 710986ab12SMaksim Yevmenkin 720986ab12SMaksim Yevmenkin char const * bt_ntoa (bdaddr_t const *ba, char *str); 730986ab12SMaksim Yevmenkin int bt_aton (char const *str, bdaddr_t *ba); 740986ab12SMaksim Yevmenkin 750986ab12SMaksim Yevmenkin __END_DECLS 760986ab12SMaksim Yevmenkin 770986ab12SMaksim Yevmenkin #endif /* ndef _BLUETOOTH_H_ */ 780986ab12SMaksim Yevmenkin 79