From a48d8b4639f36e6fc2d7e87cac92e178674caaa1 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Fri, 8 Mar 2002 21:10:06 +0000 Subject: Initial revision --- include/bluetooth.h | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 include/bluetooth.h (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h new file mode 100644 index 00000000..441e1d3a --- /dev/null +++ b/include/bluetooth.h @@ -0,0 +1,111 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + Copyright (C) 2000-2001 Qualcomm Incorporated + + Written 2000,2001 by Maxim Krasnyansky + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +/* + * $Id$ + */ + +#ifndef __BLUETOOTH_H +#define __BLUETOOTH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifndef AF_BLUETOOTH +#define AF_BLUETOOTH 31 +#define PF_BLUETOOTH AF_BLUETOOTH +#endif + +#define BTPROTO_L2CAP 0 +#define BTPROTO_HCI 1 +#define BTPROTO_SCO 2 +#define BTPROTO_RFCOMM 3 + +#define SOL_HCI 0 +#define SOL_L2CAP 6 +#define SOL_SCO 17 +#define SOL_RFCOMM 18 + +/* Connection and socket states */ +enum { + BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ + BT_OPEN, + BT_BOUND, + BT_LISTEN, + BT_CONNECT, + BT_CONNECT2, + BT_CONFIG, + BT_DISCONN, + BT_CLOSED +}; + +/* Byte order conversions */ +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define htobs(d) (d) +#define htobl(d) (d) +#define btohs(d) (d) +#define btohl(d) (d) +#elif __BYTE_ORDER == __BIG_ENDIAN +#define htobs(d) bswap_16(d) +#define htobl(d) bswap_32(d) +#define btohs(d) bswap_16(d) +#define btohl(d) bswap_32(d) +#else +#error "Unknown byte order" +#endif + +/* BD Address */ +typedef struct { + uint8_t b[6]; +} __attribute__((packed)) bdaddr_t; + +#define BDADDR_ANY ((bdaddr_t *)"\000\000\000\000\000") + +/* Copy, swap, convert BD Address */ +static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2) +{ + return memcmp(ba1, ba2, sizeof(bdaddr_t)); +} +static inline void bacpy(bdaddr_t *dst, bdaddr_t *src) +{ + memcpy(dst, src, sizeof(bdaddr_t)); +} + +void baswap(bdaddr_t *dst, bdaddr_t *src); +bdaddr_t *strtoba(char *str); +char *batostr(bdaddr_t *ba); +int ba2str(bdaddr_t *ba, char *str); +int str2ba(char *str, bdaddr_t *ba); + +int bterr(uint16_t code); + +#ifdef __cplusplus +} +#endif + +#endif /* __BLUETOOTH_H */ -- cgit From 2c4532ba9feb08d1e37ca785bde83330d9cb4b71 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Tue, 12 Mar 2002 18:58:39 +0000 Subject: Missing includes. Cleanup. --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 441e1d3a..5dd4085f 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -35,6 +35,7 @@ extern "C" { #include #include +#include #ifndef AF_BLUETOOTH #define AF_BLUETOOTH 31 -- cgit From a51747b602f9cd03c7431788f80431c1710f5827 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Thu, 21 Mar 2002 23:20:32 +0000 Subject: Additional strtoXX and XXtostr functions. --- include/bluetooth.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 5dd4085f..ee345616 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -103,7 +103,8 @@ char *batostr(bdaddr_t *ba); int ba2str(bdaddr_t *ba, char *str); int str2ba(char *str, bdaddr_t *ba); -int bterr(uint16_t code); +int bt_error(uint16_t code); +char *bt_compidtostr(int id); #ifdef __cplusplus } -- cgit From 59fa39d1686237493fce068472e195a709134a39 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Thu, 28 Mar 2002 20:48:45 +0000 Subject: Fix compiler warnings. --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index ee345616..8d1c7c51 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -36,6 +36,7 @@ extern "C" { #include #include #include +#include #ifndef AF_BLUETOOTH #define AF_BLUETOOTH 31 -- cgit From dac18f34e1080e84d779496232a838c5bc570ddd Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Sun, 31 Mar 2002 05:14:51 +0000 Subject: Added BDADDR_LOCAL --- include/bluetooth.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 8d1c7c51..8026832b 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -86,7 +86,8 @@ typedef struct { uint8_t b[6]; } __attribute__((packed)) bdaddr_t; -#define BDADDR_ANY ((bdaddr_t *)"\000\000\000\000\000") +#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) +#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) /* Copy, swap, convert BD Address */ static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2) -- cgit From 807d006ed3259907b450642536cad6123431acf9 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Mon, 6 May 2002 20:54:32 +0000 Subject: Add BNEP socket proto. --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 8026832b..b93c4e35 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -47,6 +47,7 @@ extern "C" { #define BTPROTO_HCI 1 #define BTPROTO_SCO 2 #define BTPROTO_RFCOMM 3 +#define BTPROTO_BNEP 4 #define SOL_HCI 0 #define SOL_L2CAP 6 -- cgit From 109bfa547ab9e24672472371e2183dcec24d0058 Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Tue, 11 Feb 2003 10:22:23 +0000 Subject: add const to fn sigs; fns to auth and enc links --- include/bluetooth.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index b93c4e35..93a6f628 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -91,20 +91,20 @@ typedef struct { #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) /* Copy, swap, convert BD Address */ -static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2) +static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2) { return memcmp(ba1, ba2, sizeof(bdaddr_t)); } -static inline void bacpy(bdaddr_t *dst, bdaddr_t *src) +static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src) { memcpy(dst, src, sizeof(bdaddr_t)); } -void baswap(bdaddr_t *dst, bdaddr_t *src); -bdaddr_t *strtoba(char *str); -char *batostr(bdaddr_t *ba); -int ba2str(bdaddr_t *ba, char *str); -int str2ba(char *str, bdaddr_t *ba); +void baswap(bdaddr_t *dst, const bdaddr_t *src); +bdaddr_t *strtoba(const char *str); +char *batostr(const bdaddr_t *ba); +int ba2str(const bdaddr_t *ba, char *str); +int str2ba(const char *str, bdaddr_t *ba); int bt_error(uint16_t code); char *bt_compidtostr(int id); -- cgit From fccacdc27dffbc563a4cfe2e1aa9ed987a1bfca1 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 5 Jun 2003 06:38:18 +0000 Subject: Add protocol number for CMTP --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 93a6f628..c09e99d4 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -48,6 +48,7 @@ extern "C" { #define BTPROTO_SCO 2 #define BTPROTO_RFCOMM 3 #define BTPROTO_BNEP 4 +#define BTPROTO_CMTP 5 #define SOL_HCI 0 #define SOL_L2CAP 6 -- cgit From b45841191f6ab4cc55ccd040a5530c2d08c6ddc6 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 3 Jul 2003 00:06:26 +0000 Subject: Cleanup --- include/bluetooth.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index c09e99d4..1667fd12 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -37,23 +37,23 @@ extern "C" { #include #include #include - + #ifndef AF_BLUETOOTH #define AF_BLUETOOTH 31 #define PF_BLUETOOTH AF_BLUETOOTH #endif -#define BTPROTO_L2CAP 0 -#define BTPROTO_HCI 1 -#define BTPROTO_SCO 2 +#define BTPROTO_L2CAP 0 +#define BTPROTO_HCI 1 +#define BTPROTO_SCO 2 #define BTPROTO_RFCOMM 3 #define BTPROTO_BNEP 4 #define BTPROTO_CMTP 5 -#define SOL_HCI 0 -#define SOL_L2CAP 6 -#define SOL_SCO 17 -#define SOL_RFCOMM 18 +#define SOL_HCI 0 +#define SOL_L2CAP 6 +#define SOL_SCO 17 +#define SOL_RFCOMM 18 /* Connection and socket states */ enum { -- cgit From d6a0b8361301a4e153a45020d6522f722537000a Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 9 Mar 2004 15:39:56 +0000 Subject: Add HIDP protocol identifier --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 1667fd12..f4ceaae5 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -49,6 +49,7 @@ extern "C" { #define BTPROTO_RFCOMM 3 #define BTPROTO_BNEP 4 #define BTPROTO_CMTP 5 +#define BTPROTO_HIDP 6 #define SOL_HCI 0 #define SOL_L2CAP 6 -- cgit From 764abe23a0d4ede999f1f34ee0e310c0eeaaff79 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 3 Apr 2004 05:11:38 +0000 Subject: Update copyright information --- include/bluetooth.h | 58 +++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index f4ceaae5..8690f456 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -1,28 +1,30 @@ -/* - BlueZ - Bluetooth protocol stack for Linux - Copyright (C) 2000-2001 Qualcomm Incorporated - - Written 2000,2001 by Maxim Krasnyansky - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation; - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS - SOFTWARE IS DISCLAIMED. -*/ - /* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2000-2001 Qualcomm Incorporated + * Copyright (C) 2002-2003 Maxim Krasnyansky + * Copyright (C) 2002-2004 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + * SOFTWARE IS DISCLAIMED. + * + * * $Id$ */ @@ -104,11 +106,11 @@ static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src) void baswap(bdaddr_t *dst, const bdaddr_t *src); bdaddr_t *strtoba(const char *str); -char *batostr(const bdaddr_t *ba); -int ba2str(const bdaddr_t *ba, char *str); -int str2ba(const char *str, bdaddr_t *ba); +char *batostr(const bdaddr_t *ba); +int ba2str(const bdaddr_t *ba, char *str); +int str2ba(const char *str, bdaddr_t *ba); -int bt_error(uint16_t code); +int bt_error(uint16_t code); char *bt_compidtostr(int id); #ifdef __cplusplus -- cgit From ee63ac598e56142ba513729d6b69df04d233d186 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 3 Apr 2004 08:25:58 +0000 Subject: Add support for unaligned access --- include/bluetooth.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 8690f456..3dc4b245 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -86,6 +86,19 @@ enum { #error "Unknown byte order" #endif +/* Bluetooth unaligned access */ +#if defined(__i386__) +#define bt_get_unaligned(ptr) (*(ptr)) +#define bt_put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) +#else +#define bt_get_unaligned(ptr) \ + ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) +#define bt_put_unaligned(val, ptr) \ + ({ __typeof__(*(ptr)) __tmp = (val); \ + memcpy((ptr), &__tmp, sizeof(*(ptr))); \ + (void)0; }) +#endif + /* BD Address */ typedef struct { uint8_t b[6]; -- cgit From c7b26f3e5d03e1d54dfb945e5ca0c041da524348 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 8 May 2004 19:52:55 +0000 Subject: Add BDADDR_ALL constant --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 3dc4b245..412ccf61 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -105,6 +105,7 @@ typedef struct { } __attribute__((packed)) bdaddr_t; #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) +#define BDADDR_ALL (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}) #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) /* Copy, swap, convert BD Address */ -- cgit From f843c841cfdcb3bfd45ba136847421ad8e18efbe Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 4 Jul 2004 15:38:11 +0000 Subject: Add AVDTP protocol identifier --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 412ccf61..d6359938 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -52,6 +52,7 @@ extern "C" { #define BTPROTO_BNEP 4 #define BTPROTO_CMTP 5 #define BTPROTO_HIDP 6 +#define BTPROTO_AVDTP 7 #define SOL_HCI 0 #define SOL_L2CAP 6 -- cgit From 8b84723cea240cbd9e55ba2acd683fadb3a79282 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 11 Aug 2004 07:07:12 +0000 Subject: Use memmove for unaligned access, so gcc does not insert a __builtin_memcpy --- include/bluetooth.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index d6359938..e286ffb9 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -93,10 +93,10 @@ enum { #define bt_put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) #else #define bt_get_unaligned(ptr) \ - ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) + ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) #define bt_put_unaligned(val, ptr) \ ({ __typeof__(*(ptr)) __tmp = (val); \ - memcpy((ptr), &__tmp, sizeof(*(ptr))); \ + memmove((ptr), &__tmp, sizeof(*(ptr))); \ (void)0; }) #endif -- cgit From 02f41dc112d035da030b2c14f02baaae2f7c3c18 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 12 Aug 2004 21:22:37 +0000 Subject: Add architectures that can do unaligned access by themself --- include/bluetooth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index e286ffb9..9304ddd6 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -88,7 +88,7 @@ enum { #endif /* Bluetooth unaligned access */ -#if defined(__i386__) +#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__s390__) #define bt_get_unaligned(ptr) (*(ptr)) #define bt_put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) #else -- cgit From ea6bf1beea4d3fcc98e2e940e940735a5a0b3c5e Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Thu, 12 Aug 2004 21:59:42 +0000 Subject: The CRIS architecture handles unaligned accesses too. --- include/bluetooth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 9304ddd6..80a2d169 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -88,7 +88,7 @@ enum { #endif /* Bluetooth unaligned access */ -#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__s390__) +#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__s390__) || defined(__cris__) #define bt_get_unaligned(ptr) (*(ptr)) #define bt_put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) #else -- cgit From ef5f2b1b3adbc8509dc47a4c53f31e6e9f867d0b Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 20 Jan 2005 18:14:19 +0000 Subject: Use better way for unaligned access --- include/bluetooth.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 80a2d169..142f6064 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -88,17 +88,21 @@ enum { #endif /* Bluetooth unaligned access */ -#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__s390__) || defined(__cris__) -#define bt_get_unaligned(ptr) (*(ptr)) -#define bt_put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) -#else -#define bt_get_unaligned(ptr) \ - ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) -#define bt_put_unaligned(val, ptr) \ - ({ __typeof__(*(ptr)) __tmp = (val); \ - memmove((ptr), &__tmp, sizeof(*(ptr))); \ - (void)0; }) -#endif +#define bt_get_unaligned(ptr) \ +({ \ + struct __attribute__((packed)) { \ + typeof(*(ptr)) __v; \ + } *__p = (ptr); \ + __p->__v; \ +}) + +#define bt_put_unaligned(val, ptr) \ +do { \ + struct __attribute__((packed)) { \ + typeof(*(ptr)) __v; \ + } *__p = (ptr); \ + __p->__v = (val); \ +} while(0) /* BD Address */ typedef struct { -- cgit From b4790da2d46a5f39d0fdc7fd836ec23b1b483f7e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 23 Jan 2005 14:36:19 +0000 Subject: Fixup the unaligned access --- include/bluetooth.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 142f6064..86d3f1d2 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -92,7 +92,7 @@ enum { ({ \ struct __attribute__((packed)) { \ typeof(*(ptr)) __v; \ - } *__p = (ptr); \ + } *__p = (void *) (ptr); \ __p->__v; \ }) @@ -100,7 +100,7 @@ enum { do { \ struct __attribute__((packed)) { \ typeof(*(ptr)) __v; \ - } *__p = (ptr); \ + } *__p = (void *) (ptr); \ __p->__v = (val); \ } while(0) -- cgit From f1d23ac858b0593afe27e6b8e00a55d92804a6bb Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 29 Jan 2005 03:08:19 +0000 Subject: Update the copyright year --- include/bluetooth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 86d3f1d2..a005c1c7 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -4,7 +4,7 @@ * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2004 Marcel Holtmann + * Copyright (C) 2002-2005 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify -- cgit From 9280b803576dc54bfc7f51c8e5154d1f29692991 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 27 Mar 2005 14:37:59 +0000 Subject: Add ba*printf() functions --- include/bluetooth.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index a005c1c7..d7747996 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -36,9 +36,9 @@ extern "C" { #endif #include +#include #include #include -#include #ifndef AF_BLUETOOTH #define AF_BLUETOOTH 31 @@ -129,6 +129,11 @@ char *batostr(const bdaddr_t *ba); int ba2str(const bdaddr_t *ba, char *str); int str2ba(const char *str, bdaddr_t *ba); +int baprintf(const char *format, ...); +int bafprintf(FILE *stream, const char *format, ...); +int basprintf(char *str, const char *format, ...); +int basnprintf(char *str, size_t size, const char *format, ...); + int bt_error(uint16_t code); char *bt_compidtostr(int id); -- cgit From 4c2d1cbe438713b5d6c350ee0983e1d312c69823 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 27 Mar 2005 14:43:44 +0000 Subject: Add ba2oui() function --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index d7747996..276831ae 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -128,6 +128,7 @@ bdaddr_t *strtoba(const char *str); char *batostr(const bdaddr_t *ba); int ba2str(const bdaddr_t *ba, char *str); int str2ba(const char *str, bdaddr_t *ba); +int ba2oui(const bdaddr_t *ba, char *oui); int baprintf(const char *format, ...); int bafprintf(FILE *stream, const char *format, ...); -- cgit From 7bf5fa8168f2b3da602189b962caa6fa81bb57ba Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 20 Apr 2005 12:23:13 +0000 Subject: Include stdio.h within bluetooth.h --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 276831ae..33d68a61 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -35,6 +35,7 @@ extern "C" { #endif +#include #include #include #include -- cgit From a73893381f0b7be98b8eb99d31ff834c7658d27c Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 5 Aug 2005 07:11:32 +0000 Subject: Introduce bt_malloc() and bt_free() functions --- include/bluetooth.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 33d68a61..b5d056df 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -136,6 +136,9 @@ int bafprintf(FILE *stream, const char *format, ...); int basprintf(char *str, const char *format, ...); int basnprintf(char *str, size_t size, const char *format, ...); +void *bt_malloc(size_t size); +void bt_free(void *ptr); + int bt_error(uint16_t code); char *bt_compidtostr(int id); -- cgit From c0d524486a50e8366c12c5ebea1a4441e9db46aa Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 29 Oct 2005 19:25:42 +0000 Subject: Big cleanup of CVS relics --- include/bluetooth.h | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index b5d056df..8ced1024 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -8,24 +8,19 @@ * * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS - * SOFTWARE IS DISCLAIMED. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * - * $Id$ */ #ifndef __BLUETOOTH_H -- cgit From 197a2aee34d9a1643cd474f8f167552ca6395d01 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 3 Jan 2006 12:56:09 +0000 Subject: Update copyright information --- include/bluetooth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 8ced1024..2ad82a7d 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -4,7 +4,7 @@ * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2005 Marcel Holtmann + * Copyright (C) 2002-2006 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify -- cgit From 25effaf3a661c4de960ebae7125ba56a990ad628 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 13 Jan 2007 17:50:06 +0000 Subject: Update copyright information --- include/bluetooth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 2ad82a7d..1362ed82 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -4,7 +4,7 @@ * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2006 Marcel Holtmann + * Copyright (C) 2002-2007 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify -- cgit From 3536636a5b1664499ee0ededd305b9bdc9ddeaa4 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 21 Jun 2007 21:18:00 +0000 Subject: Add common bachk() function --- include/bluetooth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 1362ed82..1d377781 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -125,6 +125,7 @@ char *batostr(const bdaddr_t *ba); int ba2str(const bdaddr_t *ba, char *str); int str2ba(const char *str, bdaddr_t *ba); int ba2oui(const bdaddr_t *ba, char *oui); +int bachk(const char *str); int baprintf(const char *format, ...); int bafprintf(FILE *stream, const char *format, ...); -- cgit From 37651dd5c06b2e176f4bfdc99f5702e55a520ee9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 24 Oct 2007 21:16:46 +0000 Subject: Add constant for Bluetooth socket options level --- include/bluetooth.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index 1d377781..d483d904 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -41,6 +41,10 @@ extern "C" { #define PF_BLUETOOTH AF_BLUETOOTH #endif +#ifndef SOL_BLUETOOTH +#define SOL_BLUETOOTH 274 +#endif + #define BTPROTO_L2CAP 0 #define BTPROTO_HCI 1 #define BTPROTO_SCO 2 -- cgit From 7208028266fc19d380ac77c97c46b6f2fdc80e1d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 2 Feb 2008 03:11:09 +0000 Subject: Update copyright information --- include/bluetooth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/bluetooth.h') diff --git a/include/bluetooth.h b/include/bluetooth.h index d483d904..d886cb80 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -4,7 +4,7 @@ * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2007 Marcel Holtmann + * Copyright (C) 2002-2008 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify -- cgit