Home | History | Annotate | Line # | Download | only in libbluetooth
bluetooth.h revision 1.2
      1  1.2     tron /*	$NetBSD: bluetooth.h,v 1.2 2006/07/26 11:11:04 tron Exp $	*/
      2  1.1  gdamore 
      3  1.1  gdamore /*
      4  1.1  gdamore  * bluetooth.h
      5  1.1  gdamore  *
      6  1.1  gdamore  * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin (at) yahoo.com>
      7  1.1  gdamore  * All rights reserved.
      8  1.1  gdamore  *
      9  1.1  gdamore  * Redistribution and use in source and binary forms, with or without
     10  1.1  gdamore  * modification, are permitted provided that the following conditions
     11  1.1  gdamore  * are met:
     12  1.1  gdamore  * 1. Redistributions of source code must retain the above copyright
     13  1.1  gdamore  *    notice, this list of conditions and the following disclaimer.
     14  1.1  gdamore  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1  gdamore  *    notice, this list of conditions and the following disclaimer in the
     16  1.1  gdamore  *    documentation and/or other materials provided with the distribution.
     17  1.1  gdamore  *
     18  1.1  gdamore  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     19  1.1  gdamore  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     20  1.1  gdamore  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     21  1.1  gdamore  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     22  1.1  gdamore  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     23  1.1  gdamore  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     24  1.1  gdamore  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     25  1.1  gdamore  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     26  1.1  gdamore  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     27  1.1  gdamore  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     28  1.1  gdamore  * SUCH DAMAGE.
     29  1.1  gdamore  *
     30  1.2     tron  * $Id: bluetooth.h,v 1.2 2006/07/26 11:11:04 tron Exp $
     31  1.1  gdamore  * $FreeBSD: src/lib/libbluetooth/bluetooth.h,v 1.2 2005/03/17 21:39:44 emax Exp $
     32  1.1  gdamore  */
     33  1.1  gdamore 
     34  1.1  gdamore #ifndef _BLUETOOTH_H_
     35  1.1  gdamore #define _BLUETOOTH_H_
     36  1.1  gdamore 
     37  1.1  gdamore #include <sys/types.h>
     38  1.1  gdamore #include <sys/endian.h>
     39  1.1  gdamore #include <sys/socket.h>
     40  1.1  gdamore #include <netdb.h>
     41  1.1  gdamore #include <netbt/bluetooth.h>
     42  1.1  gdamore #include <netbt/hci.h>
     43  1.1  gdamore #include <netbt/l2cap.h>
     44  1.1  gdamore #include <stdio.h>
     45  1.1  gdamore 
     46  1.1  gdamore __BEGIN_DECLS
     47  1.1  gdamore 
     48  1.1  gdamore /*
     49  1.1  gdamore  * Interface to the outside world
     50  1.1  gdamore  */
     51  1.1  gdamore 
     52  1.1  gdamore struct hostent *  bt_gethostbyname    (char const *);
     53  1.1  gdamore struct hostent *  bt_gethostbyaddr    (char const *, socklen_t, int);
     54  1.1  gdamore struct hostent *  bt_gethostent       (void);
     55  1.1  gdamore void              bt_sethostent       (int);
     56  1.1  gdamore void              bt_endhostent       (void);
     57  1.1  gdamore 
     58  1.1  gdamore struct protoent * bt_getprotobyname   (char const *);
     59  1.1  gdamore struct protoent * bt_getprotobynumber (int);
     60  1.1  gdamore struct protoent * bt_getprotoent      (void);
     61  1.1  gdamore void              bt_setprotoent      (int);
     62  1.1  gdamore void              bt_endprotoent      (void);
     63  1.1  gdamore 
     64  1.1  gdamore char const *      bt_ntoa             (bdaddr_t const *, char *);
     65  1.1  gdamore int               bt_aton             (char const *, bdaddr_t *);
     66  1.1  gdamore 
     67  1.1  gdamore int               bt_devaddr          (const char *, bdaddr_t *);
     68  1.1  gdamore int               bt_devname          (char *, const bdaddr_t *);
     69  1.1  gdamore 
     70  1.1  gdamore #ifdef COMPAT_BLUEZ
     71  1.1  gdamore /*
     72  1.1  gdamore  * Linux BlueZ compatibility
     73  1.1  gdamore  */
     74  1.1  gdamore 
     75  1.1  gdamore #define	bacmp(ba1, ba2)	memcmp((ba1), (ba2), sizeof(bdaddr_t))
     76  1.1  gdamore #define	bacpy(dst, src)	memcpy((dst), (src), sizeof(bdaddr_t))
     77  1.1  gdamore #define ba2str(ba, str)	bt_ntoa((ba), (str))
     78  1.1  gdamore #define str2ba(str, ba)	(bt_aton((str), (ba)) == 1 ? 0 : -1)
     79  1.1  gdamore 
     80  1.1  gdamore #define htobs(x)	htole16(x)
     81  1.1  gdamore #define htobl(x)	htole32(x)
     82  1.1  gdamore #define btohs(x)	le16toh(x)
     83  1.1  gdamore #define btohl(x)	le32toh(x)
     84  1.1  gdamore 
     85  1.1  gdamore #define bt_malloc(n)	malloc(n)
     86  1.1  gdamore #define bt_free(p)	free(p)
     87  1.1  gdamore 
     88  1.1  gdamore #endif	/* COMPAT_BLUEZ */
     89  1.1  gdamore 
     90  1.1  gdamore __END_DECLS
     91  1.1  gdamore 
     92  1.1  gdamore #endif /* ndef _BLUETOOTH_H_ */
     93