Mon Aug 3 15:59:42 2009 UTC ()
Add bt_dev(3), an platform neutral API for accessing (locally configured)
Bluetooth devices, and bump libbluetooth minor version.
This is a reimplementation of an API largely developed by Maksim Yevmenkin
on FreeBSD to make it easier to port BlueZ/Linux programs which depend on
something similar. Alas, the BlueZ/Linux API is incompatible and unportable
as it depends on a 'device' being referenced by an int, but this will
hopefully make it easier to port software using that.
(bump libbluetooth minor version)
(plunky)
diff -r1.61 -r1.62 src/distrib/sets/lists/base/md.amd64
diff -r1.55 -r1.56 src/distrib/sets/lists/base/md.sparc64
diff -r1.483 -r1.484 src/distrib/sets/lists/base/shl.mi
diff -r1.1287 -r1.1288 src/distrib/sets/lists/comp/mi
diff -r1.4 -r1.5 src/lib/libbluetooth/Makefile
diff -r1.4 -r1.5 src/lib/libbluetooth/shlib_version
diff -r1.3 -r1.4 src/lib/libbluetooth/bluetooth.3
diff -r1.3 -r1.4 src/lib/libbluetooth/bluetooth.h
diff -r0 -r1.1 src/lib/libbluetooth/bt_dev.3
diff -r0 -r1.1 src/lib/libbluetooth/bt_dev.c
diff -r1.2 -r0 src/lib/libbluetooth/devaddr.c
--- src/distrib/sets/lists/base/md.amd64 2009/07/21 00:49:30 1.61
+++ src/distrib/sets/lists/base/md.amd64 2009/08/03 15:59:41 1.62
| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: md.amd64,v 1.61 2009/07/21 00:49:30 mrg Exp $ | | 1 | # $NetBSD: md.amd64,v 1.62 2009/08/03 15:59:41 plunky Exp $ |
2 | ./dev/lms0 base-obsolete obsolete | | 2 | ./dev/lms0 base-obsolete obsolete |
3 | ./dev/mms0 base-obsolete obsolete | | 3 | ./dev/mms0 base-obsolete obsolete |
4 | ./libexec/ld.elf_so-i386 base-sys-shlib compat,pic | | 4 | ./libexec/ld.elf_so-i386 base-sys-shlib compat,pic |
5 | ./usr/bin/fdformat base-util-bin | | 5 | ./usr/bin/fdformat base-util-bin |
6 | ./usr/lib/i386 base-compat-lib compat | | 6 | ./usr/lib/i386 base-compat-lib compat |
7 | ./usr/lib/i386/i18n base-compat-lib compat | | 7 | ./usr/lib/i386/i18n base-compat-lib compat |
8 | ./usr/lib/i386/i18n/libBIG5.so.5 base-i18n-shlib compat,pic | | 8 | ./usr/lib/i386/i18n/libBIG5.so.5 base-i18n-shlib compat,pic |
9 | ./usr/lib/i386/i18n/libBIG5.so.5.0 base-i18n-shlib compat,pic | | 9 | ./usr/lib/i386/i18n/libBIG5.so.5.0 base-i18n-shlib compat,pic |
10 | ./usr/lib/i386/i18n/libDECHanyu.so.5 base-i18n-shlib compat,pic | | 10 | ./usr/lib/i386/i18n/libDECHanyu.so.5 base-i18n-shlib compat,pic |
11 | ./usr/lib/i386/i18n/libDECHanyu.so.5.0 base-i18n-shlib compat,pic | | 11 | ./usr/lib/i386/i18n/libDECHanyu.so.5.0 base-i18n-shlib compat,pic |
12 | ./usr/lib/i386/i18n/libEUC.so.5 base-i18n-shlib compat,pic | | 12 | ./usr/lib/i386/i18n/libEUC.so.5 base-i18n-shlib compat,pic |
13 | ./usr/lib/i386/i18n/libEUC.so.5.0 base-i18n-shlib compat,pic | | 13 | ./usr/lib/i386/i18n/libEUC.so.5.0 base-i18n-shlib compat,pic |
14 | ./usr/lib/i386/i18n/libEUCTW.so.5 base-i18n-shlib compat,pic | | 14 | ./usr/lib/i386/i18n/libEUCTW.so.5 base-i18n-shlib compat,pic |
| @@ -48,27 +48,27 @@ | | | @@ -48,27 +48,27 @@ |
48 | ./usr/lib/i386/i18n/libmapper_serial.so.5 base-i18n-shlib compat,pic | | 48 | ./usr/lib/i386/i18n/libmapper_serial.so.5 base-i18n-shlib compat,pic |
49 | ./usr/lib/i386/i18n/libmapper_serial.so.5.0 base-i18n-shlib compat,pic | | 49 | ./usr/lib/i386/i18n/libmapper_serial.so.5.0 base-i18n-shlib compat,pic |
50 | ./usr/lib/i386/i18n/libmapper_std.so.5 base-i18n-shlib compat,pic | | 50 | ./usr/lib/i386/i18n/libmapper_std.so.5 base-i18n-shlib compat,pic |
51 | ./usr/lib/i386/i18n/libmapper_std.so.5.0 base-i18n-shlib compat,pic | | 51 | ./usr/lib/i386/i18n/libmapper_std.so.5.0 base-i18n-shlib compat,pic |
52 | ./usr/lib/i386/i18n/libmapper_zone.so.5 base-i18n-shlib compat,pic | | 52 | ./usr/lib/i386/i18n/libmapper_zone.so.5 base-i18n-shlib compat,pic |
53 | ./usr/lib/i386/i18n/libmapper_zone.so.5.0 base-i18n-shlib compat,pic | | 53 | ./usr/lib/i386/i18n/libmapper_zone.so.5.0 base-i18n-shlib compat,pic |
54 | ./usr/lib/i386/libasn1.so.8 base-compat-shlib compat,pic,kerberos | | 54 | ./usr/lib/i386/libasn1.so.8 base-compat-shlib compat,pic,kerberos |
55 | ./usr/lib/i386/libasn1.so.8.0 base-compat-shlib compat,pic,kerberos | | 55 | ./usr/lib/i386/libasn1.so.8.0 base-compat-shlib compat,pic,kerberos |
56 | ./usr/lib/i386/libbfd.so.10 base-compat-shlib compat,pic,bfd | | 56 | ./usr/lib/i386/libbfd.so.10 base-compat-shlib compat,pic,bfd |
57 | ./usr/lib/i386/libbfd.so.10.0 base-compat-shlib compat,pic,bfd | | 57 | ./usr/lib/i386/libbfd.so.10.0 base-compat-shlib compat,pic,bfd |
58 | ./usr/lib/i386/libbind9.so.4 base-compat-shlib compat,pic | | 58 | ./usr/lib/i386/libbind9.so.4 base-compat-shlib compat,pic |
59 | ./usr/lib/i386/libbind9.so.4.0 base-compat-shlib compat,pic | | 59 | ./usr/lib/i386/libbind9.so.4.0 base-compat-shlib compat,pic |
60 | ./usr/lib/i386/libbluetooth.so.4 base-compat-shlib compat,pic | | 60 | ./usr/lib/i386/libbluetooth.so.4 base-compat-shlib compat,pic |
61 | ./usr/lib/i386/libbluetooth.so.4.1 base-compat-shlib compat,pic | | 61 | ./usr/lib/i386/libbluetooth.so.4.2 base-compat-shlib compat,pic |
62 | ./usr/lib/i386/libbsdmalloc.so.0 base-compat-shlib compat,pic | | 62 | ./usr/lib/i386/libbsdmalloc.so.0 base-compat-shlib compat,pic |
63 | ./usr/lib/i386/libbsdmalloc.so.0.0 base-compat-shlib compat,pic | | 63 | ./usr/lib/i386/libbsdmalloc.so.0.0 base-compat-shlib compat,pic |
64 | ./usr/lib/i386/libbz2.so.1 base-compat-shlib compat,pic | | 64 | ./usr/lib/i386/libbz2.so.1 base-compat-shlib compat,pic |
65 | ./usr/lib/i386/libbz2.so.1.1 base-compat-shlib compat,pic | | 65 | ./usr/lib/i386/libbz2.so.1.1 base-compat-shlib compat,pic |
66 | ./usr/lib/i386/libc.so.12 base-compat-shlib compat,pic | | 66 | ./usr/lib/i386/libc.so.12 base-compat-shlib compat,pic |
67 | ./usr/lib/i386/libc.so.12.169 base-compat-shlib compat,pic | | 67 | ./usr/lib/i386/libc.so.12.169 base-compat-shlib compat,pic |
68 | ./usr/lib/i386/libcom_err.so.6 base-compat-shlib compat,pic,kerberos | | 68 | ./usr/lib/i386/libcom_err.so.6 base-compat-shlib compat,pic,kerberos |
69 | ./usr/lib/i386/libcom_err.so.6.0 base-compat-shlib compat,pic,kerberos | | 69 | ./usr/lib/i386/libcom_err.so.6.0 base-compat-shlib compat,pic,kerberos |
70 | ./usr/lib/i386/libcrypt.so.1 base-compat-shlib compat,pic | | 70 | ./usr/lib/i386/libcrypt.so.1 base-compat-shlib compat,pic |
71 | ./usr/lib/i386/libcrypt.so.1.0 base-compat-shlib compat,pic | | 71 | ./usr/lib/i386/libcrypt.so.1.0 base-compat-shlib compat,pic |
72 | ./usr/lib/i386/libcrypto.so.6 base-compat-shlib compat,pic | | 72 | ./usr/lib/i386/libcrypto.so.6 base-compat-shlib compat,pic |
73 | ./usr/lib/i386/libcrypto.so.6.0 base-compat-shlib compat,pic | | 73 | ./usr/lib/i386/libcrypto.so.6.0 base-compat-shlib compat,pic |
74 | ./usr/lib/i386/libcurses.so.7 base-compat-shlib compat,pic | | 74 | ./usr/lib/i386/libcurses.so.7 base-compat-shlib compat,pic |
--- src/distrib/sets/lists/base/md.sparc64 2009/07/21 00:49:30 1.55
+++ src/distrib/sets/lists/base/md.sparc64 2009/08/03 15:59:41 1.56
| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: md.sparc64,v 1.55 2009/07/21 00:49:30 mrg Exp $ | | 1 | # $NetBSD: md.sparc64,v 1.56 2009/08/03 15:59:41 plunky Exp $ |
2 | ./libexec/ld.elf_so-sparc base-sysutil-bin compat,pic | | 2 | ./libexec/ld.elf_so-sparc base-sysutil-bin compat,pic |
3 | ./sbin/edlabel base-sysutil-root | | 3 | ./sbin/edlabel base-sysutil-root |
4 | ./usr/bin/fdformat base-util-bin | | 4 | ./usr/bin/fdformat base-util-bin |
5 | ./usr/lib/sparc base-compat-lib compat | | 5 | ./usr/lib/sparc base-compat-lib compat |
6 | ./usr/lib/sparc/i18n base-compat-lib compat | | 6 | ./usr/lib/sparc/i18n base-compat-lib compat |
7 | ./usr/lib/sparc/i18n/libBIG5.so.5 base-i18n-shlib compat,pic | | 7 | ./usr/lib/sparc/i18n/libBIG5.so.5 base-i18n-shlib compat,pic |
8 | ./usr/lib/sparc/i18n/libBIG5.so.5.0 base-i18n-shlib compat,pic | | 8 | ./usr/lib/sparc/i18n/libBIG5.so.5.0 base-i18n-shlib compat,pic |
9 | ./usr/lib/sparc/i18n/libDECHanyu.so.5 base-i18n-shlib compat,pic | | 9 | ./usr/lib/sparc/i18n/libDECHanyu.so.5 base-i18n-shlib compat,pic |
10 | ./usr/lib/sparc/i18n/libDECHanyu.so.5.0 base-i18n-shlib compat,pic | | 10 | ./usr/lib/sparc/i18n/libDECHanyu.so.5.0 base-i18n-shlib compat,pic |
11 | ./usr/lib/sparc/i18n/libEUC.so.5 base-i18n-shlib compat,pic | | 11 | ./usr/lib/sparc/i18n/libEUC.so.5 base-i18n-shlib compat,pic |
12 | ./usr/lib/sparc/i18n/libEUC.so.5.0 base-i18n-shlib compat,pic | | 12 | ./usr/lib/sparc/i18n/libEUC.so.5.0 base-i18n-shlib compat,pic |
13 | ./usr/lib/sparc/i18n/libEUCTW.so.5 base-i18n-shlib compat,pic | | 13 | ./usr/lib/sparc/i18n/libEUCTW.so.5 base-i18n-shlib compat,pic |
14 | ./usr/lib/sparc/i18n/libEUCTW.so.5.0 base-i18n-shlib compat,pic | | 14 | ./usr/lib/sparc/i18n/libEUCTW.so.5.0 base-i18n-shlib compat,pic |
| @@ -47,27 +47,27 @@ | | | @@ -47,27 +47,27 @@ |
47 | ./usr/lib/sparc/i18n/libmapper_serial.so.5 base-i18n-shlib compat,pic | | 47 | ./usr/lib/sparc/i18n/libmapper_serial.so.5 base-i18n-shlib compat,pic |
48 | ./usr/lib/sparc/i18n/libmapper_serial.so.5.0 base-i18n-shlib compat,pic | | 48 | ./usr/lib/sparc/i18n/libmapper_serial.so.5.0 base-i18n-shlib compat,pic |
49 | ./usr/lib/sparc/i18n/libmapper_std.so.5 base-i18n-shlib compat,pic | | 49 | ./usr/lib/sparc/i18n/libmapper_std.so.5 base-i18n-shlib compat,pic |
50 | ./usr/lib/sparc/i18n/libmapper_std.so.5.0 base-i18n-shlib compat,pic | | 50 | ./usr/lib/sparc/i18n/libmapper_std.so.5.0 base-i18n-shlib compat,pic |
51 | ./usr/lib/sparc/i18n/libmapper_zone.so.5 base-i18n-shlib compat,pic | | 51 | ./usr/lib/sparc/i18n/libmapper_zone.so.5 base-i18n-shlib compat,pic |
52 | ./usr/lib/sparc/i18n/libmapper_zone.so.5.0 base-i18n-shlib compat,pic | | 52 | ./usr/lib/sparc/i18n/libmapper_zone.so.5.0 base-i18n-shlib compat,pic |
53 | ./usr/lib/sparc/libasn1.so.8 base-compat-shlib compat,pic | | 53 | ./usr/lib/sparc/libasn1.so.8 base-compat-shlib compat,pic |
54 | ./usr/lib/sparc/libasn1.so.8.0 base-compat-shlib compat,pic | | 54 | ./usr/lib/sparc/libasn1.so.8.0 base-compat-shlib compat,pic |
55 | ./usr/lib/sparc/libbfd.so.10 base-compat-shlib compat,pic | | 55 | ./usr/lib/sparc/libbfd.so.10 base-compat-shlib compat,pic |
56 | ./usr/lib/sparc/libbfd.so.10.0 base-compat-shlib compat,pic | | 56 | ./usr/lib/sparc/libbfd.so.10.0 base-compat-shlib compat,pic |
57 | ./usr/lib/sparc/libbind9.so.4 base-compat-shlib compat,pic | | 57 | ./usr/lib/sparc/libbind9.so.4 base-compat-shlib compat,pic |
58 | ./usr/lib/sparc/libbind9.so.4.0 base-compat-shlib compat,pic | | 58 | ./usr/lib/sparc/libbind9.so.4.0 base-compat-shlib compat,pic |
59 | ./usr/lib/sparc/libbluetooth.so.4 base-compat-shlib compat,pic | | 59 | ./usr/lib/sparc/libbluetooth.so.4 base-compat-shlib compat,pic |
60 | ./usr/lib/sparc/libbluetooth.so.4.1 base-compat-shlib compat,pic | | 60 | ./usr/lib/sparc/libbluetooth.so.4.2 base-compat-shlib compat,pic |
61 | ./usr/lib/sparc/libbsdmalloc.so.0 base-compat-shlib compat,pic | | 61 | ./usr/lib/sparc/libbsdmalloc.so.0 base-compat-shlib compat,pic |
62 | ./usr/lib/sparc/libbsdmalloc.so.0.0 base-compat-shlib compat,pic | | 62 | ./usr/lib/sparc/libbsdmalloc.so.0.0 base-compat-shlib compat,pic |
63 | ./usr/lib/sparc/libbz2.so.1 base-compat-shlib compat,pic | | 63 | ./usr/lib/sparc/libbz2.so.1 base-compat-shlib compat,pic |
64 | ./usr/lib/sparc/libbz2.so.1.1 base-compat-shlib compat,pic | | 64 | ./usr/lib/sparc/libbz2.so.1.1 base-compat-shlib compat,pic |
65 | ./usr/lib/sparc/libc.so.12 base-compat-shlib compat,pic | | 65 | ./usr/lib/sparc/libc.so.12 base-compat-shlib compat,pic |
66 | ./usr/lib/sparc/libc.so.12.169 base-compat-shlib compat,pic | | 66 | ./usr/lib/sparc/libc.so.12.169 base-compat-shlib compat,pic |
67 | ./usr/lib/sparc/libcom_err.so.6 base-compat-shlib compat,pic | | 67 | ./usr/lib/sparc/libcom_err.so.6 base-compat-shlib compat,pic |
68 | ./usr/lib/sparc/libcom_err.so.6.0 base-compat-shlib compat,pic | | 68 | ./usr/lib/sparc/libcom_err.so.6.0 base-compat-shlib compat,pic |
69 | ./usr/lib/sparc/libcrypt.so.1 base-compat-shlib compat,pic | | 69 | ./usr/lib/sparc/libcrypt.so.1 base-compat-shlib compat,pic |
70 | ./usr/lib/sparc/libcrypt.so.1.0 base-compat-shlib compat,pic | | 70 | ./usr/lib/sparc/libcrypt.so.1.0 base-compat-shlib compat,pic |
71 | ./usr/lib/sparc/libcrypto.so.6 base-compat-shlib compat,pic | | 71 | ./usr/lib/sparc/libcrypto.so.6 base-compat-shlib compat,pic |
72 | ./usr/lib/sparc/libcrypto.so.6.0 base-compat-shlib compat,pic | | 72 | ./usr/lib/sparc/libcrypto.so.6.0 base-compat-shlib compat,pic |
73 | ./usr/lib/sparc/libcurses.so.7 base-compat-shlib compat,pic | | 73 | ./usr/lib/sparc/libcurses.so.7 base-compat-shlib compat,pic |
--- src/distrib/sets/lists/base/shl.mi 2009/07/21 00:49:13 1.483
+++ src/distrib/sets/lists/base/shl.mi 2009/08/03 15:59:41 1.484
| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: shl.mi,v 1.483 2009/07/21 00:49:13 mrg Exp $ | | 1 | # $NetBSD: shl.mi,v 1.484 2009/08/03 15:59:41 plunky Exp $ |
2 | # | | 2 | # |
3 | # Note: Don't delete entries from here - mark them as "obsolete" instead, | | 3 | # Note: Don't delete entries from here - mark them as "obsolete" instead, |
4 | # unless otherwise stated below. | | 4 | # unless otherwise stated below. |
5 | # | | 5 | # |
6 | # Note: Do not mark "old" major and major.minor shared libraries as | | 6 | # Note: Do not mark "old" major and major.minor shared libraries as |
7 | # "obsolete"; just remove the entry, as third-party applications | | 7 | # "obsolete"; just remove the entry, as third-party applications |
8 | # may be linked against the old major shared library, and | | 8 | # may be linked against the old major shared library, and |
9 | # that is a symlink to the old major.minor shared library. | | 9 | # that is a symlink to the old major.minor shared library. |
10 | # e.g., "lib<name>.so.<N>" and "lib<name>.so.<N>.<M>" | | 10 | # e.g., "lib<name>.so.<N>" and "lib<name>.so.<N>.<M>" |
11 | # Exceptions to this rule may include shared libraries that | | 11 | # Exceptions to this rule may include shared libraries that |
12 | # are dlopen()ed at run-time, such as extra locales, etc. | | 12 | # are dlopen()ed at run-time, such as extra locales, etc. |
13 | # | | 13 | # |
14 | # Note: libtermcap and libtermlib are hardlinked and share the same version. | | 14 | # Note: libtermcap and libtermlib are hardlinked and share the same version. |
| @@ -47,27 +47,27 @@ | | | @@ -47,27 +47,27 @@ |
47 | ./usr/lib/i18n/libiconv_none.so.5.0 base-i18n-shlib | | 47 | ./usr/lib/i18n/libiconv_none.so.5.0 base-i18n-shlib |
48 | ./usr/lib/i18n/libiconv_std.so.5.0 base-i18n-shlib | | 48 | ./usr/lib/i18n/libiconv_std.so.5.0 base-i18n-shlib |
49 | ./usr/lib/i18n/libmapper_646.so.5.0 base-i18n-shlib | | 49 | ./usr/lib/i18n/libmapper_646.so.5.0 base-i18n-shlib |
50 | ./usr/lib/i18n/libmapper_none.so.5.0 base-i18n-shlib | | 50 | ./usr/lib/i18n/libmapper_none.so.5.0 base-i18n-shlib |
51 | ./usr/lib/i18n/libmapper_parallel.so.5.0 base-i18n-shlib | | 51 | ./usr/lib/i18n/libmapper_parallel.so.5.0 base-i18n-shlib |
52 | ./usr/lib/i18n/libmapper_serial.so.5.0 base-i18n-shlib | | 52 | ./usr/lib/i18n/libmapper_serial.so.5.0 base-i18n-shlib |
53 | ./usr/lib/i18n/libmapper_std.so.5.0 base-i18n-shlib | | 53 | ./usr/lib/i18n/libmapper_std.so.5.0 base-i18n-shlib |
54 | ./usr/lib/i18n/libmapper_zone.so.5.0 base-i18n-shlib | | 54 | ./usr/lib/i18n/libmapper_zone.so.5.0 base-i18n-shlib |
55 | ./usr/lib/libamu.so.4.0 base-amd-shlib | | 55 | ./usr/lib/libamu.so.4.0 base-amd-shlib |
56 | ./usr/lib/libarchive.so.3.0 base-sys-shlib | | 56 | ./usr/lib/libarchive.so.3.0 base-sys-shlib |
57 | ./usr/lib/libasn1.so.8.0 base-krb5-shlib kerberos | | 57 | ./usr/lib/libasn1.so.8.0 base-krb5-shlib kerberos |
58 | ./usr/lib/libbfd.so.10.0 base-sys-shlib bfd | | 58 | ./usr/lib/libbfd.so.10.0 base-sys-shlib bfd |
59 | ./usr/lib/libbind9.so.4.0 base-bind-shlib | | 59 | ./usr/lib/libbind9.so.4.0 base-bind-shlib |
60 | ./usr/lib/libbluetooth.so.4.1 base-sys-shlib | | 60 | ./usr/lib/libbluetooth.so.4.2 base-sys-shlib |
61 | ./usr/lib/libbsdmalloc.so.0.0 base-sys-shlib | | 61 | ./usr/lib/libbsdmalloc.so.0.0 base-sys-shlib |
62 | ./usr/lib/libbz2.so.1.1 base-sys-shlib | | 62 | ./usr/lib/libbz2.so.1.1 base-sys-shlib |
63 | ./usr/lib/libc.so.12.169 base-sys-shlib | | 63 | ./usr/lib/libc.so.12.169 base-sys-shlib |
64 | ./usr/lib/libcom_err.so.6.0 base-krb5-shlib kerberos | | 64 | ./usr/lib/libcom_err.so.6.0 base-krb5-shlib kerberos |
65 | ./usr/lib/libcrypt.so.1.0 base-sys-shlib | | 65 | ./usr/lib/libcrypt.so.1.0 base-sys-shlib |
66 | ./usr/lib/libcrypto.so.6.0 base-crypto-shlib crypto | | 66 | ./usr/lib/libcrypto.so.6.0 base-crypto-shlib crypto |
67 | ./usr/lib/libcurses.so.7.0 base-sys-shlib | | 67 | ./usr/lib/libcurses.so.7.0 base-sys-shlib |
68 | ./usr/lib/libdes.so.8.1 base-crypto-shlib crypto | | 68 | ./usr/lib/libdes.so.8.1 base-crypto-shlib crypto |
69 | ./usr/lib/libdevmapper.so.1.0 base-lvm-shlib lvm | | 69 | ./usr/lib/libdevmapper.so.1.0 base-lvm-shlib lvm |
70 | ./usr/lib/libdns.so.4.0 base-bind-shlib | | 70 | ./usr/lib/libdns.so.4.0 base-bind-shlib |
71 | ./usr/lib/libedit.so.3.0 base-sys-shlib | | 71 | ./usr/lib/libedit.so.3.0 base-sys-shlib |
72 | ./usr/lib/libevent.so.3.1 base-sys-shlib | | 72 | ./usr/lib/libevent.so.3.1 base-sys-shlib |
73 | ./usr/lib/libfetch.so.3.0 base-sys-shlib | | 73 | ./usr/lib/libfetch.so.3.0 base-sys-shlib |
--- src/distrib/sets/lists/comp/mi 2009/07/21 14:55:32 1.1287
+++ src/distrib/sets/lists/comp/mi 2009/08/03 15:59:41 1.1288
| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: mi,v 1.1287 2009/07/21 14:55:32 joerg Exp $ | | 1 | # $NetBSD: mi,v 1.1288 2009/08/03 15:59:41 plunky Exp $ |
2 | # | | 2 | # |
3 | # Note: don't delete entries from here - mark them as "obsolete" instead. | | 3 | # Note: don't delete entries from here - mark them as "obsolete" instead. |
4 | # | | 4 | # |
5 | ./etc/mtree/set.comp comp-sys-root | | 5 | ./etc/mtree/set.comp comp-sys-root |
6 | ./usr/bin/addr2line comp-debug-bin bfd | | 6 | ./usr/bin/addr2line comp-debug-bin bfd |
7 | ./usr/bin/ar comp-util-bin bfd | | 7 | ./usr/bin/ar comp-util-bin bfd |
8 | ./usr/bin/as comp-util-bin bfd | | 8 | ./usr/bin/as comp-util-bin bfd |
9 | ./usr/bin/asa comp-fortran-bin | | 9 | ./usr/bin/asa comp-fortran-bin |
10 | ./usr/bin/atf-compile comp-atf-bin | | 10 | ./usr/bin/atf-compile comp-atf-bin |
11 | ./usr/bin/c++ comp-cxx-bin gcccmds | | 11 | ./usr/bin/c++ comp-cxx-bin gcccmds |
12 | ./usr/bin/c++filt comp-cxx-bin bfd | | 12 | ./usr/bin/c++filt comp-cxx-bin bfd |
13 | ./usr/bin/c89 comp-c-bin | | 13 | ./usr/bin/c89 comp-c-bin |
14 | ./usr/bin/c99 comp-c-bin | | 14 | ./usr/bin/c99 comp-c-bin |
| @@ -4898,28 +4898,43 @@ | | | @@ -4898,28 +4898,43 @@ |
4898 | ./usr/share/man/cat3/bm_free.0 comp-c-catman .cat | | 4898 | ./usr/share/man/cat3/bm_free.0 comp-c-catman .cat |
4899 | ./usr/share/man/cat3/bn.0 comp-obsolete obsolete | | 4899 | ./usr/share/man/cat3/bn.0 comp-obsolete obsolete |
4900 | ./usr/share/man/cat3/bn_internal.0 comp-obsolete obsolete | | 4900 | ./usr/share/man/cat3/bn_internal.0 comp-obsolete obsolete |
4901 | ./usr/share/man/cat3/border.0 comp-c-catman .cat | | 4901 | ./usr/share/man/cat3/border.0 comp-c-catman .cat |
4902 | ./usr/share/man/cat3/box.0 comp-c-catman .cat | | 4902 | ./usr/share/man/cat3/box.0 comp-c-catman .cat |
4903 | ./usr/share/man/cat3/bsearch.0 comp-c-catman .cat | | 4903 | ./usr/share/man/cat3/bsearch.0 comp-c-catman .cat |
4904 | ./usr/share/man/cat3/bstring.0 comp-c-catman .cat | | 4904 | ./usr/share/man/cat3/bstring.0 comp-c-catman .cat |
4905 | ./usr/share/man/cat3/bswap.0 comp-c-catman .cat | | 4905 | ./usr/share/man/cat3/bswap.0 comp-c-catman .cat |
4906 | ./usr/share/man/cat3/bswap16.0 comp-c-catman .cat | | 4906 | ./usr/share/man/cat3/bswap16.0 comp-c-catman .cat |
4907 | ./usr/share/man/cat3/bswap32.0 comp-c-catman .cat | | 4907 | ./usr/share/man/cat3/bswap32.0 comp-c-catman .cat |
4908 | ./usr/share/man/cat3/bswap64.0 comp-c-catman .cat | | 4908 | ./usr/share/man/cat3/bswap64.0 comp-c-catman .cat |
4909 | ./usr/share/man/cat3/bt_aton.0 comp-c-catman .cat | | 4909 | ./usr/share/man/cat3/bt_aton.0 comp-c-catman .cat |
4910 | ./usr/share/man/cat3/bt_closeconfig.0 comp-obsolete obsolete | | 4910 | ./usr/share/man/cat3/bt_closeconfig.0 comp-obsolete obsolete |
| | | 4911 | ./usr/share/man/cat3/bt_dev.0 comp-c-catman .cat |
4911 | ./usr/share/man/cat3/bt_devaddr.0 comp-c-catman .cat | | 4912 | ./usr/share/man/cat3/bt_devaddr.0 comp-c-catman .cat |
| | | 4913 | ./usr/share/man/cat3/bt_devenum.0 comp-c-catman .cat |
| | | 4914 | ./usr/share/man/cat3/bt_devfilter.0 comp-c-catman .cat |
| | | 4915 | ./usr/share/man/cat3/bt_devfilter_pkt_clr.0 comp-c-catman .cat |
| | | 4916 | ./usr/share/man/cat3/bt_devfilter_pkt_set.0 comp-c-catman .cat |
| | | 4917 | ./usr/share/man/cat3/bt_devfilter_pkt_tst.0 comp-c-catman .cat |
| | | 4918 | ./usr/share/man/cat3/bt_devfilter_evt_clr.0 comp-c-catman .cat |
| | | 4919 | ./usr/share/man/cat3/bt_devfilter_evt_set.0 comp-c-catman .cat |
| | | 4920 | ./usr/share/man/cat3/bt_devfilter_evt_tst.0 comp-c-catman .cat |
| | | 4921 | ./usr/share/man/cat3/bt_devinfo.0 comp-c-catman .cat |
4912 | ./usr/share/man/cat3/bt_devname.0 comp-c-catman .cat | | 4922 | ./usr/share/man/cat3/bt_devname.0 comp-c-catman .cat |
| | | 4923 | ./usr/share/man/cat3/bt_devopen.0 comp-c-catman .cat |
| | | 4924 | ./usr/share/man/cat3/bt_devrecv.0 comp-c-catman .cat |
| | | 4925 | ./usr/share/man/cat3/bt_devreq.0 comp-c-catman .cat |
| | | 4926 | ./usr/share/man/cat3/bt_devsend.0 comp-c-catman .cat |
| | | 4927 | ./usr/share/man/cat3/bt_devinquiry.0 comp-c-catman .cat |
4913 | ./usr/share/man/cat3/bt_eachconfig.0 comp-obsolete obsolete | | 4928 | ./usr/share/man/cat3/bt_eachconfig.0 comp-obsolete obsolete |
4914 | ./usr/share/man/cat3/bt_endhostent.0 comp-c-catman .cat | | 4929 | ./usr/share/man/cat3/bt_endhostent.0 comp-c-catman .cat |
4915 | ./usr/share/man/cat3/bt_endprotoent.0 comp-c-catman .cat | | 4930 | ./usr/share/man/cat3/bt_endprotoent.0 comp-c-catman .cat |
4916 | ./usr/share/man/cat3/bt_freeconfig.0 comp-obsolete obsolete | | 4931 | ./usr/share/man/cat3/bt_freeconfig.0 comp-obsolete obsolete |
4917 | ./usr/share/man/cat3/bt_getconfig.0 comp-obsolete obsolete | | 4932 | ./usr/share/man/cat3/bt_getconfig.0 comp-obsolete obsolete |
4918 | ./usr/share/man/cat3/bt_gethostbyaddr.0 comp-c-catman .cat | | 4933 | ./usr/share/man/cat3/bt_gethostbyaddr.0 comp-c-catman .cat |
4919 | ./usr/share/man/cat3/bt_gethostbyname.0 comp-c-catman .cat | | 4934 | ./usr/share/man/cat3/bt_gethostbyname.0 comp-c-catman .cat |
4920 | ./usr/share/man/cat3/bt_gethostent.0 comp-c-catman .cat | | 4935 | ./usr/share/man/cat3/bt_gethostent.0 comp-c-catman .cat |
4921 | ./usr/share/man/cat3/bt_getprotobyname.0 comp-c-catman .cat | | 4936 | ./usr/share/man/cat3/bt_getprotobyname.0 comp-c-catman .cat |
4922 | ./usr/share/man/cat3/bt_getprotobynumber.0 comp-c-catman .cat | | 4937 | ./usr/share/man/cat3/bt_getprotobynumber.0 comp-c-catman .cat |
4923 | ./usr/share/man/cat3/bt_getprotoent.0 comp-c-catman .cat | | 4938 | ./usr/share/man/cat3/bt_getprotoent.0 comp-c-catman .cat |
4924 | ./usr/share/man/cat3/bt_ntoa.0 comp-c-catman .cat | | 4939 | ./usr/share/man/cat3/bt_ntoa.0 comp-c-catman .cat |
4925 | ./usr/share/man/cat3/bt_openconfig.0 comp-obsolete obsolete | | 4940 | ./usr/share/man/cat3/bt_openconfig.0 comp-obsolete obsolete |
| @@ -10453,28 +10468,43 @@ | | | @@ -10453,28 +10468,43 @@ |
10453 | ./usr/share/man/html3/bm.html comp-c-htmlman html | | 10468 | ./usr/share/man/html3/bm.html comp-c-htmlman html |
10454 | ./usr/share/man/html3/bm_comp.html comp-c-htmlman html | | 10469 | ./usr/share/man/html3/bm_comp.html comp-c-htmlman html |
10455 | ./usr/share/man/html3/bm_exec.html comp-c-htmlman html | | 10470 | ./usr/share/man/html3/bm_exec.html comp-c-htmlman html |
10456 | ./usr/share/man/html3/bm_free.html comp-c-htmlman html | | 10471 | ./usr/share/man/html3/bm_free.html comp-c-htmlman html |
10457 | ./usr/share/man/html3/border.html comp-c-htmlman html | | 10472 | ./usr/share/man/html3/border.html comp-c-htmlman html |
10458 | ./usr/share/man/html3/box.html comp-c-htmlman html | | 10473 | ./usr/share/man/html3/box.html comp-c-htmlman html |
10459 | ./usr/share/man/html3/bsearch.html comp-c-htmlman html | | 10474 | ./usr/share/man/html3/bsearch.html comp-c-htmlman html |
10460 | ./usr/share/man/html3/bstring.html comp-c-htmlman html | | 10475 | ./usr/share/man/html3/bstring.html comp-c-htmlman html |
10461 | ./usr/share/man/html3/bswap.html comp-c-htmlman html | | 10476 | ./usr/share/man/html3/bswap.html comp-c-htmlman html |
10462 | ./usr/share/man/html3/bswap16.html comp-c-htmlman html | | 10477 | ./usr/share/man/html3/bswap16.html comp-c-htmlman html |
10463 | ./usr/share/man/html3/bswap32.html comp-c-htmlman html | | 10478 | ./usr/share/man/html3/bswap32.html comp-c-htmlman html |
10464 | ./usr/share/man/html3/bswap64.html comp-c-htmlman html | | 10479 | ./usr/share/man/html3/bswap64.html comp-c-htmlman html |
10465 | ./usr/share/man/html3/bt_aton.html comp-c-htmlman html | | 10480 | ./usr/share/man/html3/bt_aton.html comp-c-htmlman html |
| | | 10481 | ./usr/share/man/html3/bt_dev.html comp-c-htmlman html |
10466 | ./usr/share/man/html3/bt_devaddr.html comp-c-htmlman html | | 10482 | ./usr/share/man/html3/bt_devaddr.html comp-c-htmlman html |
| | | 10483 | ./usr/share/man/html3/bt_devenum.html comp-c-htmlman html |
| | | 10484 | ./usr/share/man/html3/bt_devfilter.html comp-c-htmlman html |
| | | 10485 | ./usr/share/man/html3/bt_devfilter_pkt_clr.html comp-c-htmlman html |
| | | 10486 | ./usr/share/man/html3/bt_devfilter_pkt_set.html comp-c-htmlman html |
| | | 10487 | ./usr/share/man/html3/bt_devfilter_pkt_tst.html comp-c-htmlman html |
| | | 10488 | ./usr/share/man/html3/bt_devfilter_evt_clr.html comp-c-htmlman html |
| | | 10489 | ./usr/share/man/html3/bt_devfilter_evt_set.html comp-c-htmlman html |
| | | 10490 | ./usr/share/man/html3/bt_devfilter_evt_tst.html comp-c-htmlman html |
| | | 10491 | ./usr/share/man/html3/bt_devinfo.html comp-c-htmlman html |
10467 | ./usr/share/man/html3/bt_devname.html comp-c-htmlman html | | 10492 | ./usr/share/man/html3/bt_devname.html comp-c-htmlman html |
| | | 10493 | ./usr/share/man/html3/bt_devopen.html comp-c-htmlman html |
| | | 10494 | ./usr/share/man/html3/bt_devrecv.html comp-c-htmlman html |
| | | 10495 | ./usr/share/man/html3/bt_devreq.html comp-c-htmlman html |
| | | 10496 | ./usr/share/man/html3/bt_devsend.html comp-c-htmlman html |
| | | 10497 | ./usr/share/man/html3/bt_devinquiry.html comp-c-htmlman html |
10468 | ./usr/share/man/html3/bt_endhostent.html comp-c-htmlman html | | 10498 | ./usr/share/man/html3/bt_endhostent.html comp-c-htmlman html |
10469 | ./usr/share/man/html3/bt_endprotoent.html comp-c-htmlman html | | 10499 | ./usr/share/man/html3/bt_endprotoent.html comp-c-htmlman html |
10470 | ./usr/share/man/html3/bt_gethostbyaddr.html comp-c-htmlman html | | 10500 | ./usr/share/man/html3/bt_gethostbyaddr.html comp-c-htmlman html |
10471 | ./usr/share/man/html3/bt_gethostbyname.html comp-c-htmlman html | | 10501 | ./usr/share/man/html3/bt_gethostbyname.html comp-c-htmlman html |
10472 | ./usr/share/man/html3/bt_gethostent.html comp-c-htmlman html | | 10502 | ./usr/share/man/html3/bt_gethostent.html comp-c-htmlman html |
10473 | ./usr/share/man/html3/bt_getprotobyname.html comp-c-htmlman html | | 10503 | ./usr/share/man/html3/bt_getprotobyname.html comp-c-htmlman html |
10474 | ./usr/share/man/html3/bt_getprotobynumber.html comp-c-htmlman html | | 10504 | ./usr/share/man/html3/bt_getprotobynumber.html comp-c-htmlman html |
10475 | ./usr/share/man/html3/bt_getprotoent.html comp-c-htmlman html | | 10505 | ./usr/share/man/html3/bt_getprotoent.html comp-c-htmlman html |
10476 | ./usr/share/man/html3/bt_ntoa.html comp-c-htmlman html | | 10506 | ./usr/share/man/html3/bt_ntoa.html comp-c-htmlman html |
10477 | ./usr/share/man/html3/bt_sethostent.html comp-c-htmlman html | | 10507 | ./usr/share/man/html3/bt_sethostent.html comp-c-htmlman html |
10478 | ./usr/share/man/html3/bt_setprotoent.html comp-c-htmlman html | | 10508 | ./usr/share/man/html3/bt_setprotoent.html comp-c-htmlman html |
10479 | ./usr/share/man/html3/btowc.html comp-c-htmlman html | | 10509 | ./usr/share/man/html3/btowc.html comp-c-htmlman html |
10480 | ./usr/share/man/html3/btree.html comp-c-htmlman html | | 10510 | ./usr/share/man/html3/btree.html comp-c-htmlman html |
| @@ -15816,28 +15846,43 @@ | | | @@ -15816,28 +15846,43 @@ |
15816 | ./usr/share/man/man3/bm_free.3 comp-c-man .man | | 15846 | ./usr/share/man/man3/bm_free.3 comp-c-man .man |
15817 | ./usr/share/man/man3/bn.3 comp-obsolete obsolete | | 15847 | ./usr/share/man/man3/bn.3 comp-obsolete obsolete |
15818 | ./usr/share/man/man3/bn_internal.3 comp-obsolete obsolete | | 15848 | ./usr/share/man/man3/bn_internal.3 comp-obsolete obsolete |
15819 | ./usr/share/man/man3/border.3 comp-c-man .man | | 15849 | ./usr/share/man/man3/border.3 comp-c-man .man |
15820 | ./usr/share/man/man3/box.3 comp-c-man .man | | 15850 | ./usr/share/man/man3/box.3 comp-c-man .man |
15821 | ./usr/share/man/man3/bsearch.3 comp-c-man .man | | 15851 | ./usr/share/man/man3/bsearch.3 comp-c-man .man |
15822 | ./usr/share/man/man3/bstring.3 comp-c-man .man | | 15852 | ./usr/share/man/man3/bstring.3 comp-c-man .man |
15823 | ./usr/share/man/man3/bswap.3 comp-c-man .man | | 15853 | ./usr/share/man/man3/bswap.3 comp-c-man .man |
15824 | ./usr/share/man/man3/bswap16.3 comp-c-man .man | | 15854 | ./usr/share/man/man3/bswap16.3 comp-c-man .man |
15825 | ./usr/share/man/man3/bswap32.3 comp-c-man .man | | 15855 | ./usr/share/man/man3/bswap32.3 comp-c-man .man |
15826 | ./usr/share/man/man3/bswap64.3 comp-c-man .man | | 15856 | ./usr/share/man/man3/bswap64.3 comp-c-man .man |
15827 | ./usr/share/man/man3/bt_aton.3 comp-c-man .man | | 15857 | ./usr/share/man/man3/bt_aton.3 comp-c-man .man |
15828 | ./usr/share/man/man3/bt_closeconfig.3 comp-obsolete obsolete | | 15858 | ./usr/share/man/man3/bt_closeconfig.3 comp-obsolete obsolete |
| | | 15859 | ./usr/share/man/man3/bt_dev.3 comp-c-man .man |
15829 | ./usr/share/man/man3/bt_devaddr.3 comp-c-man .man | | 15860 | ./usr/share/man/man3/bt_devaddr.3 comp-c-man .man |
| | | 15861 | ./usr/share/man/man3/bt_devenum.3 comp-c-man .man |
| | | 15862 | ./usr/share/man/man3/bt_devfilter.3 comp-c-man .man |
| | | 15863 | ./usr/share/man/man3/bt_devfilter_pkt_clr.3 comp-c-man .man |
| | | 15864 | ./usr/share/man/man3/bt_devfilter_pkt_set.3 comp-c-man .man |
| | | 15865 | ./usr/share/man/man3/bt_devfilter_pkt_tst.3 comp-c-man .man |
| | | 15866 | ./usr/share/man/man3/bt_devfilter_evt_clr.3 comp-c-man .man |
| | | 15867 | ./usr/share/man/man3/bt_devfilter_evt_set.3 comp-c-man .man |
| | | 15868 | ./usr/share/man/man3/bt_devfilter_evt_tst.3 comp-c-man .man |
| | | 15869 | ./usr/share/man/man3/bt_devinfo.3 comp-c-man .man |
15830 | ./usr/share/man/man3/bt_devname.3 comp-c-man .man | | 15870 | ./usr/share/man/man3/bt_devname.3 comp-c-man .man |
| | | 15871 | ./usr/share/man/man3/bt_devopen.3 comp-c-man .man |
| | | 15872 | ./usr/share/man/man3/bt_devrecv.3 comp-c-man .man |
| | | 15873 | ./usr/share/man/man3/bt_devreq.3 comp-c-man .man |
| | | 15874 | ./usr/share/man/man3/bt_devsend.3 comp-c-man .man |
| | | 15875 | ./usr/share/man/man3/bt_devinquiry.3 comp-c-man .man |
15831 | ./usr/share/man/man3/bt_eachconfig.3 comp-obsolete obsolete | | 15876 | ./usr/share/man/man3/bt_eachconfig.3 comp-obsolete obsolete |
15832 | ./usr/share/man/man3/bt_endhostent.3 comp-c-man .man | | 15877 | ./usr/share/man/man3/bt_endhostent.3 comp-c-man .man |
15833 | ./usr/share/man/man3/bt_endprotoent.3 comp-c-man .man | | 15878 | ./usr/share/man/man3/bt_endprotoent.3 comp-c-man .man |
15834 | ./usr/share/man/man3/bt_freeconfig.3 comp-obsolete obsolete | | 15879 | ./usr/share/man/man3/bt_freeconfig.3 comp-obsolete obsolete |
15835 | ./usr/share/man/man3/bt_getconfig.3 comp-obsolete obsolete | | 15880 | ./usr/share/man/man3/bt_getconfig.3 comp-obsolete obsolete |
15836 | ./usr/share/man/man3/bt_gethostbyaddr.3 comp-c-man .man | | 15881 | ./usr/share/man/man3/bt_gethostbyaddr.3 comp-c-man .man |
15837 | ./usr/share/man/man3/bt_gethostbyname.3 comp-c-man .man | | 15882 | ./usr/share/man/man3/bt_gethostbyname.3 comp-c-man .man |
15838 | ./usr/share/man/man3/bt_gethostent.3 comp-c-man .man | | 15883 | ./usr/share/man/man3/bt_gethostent.3 comp-c-man .man |
15839 | ./usr/share/man/man3/bt_getprotobyname.3 comp-c-man .man | | 15884 | ./usr/share/man/man3/bt_getprotobyname.3 comp-c-man .man |
15840 | ./usr/share/man/man3/bt_getprotobynumber.3 comp-c-man .man | | 15885 | ./usr/share/man/man3/bt_getprotobynumber.3 comp-c-man .man |
15841 | ./usr/share/man/man3/bt_getprotoent.3 comp-c-man .man | | 15886 | ./usr/share/man/man3/bt_getprotoent.3 comp-c-man .man |
15842 | ./usr/share/man/man3/bt_ntoa.3 comp-c-man .man | | 15887 | ./usr/share/man/man3/bt_ntoa.3 comp-c-man .man |
15843 | ./usr/share/man/man3/bt_openconfig.3 comp-obsolete obsolete | | 15888 | ./usr/share/man/man3/bt_openconfig.3 comp-obsolete obsolete |
--- src/lib/libbluetooth/Makefile 2009/05/12 10:05:06 1.4
+++ src/lib/libbluetooth/Makefile 2009/08/03 15:59:42 1.5
| @@ -1,50 +1,64 @@ | | | @@ -1,50 +1,64 @@ |
1 | # $NetBSD: Makefile,v 1.4 2009/05/12 10:05:06 plunky Exp $ | | 1 | # $NetBSD: Makefile,v 1.5 2009/08/03 15:59:42 plunky Exp $ |
2 | | | 2 | |
3 | USE_FORT?= yes # network protocol library | | 3 | USE_FORT?= yes # network protocol library |
4 | | | 4 | |
5 | LIB= bluetooth | | 5 | LIB= bluetooth |
6 | | | 6 | |
7 | SRCS= bluetooth.c devaddr.c \ | | 7 | SRCS= bluetooth.c bt_dev.c \ |
8 | sdp_data.c sdp_get.c sdp_match.c sdp_put.c sdp_record.c \ | | 8 | sdp_data.c sdp_get.c sdp_match.c sdp_put.c sdp_record.c \ |
9 | sdp_set.c sdp_uuid.c sdp_service.c sdp_session.c | | 9 | sdp_set.c sdp_uuid.c sdp_service.c sdp_session.c |
10 | MAN= bluetooth.3 sdp.3 sdp_data.3 | | 10 | MAN= bluetooth.3 bt_dev.3 sdp.3 sdp_data.3 |
11 | | | 11 | |
12 | CPPFLAGS+= -I${.CURDIR} | | 12 | CPPFLAGS+= -I${.CURDIR} |
13 | | | 13 | |
14 | .if (${SDP_COMPAT:Uyes} != "no") | | 14 | .if (${SDP_COMPAT:Uyes} != "no") |
15 | SRCS+= sdp_compat.c | | 15 | SRCS+= sdp_compat.c |
16 | .endif | | 16 | .endif |
17 | | | 17 | |
18 | INCS= bluetooth.h sdp.h | | 18 | INCS= bluetooth.h sdp.h |
19 | INCSDIR= /usr/include | | 19 | INCSDIR= /usr/include |
20 | | | 20 | |
21 | MLINKS+= bluetooth.3 bt_gethostbyname.3 | | 21 | MLINKS+= bluetooth.3 bt_gethostbyname.3 |
22 | MLINKS+= bluetooth.3 bt_gethostbyaddr.3 | | 22 | MLINKS+= bluetooth.3 bt_gethostbyaddr.3 |
23 | MLINKS+= bluetooth.3 bt_gethostent.3 | | 23 | MLINKS+= bluetooth.3 bt_gethostent.3 |
24 | MLINKS+= bluetooth.3 bt_sethostent.3 | | 24 | MLINKS+= bluetooth.3 bt_sethostent.3 |
25 | MLINKS+= bluetooth.3 bt_endhostent.3 | | 25 | MLINKS+= bluetooth.3 bt_endhostent.3 |
26 | | | 26 | |
27 | MLINKS+= bluetooth.3 bt_getprotobyname.3 | | 27 | MLINKS+= bluetooth.3 bt_getprotobyname.3 |
28 | MLINKS+= bluetooth.3 bt_getprotobynumber.3 | | 28 | MLINKS+= bluetooth.3 bt_getprotobynumber.3 |
29 | MLINKS+= bluetooth.3 bt_getprotoent.3 | | 29 | MLINKS+= bluetooth.3 bt_getprotoent.3 |
30 | MLINKS+= bluetooth.3 bt_setprotoent.3 | | 30 | MLINKS+= bluetooth.3 bt_setprotoent.3 |
31 | MLINKS+= bluetooth.3 bt_endprotoent.3 | | 31 | MLINKS+= bluetooth.3 bt_endprotoent.3 |
32 | | | 32 | |
33 | MLINKS+= bluetooth.3 bt_ntoa.3 | | 33 | MLINKS+= bluetooth.3 bt_ntoa.3 |
34 | MLINKS+= bluetooth.3 bt_aton.3 | | 34 | MLINKS+= bluetooth.3 bt_aton.3 |
35 | | | 35 | |
36 | MLINKS+= bluetooth.3 bt_devaddr.3 | | 36 | MLINKS+= bt_dev.3 bt_devaddr.3 |
37 | MLINKS+= bluetooth.3 bt_devname.3 | | 37 | MLINKS+= bt_dev.3 bt_devname.3 |
| | | 38 | MLINKS+= bt_dev.3 bt_devenum.3 |
| | | 39 | MLINKS+= bt_dev.3 bt_devinfo.3 |
| | | 40 | MLINKS+= bt_dev.3 bt_devopen.3 |
| | | 41 | MLINKS+= bt_dev.3 bt_devsend.3 |
| | | 42 | MLINKS+= bt_dev.3 bt_devrecv.3 |
| | | 43 | MLINKS+= bt_dev.3 bt_devreq.3 |
| | | 44 | MLINKS+= bt_dev.3 bt_devfilter.3 |
| | | 45 | MLINKS+= bt_dev.3 bt_devfilter_pkt_set.3 |
| | | 46 | MLINKS+= bt_dev.3 bt_devfilter_pkt_clr.3 |
| | | 47 | MLINKS+= bt_dev.3 bt_devfilter_pkt_tst.3 |
| | | 48 | MLINKS+= bt_dev.3 bt_devfilter_evt_set.3 |
| | | 49 | MLINKS+= bt_dev.3 bt_devfilter_evt_clr.3 |
| | | 50 | MLINKS+= bt_dev.3 bt_devfilter_evt_tst.3 |
| | | 51 | MLINKS+= bt_dev.3 bt_devinquiry.3 |
38 | | | 52 | |
39 | MLINKS+= sdp.3 sdp_open.3 | | 53 | MLINKS+= sdp.3 sdp_open.3 |
40 | MLINKS+= sdp.3 sdp_open_local.3 | | 54 | MLINKS+= sdp.3 sdp_open_local.3 |
41 | MLINKS+= sdp.3 sdp_close.3 | | 55 | MLINKS+= sdp.3 sdp_close.3 |
42 | MLINKS+= sdp.3 sdp_service_search.3 | | 56 | MLINKS+= sdp.3 sdp_service_search.3 |
43 | MLINKS+= sdp.3 sdp_service_attribute.3 | | 57 | MLINKS+= sdp.3 sdp_service_attribute.3 |
44 | MLINKS+= sdp.3 sdp_service_search_attribute.3 | | 58 | MLINKS+= sdp.3 sdp_service_search_attribute.3 |
45 | MLINKS+= sdp.3 sdp_record_insert.3 | | 59 | MLINKS+= sdp.3 sdp_record_insert.3 |
46 | MLINKS+= sdp.3 sdp_record_update.3 | | 60 | MLINKS+= sdp.3 sdp_record_update.3 |
47 | MLINKS+= sdp.3 sdp_record_remove.3 | | 61 | MLINKS+= sdp.3 sdp_record_remove.3 |
48 | | | 62 | |
49 | MLINKS+= sdp_data.3 sdp_match_uuid16.3 | | 63 | MLINKS+= sdp_data.3 sdp_match_uuid16.3 |
50 | | | 64 | |
--- src/lib/libbluetooth/shlib_version 2009/05/12 10:05:06 1.4
+++ src/lib/libbluetooth/shlib_version 2009/08/03 15:59:42 1.5
| @@ -1,5 +1,5 @@ | | | @@ -1,5 +1,5 @@ |
1 | # $NetBSD: shlib_version,v 1.4 2009/05/12 10:05:06 plunky Exp $ | | 1 | # $NetBSD: shlib_version,v 1.5 2009/08/03 15:59:42 plunky Exp $ |
2 | # Remember to update distrib/sets/lists/base/shl.* when changing | | 2 | # Remember to update distrib/sets/lists/base/shl.* when changing |
3 | # | | 3 | # |
4 | major=4 | | 4 | major=4 |
5 | minor=1 | | 5 | minor=2 |
--- src/lib/libbluetooth/bluetooth.3 2006/07/30 00:15:54 1.3
+++ src/lib/libbluetooth/bluetooth.3 2009/08/03 15:59:42 1.4
| @@ -1,61 +1,58 @@ | | | @@ -1,61 +1,58 @@ |
1 | .\" $NetBSD: bluetooth.3,v 1.3 2006/07/30 00:15:54 wiz Exp $ | | 1 | .\" $NetBSD: bluetooth.3,v 1.4 2009/08/03 15:59:42 plunky Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com> | | 3 | .\" Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com> |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" | | 14 | .\" |
15 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | | 15 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
16 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 16 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 17 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 18 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 19 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 20 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
21 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 21 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 22 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 23 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 24 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 | .\" SUCH DAMAGE. | | 25 | .\" SUCH DAMAGE. |
26 | .\" | | 26 | .\" |
27 | .\" $Id: bluetooth.3,v 1.3 2006/07/30 00:15:54 wiz Exp $ | | | |
28 | .\" $FreeBSD: src/lib/libbluetooth/bluetooth.3,v 1.7 2005/01/21 10:26:11 ru Exp $ | | 27 | .\" $FreeBSD: src/lib/libbluetooth/bluetooth.3,v 1.7 2005/01/21 10:26:11 ru Exp $ |
29 | .\" | | 28 | .\" |
30 | .Dd July 26, 2006 | | 29 | .Dd August 3, 2009 |
31 | .Dt BLUETOOTH 3 | | 30 | .Dt BLUETOOTH 3 |
32 | .Os | | 31 | .Os |
33 | .Sh NAME | | 32 | .Sh NAME |
34 | .Nm bt_gethostbyname , | | 33 | .Nm bt_gethostbyname , |
35 | .Nm bt_gethostbyaddr , | | 34 | .Nm bt_gethostbyaddr , |
36 | .Nm bt_gethostent , | | 35 | .Nm bt_gethostent , |
37 | .Nm bt_sethostent , | | 36 | .Nm bt_sethostent , |
38 | .Nm bt_endhostent , | | 37 | .Nm bt_endhostent , |
39 | .Nm bt_getprotobyname , | | 38 | .Nm bt_getprotobyname , |
40 | .Nm bt_getprotobynumber , | | 39 | .Nm bt_getprotobynumber , |
41 | .Nm bt_getprotoent , | | 40 | .Nm bt_getprotoent , |
42 | .Nm bt_setprotoent , | | 41 | .Nm bt_setprotoent , |
43 | .Nm bt_endprotoent , | | 42 | .Nm bt_endprotoent , |
44 | .Nm bt_aton , | | 43 | .Nm bt_aton , |
45 | .Nm bt_ntoa , | | 44 | .Nm bt_ntoa , |
46 | .Nm bt_devaddr , | | 45 | .Nd Bluetooth host lookup routines |
47 | .Nm bt_devname , | | | |
48 | .Nd Bluetooth routines | | | |
49 | .Sh LIBRARY | | 46 | .Sh LIBRARY |
50 | .Lb libbluetooth | | 47 | .Lb libbluetooth |
51 | .Sh SYNOPSIS | | 48 | .Sh SYNOPSIS |
52 | .In bluetooth.h | | 49 | .In bluetooth.h |
53 | .Ft struct hostent * | | 50 | .Ft struct hostent * |
54 | .Fn bt_gethostbyname "const char *name" | | 51 | .Fn bt_gethostbyname "const char *name" |
55 | .Ft struct hostent * | | 52 | .Ft struct hostent * |
56 | .Fn bt_gethostbyaddr "const char *addr" "int len" "int type" | | 53 | .Fn bt_gethostbyaddr "const char *addr" "int len" "int type" |
57 | .Ft struct hostent * | | 54 | .Ft struct hostent * |
58 | .Fn bt_gethostent void | | 55 | .Fn bt_gethostent void |
59 | .Ft void | | 56 | .Ft void |
60 | .Fn bt_sethostent "int stayopen" | | 57 | .Fn bt_sethostent "int stayopen" |
61 | .Ft void | | 58 | .Ft void |
| @@ -64,30 +61,26 @@ | | | @@ -64,30 +61,26 @@ |
64 | .Fn bt_getprotobyname "const char *name" | | 61 | .Fn bt_getprotobyname "const char *name" |
65 | .Ft struct protoent * | | 62 | .Ft struct protoent * |
66 | .Fn bt_getprotobynumber "int proto" | | 63 | .Fn bt_getprotobynumber "int proto" |
67 | .Ft struct protoent * | | 64 | .Ft struct protoent * |
68 | .Fn bt_getprotoent void | | 65 | .Fn bt_getprotoent void |
69 | .Ft void | | 66 | .Ft void |
70 | .Fn bt_setprotoent "int stayopen" | | 67 | .Fn bt_setprotoent "int stayopen" |
71 | .Ft void | | 68 | .Ft void |
72 | .Fn bt_endprotoent void | | 69 | .Fn bt_endprotoent void |
73 | .Ft int | | 70 | .Ft int |
74 | .Fn bt_aton "const char *str" "bdaddr_t *ba" | | 71 | .Fn bt_aton "const char *str" "bdaddr_t *ba" |
75 | .Ft const char * | | 72 | .Ft const char * |
76 | .Fn bt_ntoa "const bdaddr_t *ba" "char *str" | | 73 | .Fn bt_ntoa "const bdaddr_t *ba" "char *str" |
77 | .Ft int | | | |
78 | .Fn bt_devaddr "const char *name" "bdaddr_t *addr" | | | |
79 | .Ft int | | | |
80 | .Fn bt_devname "char *name" "const bdaddr_t *addr" | | | |
81 | .Sh DESCRIPTION | | 74 | .Sh DESCRIPTION |
82 | The | | 75 | The |
83 | .Fn bt_gethostent , | | 76 | .Fn bt_gethostent , |
84 | .Fn bt_gethostbyname , | | 77 | .Fn bt_gethostbyname , |
85 | and | | 78 | and |
86 | .Fn bt_gethostbyaddr | | 79 | .Fn bt_gethostbyaddr |
87 | functions each return a pointer to an object with the | | 80 | functions each return a pointer to an object with the |
88 | .Vt hostent | | 81 | .Vt hostent |
89 | structure describing a Bluetooth host | | 82 | structure describing a Bluetooth host |
90 | referenced by name or by address, respectively. | | 83 | referenced by name or by address, respectively. |
91 | .Pp | | 84 | .Pp |
92 | The | | 85 | The |
93 | .Fa name | | 86 | .Fa name |
| @@ -184,38 +177,26 @@ The | | | @@ -184,38 +177,26 @@ The |
184 | .Fn bt_aton | | 177 | .Fn bt_aton |
185 | routine interprets the specified character string as a Bluetooth address, | | 178 | routine interprets the specified character string as a Bluetooth address, |
186 | placing the address into the structure provided. | | 179 | placing the address into the structure provided. |
187 | It returns 1 if the string was successfully interpreted, | | 180 | It returns 1 if the string was successfully interpreted, |
188 | or 0 if the string is invalid. | | 181 | or 0 if the string is invalid. |
189 | .Pp | | 182 | .Pp |
190 | The routine | | 183 | The routine |
191 | .Fn bt_ntoa | | 184 | .Fn bt_ntoa |
192 | takes a Bluetooth address and places an | | 185 | takes a Bluetooth address and places an |
193 | .Tn ASCII | | 186 | .Tn ASCII |
194 | string representing the address into the buffer provided. | | 187 | string representing the address into the buffer provided. |
195 | It is up to the caller to ensure that provided buffer has enough space. | | 188 | It is up to the caller to ensure that provided buffer has enough space. |
196 | If no buffer was provided then an internal static buffer will be used. | | 189 | If no buffer was provided then an internal static buffer will be used. |
197 | .Pp | | | |
198 | The | | | |
199 | .Fn bt_devaddr | | | |
200 | function interprets the specified character string as the | | | |
201 | address or device name of a Bluetooth device on the local system, and | | | |
202 | places the device address in the structure provided, if any. | | | |
203 | It returns 1 if the string was successfully interpreted, | | | |
204 | or 0 if the string did not match any local device. The | | | |
205 | .Fn bt_devname | | | |
206 | function takes a Bluetooth device address and copies the local device | | | |
207 | name associated with that address into the buffer provided, if any. | | | |
208 | It returns 1 when the device was found, otherwise 0. | | | |
209 | .Sh FILES | | 190 | .Sh FILES |
210 | .Bl -tag -width ".Pa /etc/bluetooth/hosts" -compact | | 191 | .Bl -tag -width ".Pa /etc/bluetooth/hosts" -compact |
211 | .It Pa /etc/bluetooth/hosts | | 192 | .It Pa /etc/bluetooth/hosts |
212 | .It Pa /etc/bluetooth/protocols | | 193 | .It Pa /etc/bluetooth/protocols |
213 | .El | | 194 | .El |
214 | .Sh EXAMPLES | | 195 | .Sh EXAMPLES |
215 | Print out the hostname associated with a specific BD_ADDR: | | 196 | Print out the hostname associated with a specific BD_ADDR: |
216 | .Bd -literal -offset indent | | 197 | .Bd -literal -offset indent |
217 | const char *bdstr = "00:01:02:03:04:05"; | | 198 | const char *bdstr = "00:01:02:03:04:05"; |
218 | bdaddr_t bd; | | 199 | bdaddr_t bd; |
219 | struct hostent *hp; | | 200 | struct hostent *hp; |
220 | | | 201 | |
221 | if (!bt_aton(bdstr, \*[Am]bd)) | | 202 | if (!bt_aton(bdstr, \*[Am]bd)) |
--- src/lib/libbluetooth/bluetooth.h 2006/09/26 19:18:19 1.3
+++ src/lib/libbluetooth/bluetooth.h 2009/08/03 15:59:42 1.4
| @@ -1,81 +1,165 @@ | | | @@ -1,81 +1,165 @@ |
1 | /* $NetBSD: bluetooth.h,v 1.3 2006/09/26 19:18:19 plunky Exp $ */ | | 1 | /* $NetBSD: bluetooth.h,v 1.4 2009/08/03 15:59:42 plunky Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /*- |
4 | * bluetooth.h | | 4 | * Copyright (c) 2001-2009 Maksim Yevmenkin <m_evmenkin@yahoo.com> |
5 | * | | | |
6 | * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com> | | | |
7 | * All rights reserved. | | 5 | * All rights reserved. |
8 | * | | 6 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 9 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
15 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
16 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
17 | * | | 15 | * |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
29 | * | | 27 | * |
30 | * $Id: bluetooth.h,v 1.3 2006/09/26 19:18:19 plunky Exp $ | | 28 | * $FreeBSD: src/lib/libbluetooth/bluetooth.h,v 1.5 2009/04/22 15:50:03 emax Exp $ |
31 | * $FreeBSD: src/lib/libbluetooth/bluetooth.h,v 1.2 2005/03/17 21:39:44 emax Exp $ | | | |
32 | */ | | 29 | */ |
33 | | | 30 | |
34 | #ifndef _BLUETOOTH_H_ | | 31 | #ifndef _BLUETOOTH_H_ |
35 | #define _BLUETOOTH_H_ | | 32 | #define _BLUETOOTH_H_ |
36 | | | 33 | |
37 | #include <sys/types.h> | | 34 | #include <sys/types.h> |
38 | #include <sys/endian.h> | | 35 | #include <sys/endian.h> |
39 | #include <sys/socket.h> | | 36 | #include <sys/socket.h> |
40 | #include <netdb.h> | | 37 | |
41 | #include <netbt/bluetooth.h> | | 38 | #include <netbt/bluetooth.h> |
42 | #include <netbt/hci.h> | | 39 | #include <netbt/hci.h> |
43 | #include <netbt/l2cap.h> | | 40 | #include <netbt/l2cap.h> |
| | | 41 | |
| | | 42 | #include <netdb.h> |
44 | #include <stdio.h> | | 43 | #include <stdio.h> |
| | | 44 | #include <time.h> |
45 | | | 45 | |
46 | __BEGIN_DECLS | | 46 | __BEGIN_DECLS |
47 | | | 47 | |
48 | /* | | 48 | /* |
49 | * Interface to the outside world | | 49 | * Interface to the outside world |
50 | */ | | 50 | */ |
51 | | | 51 | |
52 | struct hostent * bt_gethostbyname (char const *); | | 52 | struct hostent * bt_gethostbyname (char const *); |
53 | struct hostent * bt_gethostbyaddr (char const *, socklen_t, int); | | 53 | struct hostent * bt_gethostbyaddr (char const *, socklen_t, int); |
54 | struct hostent * bt_gethostent (void); | | 54 | struct hostent * bt_gethostent (void); |
55 | void bt_sethostent (int); | | 55 | void bt_sethostent (int); |
56 | void bt_endhostent (void); | | 56 | void bt_endhostent (void); |
57 | | | 57 | |
58 | struct protoent * bt_getprotobyname (char const *); | | 58 | struct protoent * bt_getprotobyname (char const *); |
59 | struct protoent * bt_getprotobynumber (int); | | 59 | struct protoent * bt_getprotobynumber (int); |
60 | struct protoent * bt_getprotoent (void); | | 60 | struct protoent * bt_getprotoent (void); |
61 | void bt_setprotoent (int); | | 61 | void bt_setprotoent (int); |
62 | void bt_endprotoent (void); | | 62 | void bt_endprotoent (void); |
63 | | | 63 | |
64 | char const * bt_ntoa (bdaddr_t const *, char *); | | 64 | char const * bt_ntoa (bdaddr_t const *, char *); |
65 | int bt_aton (char const *, bdaddr_t *); | | 65 | int bt_aton (char const *, bdaddr_t *); |
66 | | | 66 | |
67 | int bt_devaddr (const char *, bdaddr_t *); | | 67 | /* |
68 | int bt_devname (char *, const bdaddr_t *); | | 68 | * Bluetooth device access API |
| | | 69 | */ |
| | | 70 | |
| | | 71 | struct bt_devinfo { |
| | | 72 | char devname[HCI_DEVNAME_SIZE]; |
| | | 73 | int enabled; /* device is enabled */ |
| | | 74 | |
| | | 75 | /* device information */ |
| | | 76 | bdaddr_t bdaddr; |
| | | 77 | uint8_t features[HCI_FEATURES_SIZE]; |
| | | 78 | uint16_t acl_size; /* max ACL data size */ |
| | | 79 | uint16_t acl_pkts; /* total ACL packet buffers */ |
| | | 80 | uint16_t sco_size; /* max SCO data size */ |
| | | 81 | uint16_t sco_pkts; /* total SCO packet buffers */ |
| | | 82 | |
| | | 83 | /* flow control */ |
| | | 84 | uint16_t cmd_free; /* available CMD packet buffers */ |
| | | 85 | uint16_t acl_free; /* available ACL packet buffers */ |
| | | 86 | uint16_t sco_free; /* available SCO packet buffers */ |
| | | 87 | |
| | | 88 | /* statistics */ |
| | | 89 | uint32_t cmd_sent; |
| | | 90 | uint32_t evnt_recv; |
| | | 91 | uint32_t acl_recv; |
| | | 92 | uint32_t acl_sent; |
| | | 93 | uint32_t sco_recv; |
| | | 94 | uint32_t sco_sent; |
| | | 95 | uint32_t bytes_recv; |
| | | 96 | uint32_t bytes_sent; |
| | | 97 | |
| | | 98 | /* device settings */ |
| | | 99 | uint16_t link_policy_info; |
| | | 100 | uint16_t packet_type_info; |
| | | 101 | uint16_t role_switch_info; |
| | | 102 | }; |
| | | 103 | |
| | | 104 | struct bt_devreq { |
| | | 105 | uint16_t opcode; |
| | | 106 | uint8_t event; |
| | | 107 | void *cparam; |
| | | 108 | size_t clen; |
| | | 109 | void *rparam; |
| | | 110 | size_t rlen; |
| | | 111 | }; |
| | | 112 | |
| | | 113 | struct bt_devfilter { |
| | | 114 | struct hci_filter packet_mask; |
| | | 115 | struct hci_filter event_mask; |
| | | 116 | }; |
| | | 117 | |
| | | 118 | struct bt_devinquiry { |
| | | 119 | bdaddr_t bdaddr; |
| | | 120 | uint8_t pscan_rep_mode; |
| | | 121 | uint8_t pscan_period_mode; |
| | | 122 | uint8_t dev_class[3]; |
| | | 123 | uint16_t clock_offset; |
| | | 124 | int8_t rssi; |
| | | 125 | uint8_t data[240]; |
| | | 126 | }; |
| | | 127 | |
| | | 128 | /* bt_devopen() flags */ |
| | | 129 | #define BTOPT_DIRECTION (1 << 0) |
| | | 130 | #define BTOPT_TIMESTAMP (1 << 1) |
| | | 131 | |
| | | 132 | /* compatibility */ |
| | | 133 | #define bt_devclose(s) close(s) |
| | | 134 | |
| | | 135 | typedef int (bt_devenum_cb_t)(int, const struct bt_devinfo *, void *); |
| | | 136 | |
| | | 137 | int bt_devaddr(const char *, bdaddr_t *); |
| | | 138 | int bt_devname(char *, const bdaddr_t *); |
| | | 139 | int bt_devopen(const char *, int); |
| | | 140 | ssize_t bt_devsend(int, uint16_t, void *, size_t); |
| | | 141 | ssize_t bt_devrecv(int, void *, size_t, time_t); |
| | | 142 | int bt_devreq(int, struct bt_devreq *, time_t); |
| | | 143 | int bt_devfilter(int, const struct bt_devfilter *, struct bt_devfilter *); |
| | | 144 | void bt_devfilter_pkt_set(struct bt_devfilter *, uint8_t); |
| | | 145 | void bt_devfilter_pkt_clr(struct bt_devfilter *, uint8_t); |
| | | 146 | int bt_devfilter_pkt_tst(const struct bt_devfilter *, uint8_t); |
| | | 147 | void bt_devfilter_evt_set(struct bt_devfilter *, uint8_t); |
| | | 148 | void bt_devfilter_evt_clr(struct bt_devfilter *, uint8_t); |
| | | 149 | int bt_devfilter_evt_tst(const struct bt_devfilter *, uint8_t); |
| | | 150 | int bt_devinquiry(const char *, time_t, int, struct bt_devinquiry **); |
| | | 151 | int bt_devinfo(const char *, struct bt_devinfo *); |
| | | 152 | int bt_devenum(bt_devenum_cb_t *, void *); |
69 | | | 153 | |
70 | /* | | 154 | /* |
71 | * bthcid(8) PIN Client API | | 155 | * bthcid(8) PIN Client API |
72 | */ | | 156 | */ |
73 | | | 157 | |
74 | /* Client PIN Request packet */ | | 158 | /* Client PIN Request packet */ |
75 | typedef struct { | | 159 | typedef struct { |
76 | bdaddr_t laddr; /* local address */ | | 160 | bdaddr_t laddr; /* local address */ |
77 | bdaddr_t raddr; /* remote address */ | | 161 | bdaddr_t raddr; /* remote address */ |
78 | uint8_t time; /* validity (seconds) */ | | 162 | uint8_t time; /* validity (seconds) */ |
79 | } __attribute__ ((packed)) bthcid_pin_request_t; | | 163 | } __attribute__ ((packed)) bthcid_pin_request_t; |
80 | | | 164 | |
81 | /* Client PIN Response packet */ | | 165 | /* Client PIN Response packet */ |
.\" $NetBSD: bt_dev.3,v 1.1 2009/08/03 15:59:42 plunky Exp $
.\"
.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd August 3, 2009
.Dt BT_DEV 3
.Os
.Sh NAME
.Nm bt_devaddr,
.Nm bt_devname,
.Nm bt_devenum ,
.Nm bt_devinfo ,
.Nm bt_devopen ,
.Nm bt_devsend ,
.Nm bt_devrecv ,
.Nm bt_devreq ,
.Nm bt_devfilter ,
.Nm bt_devfilter_pkt_set ,
.Nm bt_devfilter_pkt_clr ,
.Nm bt_devfilter_pkt_tst ,
.Nm bt_devfilter_evt_set ,
.Nm bt_devfilter_evt_clr ,
.Nm bt_devfilter_evt_tst ,
.Nm bt_devinquiry ,
.Nd Bluetooth device access routines
.Sh LIBRARY
.Lb libbluetooth
.Sh SYNOPSIS
.In bluetooth.h
.Ft int
.Fn bt_devaddr "const char *name" "bdaddr_t *bdaddr"
.Ft int
.Fn bt_devname "char *name" "const bdaddr_t *bdaddr"
.Ft int
.Fn bt_devenum "int (*cb)(int, const struct bt_devinfo *, void *)" "void *arg"
.Ft int
.Fn bt_devinfo "const char *name" "struct bt_devinfo *info"
.Ft int
.Fn bt_devopen "const char *name" "int flags"
.Ft ssize_t
.Fn bt_devsend "int s" "uint16_t opcode" "void *param" "size_t plen"
.Ft ssize_t
.Fn bt_devrecv "int s" "void *buf" "size_t size" "time_t timeout"
.Ft int
.Fn bt_devreq "int s" "struct bt_devreq *req" "time_t timeout"
.Ft int
.Fn bt_devfilter "int s" "const struct bt_devfilter *new" "struct bt_devfilter *old"
.Ft void
.Fn bt_devfilter_pkt_set "struct bt_devfilter *filter" "uint8_t type"
.Ft void
.Fn bt_devfilter_pkt_clr "struct bt_devfilter *filter" "uint8_t type"
.Ft int
.Fn bt_devfilter_pkt_tst "const struct bt_devfilter *filter" "uint8_t type"
.Ft void
.Fn bt_devfilter_evt_set "struct bt_devfilter *filter" "uint8_t event"
.Ft void
.Fn bt_devfilter_evt_clr "struct bt_devfilter *filter" "uint8_t event"
.Ft int
.Fn bt_devfilter_evt_tst "const struct bt_devfilter *filter" "uint8_t event"
.Ft int
.Fn bt_devinquiry "const char *name" "time_t timeout" "int max_rsp" "struct bt_devinquiry **iip"
.Sh DESCRIPTION
These routines are designed to provide access to locally configured Bluetooth
devices in an operating system independent manner via a socket providing access
to Bluetooth HCI packets.
.Sh FUNCTIONS
.Bl -tag -width 4n
.It Fn bt_devaddr "name" "bdaddr"
Return a Bluetooth device address.
.Fn bt_devaddr
will return 1 if the NUL-terminated
.Fa name
string refers to a Bluetooth device present in the system, otherwise 0.
The name may be given as a device name
.Pq eg Qo ubt0 Qc
or Bluetooth device address
.Pq eg Qo 00:11:22:33:44:55 Qc
and the actual device address will be written to
.Fa bdaddr
if not
.Dv NULL .
.It Fn bt_devname "name" "bdaddr"
Return a Bluetooth device name.
.Fn bt_devname
returns 1 if the
.Fa bdaddr
refers to a Bluetooth device present in the system, otherwise 0.
The
.Fa name
buffer, if given, should have space for at least
.Dv HCI_DEVNAME_SIZE
bytes and the string will be NUL-terminated.
.It Fn bt_devenum "cb" "arg"
Enumerate Bluetooth devices present in the system.
For each device found, the
.Fa cb
function
.Pq if not Dv NULL
will be called with the
.Fa arg
argument provided, a fully populated
.Ft bt_devinfo
structure and, where the device is enabled, a socket handle as returned by
.Fn bt_devopen .
The callback function can halt the enumeration by returning a
non-zero value, and
.Fn bt_devenum
returns the number of successfully enumerated devices.
.It Fn bt_devinfo "name" "info"
Obtain information from a Bluetooth device present in the system.
The
.Fa info
argument is a pointer to a
.Ft bt_devinfo
structure into which information about device
.Fa name
is placed.
The
.Ft bt_devinfo
structure contains at least the following members:
.Bd -literal
char devname[HCI_DEVNAME_SIZE];
int enabled; /* device is enabled */
/* device information */
bdaddr_t bdaddr;
uint8_t features[HCI_FEATURES_SIZE];
uint16_t acl_size; /* max ACL data size */
uint16_t acl_pkts; /* total ACL packet buffers */
uint16_t sco_size; /* max SCO data size */
uint16_t sco_pkts; /* total SCO packet buffers */
/* flow control */
uint16_t cmd_free; /* available CMD packet buffers */
uint16_t acl_free; /* available ACL packet buffers */
uint16_t sco_free; /* available ACL packet buffers */
/* statistics */
uint32_t cmd_sent;
uint32_t evnt_recv;
uint32_t acl_recv;
uint32_t acl_sent;
uint32_t sco_recv;
uint32_t sco_sent;
uint32_t bytes_recv;
uint32_t bytes_sent;
/* device settings */
uint16_t link_policy_info;
uint16_t packet_type_info;
uint16_t role_switch_info;
.Ed
.Lp
Because a Bluetooth device must be enabled in order to retrieve
information, the
.Fa enabled
flag should be tested to be non-zero before relying on further data.
.It Fn bt_devopen "name" "flags"
Return a Bluetooth HCI socket handle bound and connected to the
named Bluetooth device or, if
.Fa name
is
.Dv NULL ,
enabled to receive packets from any device.
The socket should be closed using
.Xr close 2
after use.
Any combination of the following
.Fa flags
may be used to pre-set the socket options:
.Bl -tag -width ".Dv BTOPT_DIRECTION"
.It Dv BTOPT_DIRECTION
Enable control messages on each packet indicating the direction of travel.
.It Dv BTOPT_TIMESTAMP
Enable control messages providing packet timestamps.
.El
.Lp
The default filter on the socket will only allow the HCI Event packets
.Qq Command Status
and
.Qq Command Complete
to be received.
.It Fn bt_devsend "s" "opcode" "param" "plen"
Send an HCI command packet on the socket
.Fa s .
The
.Fa opcode
should be in host byte order and the
.Fa param
and
.Fa plen
arguments can be used to provide command parameter data.
.Fn bt_devsend
will return the number of bytes successfully written.
.It Fn bt_devrecv "s" "buf" "size" "timeout"
Receive a single HCI packet on the socket
.Fa s .
.Fn bt_devrecv
will return the number of bytes successfully received unless the
provided buffer could not contain the entire packet, or if a timeout was
requested with a non-negative
.Fa timeout
value.
.It Fn bt_devreq "s" "req" "timeout"
Make an HCI request on the socket
.Fa s .
The
.Fa req
argument is a pointer to a
.Ft bt_devreq
structure, defined as:
.Bd -literal -offset indent
struct bt_devreq {
uint16_t opcode;
uint8_t event;
void *cparam;
size_t clen;
void *rparam;
size_t rlen;
};
.Ed
.Lp
.Fn bt_devreq
sends an HCI command packet with the given
.Fa opcode
and command parameters of
.Fa clen
bytes at
.Fa cparam
then waits up to
.Fa timeout
seconds for the command to return a
.Qq Command Complete
event.
In the case where the command returns
.Qq Command Status
and an additional event, and where the status indicates
that the command is in progress,
.Fn bt_devreq
will wait for the additional
.Fa event
specified in the request.
If required, any response will be copied into the buffer of
.Fa rlen
bytes at
.Fa rparam ,
and
.Fa rlen
will be adjusted to indicate the number of bytes stored.
.Fn bt_devreq
temporarily modifies the socket filter.
.It Fn bt_devfilter "s" "new" "old"
Update or extract the packet filter on HCI socket
.Fa s .
Filters can be set to indicate packet types
.Pq Commands, Events, ACL and SCO data ,
and individual event IDs.
Where
.Fa old
is given, the currently set filter will be extracted first, then if
.Fa new
is given, the filter will be updated.
.It Fn bt_devfilter_pkt_set "filter" "type"
Set packet
.Fa type
in
.Fa filter .
.It Fn bt_devfilter_pkt_clr "filter" "type"
Clear packet
.Fa type
from
.Fa filter .
.It Fn bt_devfilter_pkt_tst "filter" "type"
Test if
.Fa filter
has packet
.Fa type
set.
.It Fn bt_devfilter_evt_set "filter" "event"
Set
.Fa event
ID in
.Fa filter .
.It Fn bt_devfilter_evt_clr "filter" "event"
Clear
.Fa event
ID from
.Fa filter .
.It Fn bt_devfilter_evt_tst "filter" "event"
Test if
.Fa filter
has
.Fa event
ID set.
.It Fn bt_devinquiry "name" "timeout" "max_rsp" "iip"
Perform a Bluetooth Inquiry using the device
.Fa name ,
or the first available device if NULL is passed.
The inquiry length will be
.Fa timeout
seconds, and the number of responses
.Pq up to a limit of Fa max_rsp
will be returned.
A pointer to an array of
.Ft bt_devinquiry
structures, defined as:
.Bd -literal -offset indent
struct bt_devinquiry {
bdaddr_t bdaddr;
uint8_t pscan_rep_mode;
uint8_t pscan_period_mode;
uint8_t dev_class[3];
uint16_t clock_offset;
int8_t rssi;
uint8_t data[240];
};
.Ed
.Lp
will be stored in the location given by
.Fa iip
and this should be released after use with
.Xr free 3 .
.El
.Sh RETURN VALUES
These Bluetooth device access routines return -1 on failure, and
.Va errno
will be set to indicate the error.
.Sh ERRORS
In addition to errors returned by the standard C library IO functions,
the following errors may be indicated by device access routines.
.Bl -tag -offset indent -width ".Bq Er ETIMEDOUT"
.It Bq Er EINVAL
A provided function argument was not valid.
.It Bq Er EIO
A device response was not properly understood.
.It Bq Er ETIMEDOUT
An operation exceeded the given time limit.
.El
.Sh SEE ALSO
.Xr bluetooth 3
.Sh HISTORY
The Bluetooth device access API was created by
.An Maksim Yevmenkin
and first appeared in
.Fx .
This implementation written for
.Nx
by
.An Iain Hibbert .
/* $NetBSD: bt_dev.c,v 1.1 2009/08/03 15:59:42 plunky Exp $ */
/*-
* Copyright (c) 2009 Iain Hibbert
* Copyright (c) 2009 Maksim Yevmenkin <m_evmenkin@yahoo.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*-
* Copyright (c) 2006 Itronix Inc.
* All rights reserved.
*
* Written by Iain Hibbert for Itronix Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of Itronix Inc. may not be used to endorse
* or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: bt_dev.c,v 1.1 2009/08/03 15:59:42 plunky Exp $");
#include <sys/event.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <bluetooth.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int
bt_devaddr(const char *name, bdaddr_t *addr)
{
struct btreq btr;
bdaddr_t bdaddr;
int s, rv;
if (name == NULL) {
errno = EINVAL;
return 0;
}
if (addr == NULL)
addr = &bdaddr;
if (bt_aton(name, addr))
return bt_devname(NULL, addr);
memset(&btr, 0, sizeof(btr));
strncpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
s = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (s == -1)
return 0;
rv = ioctl(s, SIOCGBTINFO, &btr);
close(s);
if (rv == -1)
return 0;
if ((btr.btr_flags & BTF_UP) == 0) {
errno = ENXIO;
return 0;
}
bdaddr_copy(addr, &btr.btr_bdaddr);
return 1;
}
int
bt_devname(char *name, const bdaddr_t *bdaddr)
{
struct btreq btr;
int s, rv;
if (bdaddr == NULL) {
errno = EINVAL;
return 0;
}
memset(&btr, 0, sizeof(btr));
bdaddr_copy(&btr.btr_bdaddr, bdaddr);
s = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (s == -1)
return 0;
rv = ioctl(s, SIOCGBTINFOA, &btr);
close(s);
if (rv == -1)
return 0;
if ((btr.btr_flags & BTF_UP) == 0) {
errno = ENXIO;
return 0;
}
if (name != NULL)
strlcpy(name, btr.btr_name, HCI_DEVNAME_SIZE);
return 1;
}
int
bt_devopen(const char *name, int options)
{
struct sockaddr_bt sa;
int opt, s;
memset(&sa, 0, sizeof(sa));
sa.bt_len = sizeof(sa);
sa.bt_family = AF_BLUETOOTH;
if (name != NULL && !bt_devaddr(name, &sa.bt_bdaddr))
return -1;
s = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (s == -1)
return -1;
opt = 1;
if ((options & BTOPT_DIRECTION) && setsockopt(s, BTPROTO_HCI,
SO_HCI_DIRECTION, &opt, sizeof(opt)) == -1) {
close(s);
return -1;
}
if ((options & BTOPT_TIMESTAMP) && setsockopt(s, SOL_SOCKET,
SO_TIMESTAMP, &opt, sizeof(opt)) == -1) {
close(s);
return -1;
}
if (bind(s, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
close(s);
return -1;
}
if (name != NULL
&& connect(s, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
close(s);
return -1;
}
return s;
}
ssize_t
bt_devsend(int s, uint16_t opcode, void *param, size_t plen)
{
hci_cmd_hdr_t hdr;
struct iovec iov[2];
ssize_t n;
if (plen > UINT8_MAX
|| (plen == 0 && param != NULL)
|| (plen != 0 && param == NULL)) {
errno = EINVAL;
return -1;
}
hdr.type = HCI_CMD_PKT;
hdr.opcode = htole16(opcode);
hdr.length = (uint8_t)plen;
iov[0].iov_base = &hdr;
iov[0].iov_len = sizeof(hdr);
iov[1].iov_base = param;
iov[1].iov_len = plen;
while ((n = writev(s, iov, __arraycount(iov))) == -1) {
if (errno == EINTR)
continue;
return -1;
}
return n;
}
ssize_t
bt_devrecv(int s, void *buf, size_t size, time_t to)
{
struct kevent ev;
struct timespec ts;
uint8_t *p;
ssize_t n;
int kq;
if (buf == NULL || size == 0) {
errno = EINVAL;
return -1;
}
if (to >= 0) { /* timeout is optional */
kq = kqueue();
if (kq == -1)
return -1;
EV_SET(&ev, s, EVFILT_READ, EV_ADD, 0, 0, 0);
ts.tv_sec = to;
ts.tv_nsec = 0;
while (kevent(kq, &ev, 1, &ev, 1, &ts) == -1) {
if (errno == EINTR)
continue;
close(kq);
return -1;
}
close(kq);
if (ev.data == 0) {
errno = ETIMEDOUT;
return -1;
}
}
while ((n = recv(s, buf, size, 0)) == -1) {
if (errno == EINTR)
continue;
return -1;
}
if (n == 0)
return 0;
p = buf;
switch (p[0]) { /* validate that they get complete packets */
case HCI_CMD_PKT:
if (sizeof(hci_cmd_hdr_t) > (size_t)n
|| sizeof(hci_cmd_hdr_t) + p[3] != (size_t)n)
break;
return n;
case HCI_ACL_DATA_PKT:
if (sizeof(hci_acldata_hdr_t) > (size_t)n
|| sizeof(hci_acldata_hdr_t) + le16dec(p + 3) != (size_t)n)
break;
return n;
case HCI_SCO_DATA_PKT:
if (sizeof(hci_scodata_hdr_t) > (size_t)n
|| sizeof(hci_scodata_hdr_t) + p[3] != (size_t)n)
break;
return n;
case HCI_EVENT_PKT:
if (sizeof(hci_event_hdr_t) > (size_t)n
|| sizeof(hci_event_hdr_t) + p[2] != (size_t)n)
break;
return n;
default:
break;
}
errno = EIO;
return -1;
}
/*
* Internal handler for bt_devreq(), do the actual request.
*/
static int
bt__devreq(int s, struct bt_devreq *req, time_t t_end)
{
uint8_t buf[HCI_EVENT_PKT_SIZE], *p;
hci_event_hdr_t ev;
hci_command_status_ep cs;
hci_command_compl_ep cc;
time_t to;
ssize_t n;
n = bt_devsend(s, req->opcode, req->cparam, req->clen);
if (n == -1)
return errno;
for (;;) {
to = t_end - time(NULL);
if (to < 0)
return ETIMEDOUT;
p = buf;
n = bt_devrecv(s, buf, sizeof(buf), to);
if (n == -1)
return errno;
if (sizeof(ev) > (size_t)n || p[0] != HCI_EVENT_PKT)
return EIO;
memcpy(&ev, p, sizeof(ev));
p += sizeof(ev);
n -= sizeof(ev);
if (ev.event == req->event)
break;
if (ev.event == HCI_EVENT_COMMAND_STATUS) {
if (sizeof(cs) > (size_t)n)
return EIO;
memcpy(&cs, p, sizeof(cs));
p += sizeof(cs);
n -= sizeof(cs);
if (le16toh(cs.opcode) == req->opcode) {
if (cs.status != 0)
return EIO;
if (req->event == 0)
break;
}
continue;
}
if (ev.event == HCI_EVENT_COMMAND_COMPL) {
if (sizeof(cc) > (size_t)n)
return EIO;
memcpy(&cc, p, sizeof(cc));
p += sizeof(cc);
n -= sizeof(cc);
if (le16toh(cc.opcode) == req->opcode)
break;
continue;
}
}
/* copy out response data */
if (req->rlen >= (size_t)n) {
req->rlen = n;
memcpy(req->rparam, p, req->rlen);
} else if (req->rlen > 0)
return EIO;
return 0;
}
int
bt_devreq(int s, struct bt_devreq *req, time_t to)
{
struct bt_devfilter new, old;
int error;
if (req == NULL || to < 0
|| (req->rlen == 0 && req->rparam != NULL)
|| (req->rlen != 0 && req->rparam == NULL)) {
errno = EINVAL;
return -1;
}
memset(&new, 0, sizeof(new));
bt_devfilter_pkt_set(&new, HCI_EVENT_PKT);
bt_devfilter_evt_set(&new, HCI_EVENT_COMMAND_COMPL);
bt_devfilter_evt_set(&new, HCI_EVENT_COMMAND_STATUS);
if (req->event != 0)
bt_devfilter_evt_set(&new, req->event);
if (bt_devfilter(s, &new, &old) == -1)
return -1;
error = bt__devreq(s, req, to + time(NULL));
(void)bt_devfilter(s, &old, NULL);
if (error != 0) {
errno = error;
return -1;
}
return 0;
}
int
bt_devfilter(int s, const struct bt_devfilter *new, struct bt_devfilter *old)
{
socklen_t len;
if (new == NULL && old == NULL) {
errno = EINVAL;
return -1;
}
len = sizeof(struct hci_filter);
if (old != NULL) {
if (getsockopt(s, BTPROTO_HCI,
SO_HCI_PKT_FILTER, &old->packet_mask, &len) == -1
|| len != sizeof(struct hci_filter))
return -1;
if (getsockopt(s, BTPROTO_HCI,
SO_HCI_EVT_FILTER, &old->event_mask, &len) == -1
|| len != sizeof(struct hci_filter))
return -1;
}
if (new != NULL) {
if (setsockopt(s, BTPROTO_HCI,
SO_HCI_PKT_FILTER, &new->packet_mask, len) == -1)
return -1;
if (setsockopt(s, BTPROTO_HCI,
SO_HCI_EVT_FILTER, &new->event_mask, len) == -1)
return -1;
}
return 0;
}
void
bt_devfilter_pkt_set(struct bt_devfilter *filter, uint8_t type)
{
hci_filter_set(type, &filter->packet_mask);
}
void
bt_devfilter_pkt_clr(struct bt_devfilter *filter, uint8_t type)
{
hci_filter_clr(type, &filter->packet_mask);
}
int
bt_devfilter_pkt_tst(const struct bt_devfilter *filter, uint8_t type)
{
return hci_filter_test(type, &filter->packet_mask);
}
void
bt_devfilter_evt_set(struct bt_devfilter *filter, uint8_t event)
{
hci_filter_set(event, &filter->event_mask);
}
void
bt_devfilter_evt_clr(struct bt_devfilter *filter, uint8_t event)
{
hci_filter_clr(event, &filter->event_mask);
}
int
bt_devfilter_evt_tst(const struct bt_devfilter *filter, uint8_t event)
{
return hci_filter_test(event, &filter->event_mask);
}
/*
* Internal function used by bt_devinquiry to find the first
* active device.
*/
static int
bt__devany_cb(int s, const struct bt_devinfo *info, void *arg)
{
if ((info->enabled)) {
strlcpy(arg, info->devname, HCI_DEVNAME_SIZE + 1);
return 1;
}
return 0;
}
/*
* Internal function used by bt_devinquiry to insert inquiry
* results to an array. Make sure that a bdaddr only appears
* once in the list and always use the latest result.
*/
static void
bt__devresult(struct bt_devinquiry *ii, int *count, int max_count,
bdaddr_t *ba, uint8_t psrm, uint8_t pspm, uint8_t *cl, uint16_t co,
int8_t rssi, uint8_t *data)
{
int n;
for (n = 0; ; n++, ii++) {
if (n == *count) {
if (*count == max_count)
return;
(*count)++;
break;
}
if (bdaddr_same(&ii->bdaddr, ba))
break;
}
bdaddr_copy(&ii->bdaddr, ba);
ii->pscan_rep_mode = psrm;
ii->pscan_period_mode = pspm;
ii->clock_offset = le16toh(co);
ii->rssi = rssi;
if (cl != NULL)
memcpy(ii->dev_class, cl, HCI_CLASS_SIZE);
if (data != NULL)
memcpy(ii->data, data, 240);
}
int
bt_devinquiry(const char *name, time_t to, int max_rsp,
struct bt_devinquiry **iip)
{
uint8_t buf[HCI_EVENT_PKT_SIZE], *p;
struct bt_devfilter f;
hci_event_hdr_t ev;
hci_command_status_ep sp;
hci_inquiry_cp cp;
hci_inquiry_result_ep ip;
hci_inquiry_response ir;
hci_rssi_result_ep rp;
hci_rssi_response rr;
hci_extended_result_ep ep;
struct bt_devinquiry *ii;
int count, i, s;
time_t t_end;
ssize_t n;
if (iip == NULL) {
errno = EINVAL;
return -1;
}
if (name == NULL) {
if (bt_devenum(bt__devany_cb, buf) == -1)
return -1;
name = (const char *)buf;
}
s = bt_devopen(name, 0);
if (s == -1)
return -1;
memset(&f, 0, sizeof(f));
bt_devfilter_pkt_set(&f, HCI_EVENT_PKT);
bt_devfilter_evt_set(&f, HCI_EVENT_COMMAND_STATUS);
bt_devfilter_evt_set(&f, HCI_EVENT_INQUIRY_COMPL);
bt_devfilter_evt_set(&f, HCI_EVENT_INQUIRY_RESULT);
bt_devfilter_evt_set(&f, HCI_EVENT_RSSI_RESULT);
bt_devfilter_evt_set(&f, HCI_EVENT_EXTENDED_RESULT);
if (bt_devfilter(s, &f, NULL) == -1) {
close(s);
return -1;
}
/*
* silently adjust number of reponses to fit in uint8_t
*/
if (max_rsp < 1)
max_rsp = 8;
else if (max_rsp > UINT8_MAX)
max_rsp = UINT8_MAX;
ii = calloc((size_t)max_rsp, sizeof(struct bt_devinquiry));
if (ii == NULL) {
close(s);
return -1;
}
/*
* silently adjust timeout value so that inquiry_length
* falls into the range 0x01->0x30 (unit is 1.28 seconds)
*/
if (to < 1)
to = 5;
else if (to == 1)
to = 2;
else if (to > 62)
to = 62;
/* General Inquiry LAP is 0x9e8b33 */
cp.lap[0] = 0x33;
cp.lap[1] = 0x8b;
cp.lap[2] = 0x9e;
cp.inquiry_length = (uint8_t)(to * 100 / 128);
cp.num_responses = (uint8_t)max_rsp;
if (bt_devsend(s, HCI_CMD_INQUIRY, &cp, sizeof(cp)) == -1)
goto fail;
count = 0;
for (t_end = time(NULL) + to + 1; to > 0; to = t_end - time(NULL)) {
p = buf;
n = bt_devrecv(s, buf, sizeof(buf), to);
if (n == -1)
goto fail;
if (sizeof(ev) > (size_t)n) {
errno = EIO;
goto fail;
}
memcpy(&ev, p, sizeof(ev));
p += sizeof(ev);
n -= sizeof(ev);
switch (ev.event) {
case HCI_EVENT_COMMAND_STATUS:
if (sizeof(sp) > (size_t)n)
break;
memcpy(&sp, p, sizeof(sp));
if (le16toh(sp.opcode) != HCI_CMD_INQUIRY
|| sp.status == 0)
break;
errno = EIO;
goto fail;
case HCI_EVENT_INQUIRY_COMPL:
close(s);
*iip = ii;
return count;
case HCI_EVENT_INQUIRY_RESULT:
if (sizeof(ip) > (size_t)n)
break;
memcpy(&ip, p, sizeof(ip));
p += sizeof(ip);
n -= sizeof(ip);
if (sizeof(ir) * ip.num_responses != (size_t)n)
break;
for (i = 0; i < ip.num_responses; i++) {
memcpy(&ir, p, sizeof(ir));
p += sizeof(ir);
bt__devresult(ii, &count, max_rsp,
&ir.bdaddr,
ir.page_scan_rep_mode,
ir.page_scan_period_mode,
ir.uclass,
ir.clock_offset,
0, /* rssi */
NULL); /* extended data */
}
break;
case HCI_EVENT_RSSI_RESULT:
if (sizeof(rp) > (size_t)n)
break;
memcpy(&rp, p, sizeof(rp));
p += sizeof(rp);
n -= sizeof(rp);
if (sizeof(rr) * rp.num_responses != (size_t)n)
break;
for (i = 0; i < rp.num_responses; i++) {
memcpy(&rr, p, sizeof(rr));
p += sizeof(rr);
bt__devresult(ii, &count, max_rsp,
&rr.bdaddr,
rr.page_scan_rep_mode,
0, /* page scan period mode */
rr.uclass,
rr.clock_offset,
rr.rssi,
NULL); /* extended data */
}
break;
case HCI_EVENT_EXTENDED_RESULT:
if (sizeof(ep) != (size_t)n)
break;
memcpy(&ep, p, sizeof(ep));
if (ep.num_responses != 1)
break;
bt__devresult(ii, &count, max_rsp,
&ep.bdaddr,
ep.page_scan_rep_mode,
0, /* page scan period mode */
ep.uclass,
ep.clock_offset,
ep.rssi,
ep.response);
break;
default:
break;
}
}
errno = ETIMEDOUT;
fail:
free(ii);
close(s);
return -1;
}
/*
* Internal version of bt_devinfo. Fill in the devinfo structure
* with the socket handle provided. If the device is present and
* active, the socket will be left connected to the device.
*/
static int
bt__devinfo(int s, const char *name, struct bt_devinfo *info)
{
struct sockaddr_bt sa;
struct bt_devreq req;
struct btreq btr;
hci_read_buffer_size_rp bp;
hci_read_local_features_rp fp;
memset(&btr, 0, sizeof(btr));
strncpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
if (ioctl(s, SIOCGBTINFO, &btr) == -1)
return -1;
memset(info, 0, sizeof(struct bt_devinfo));
memcpy(info->devname, btr.btr_name, HCI_DEVNAME_SIZE);
bdaddr_copy(&info->bdaddr, &btr.btr_bdaddr);
info->enabled = ((btr.btr_flags & BTF_UP) ? 1 : 0);
info->sco_size = btr.btr_sco_mtu;
info->acl_size = btr.btr_acl_mtu;
info->cmd_free = btr.btr_num_cmd;
info->sco_free = btr.btr_num_sco;
info->acl_free = btr.btr_num_acl;
info->link_policy_info = btr.btr_link_policy;
info->packet_type_info = btr.btr_packet_type;
if (ioctl(s, SIOCGBTSTATS, &btr) == -1)
return -1;
info->cmd_sent = btr.btr_stats.cmd_tx;
info->evnt_recv = btr.btr_stats.evt_rx;
info->acl_recv = btr.btr_stats.acl_rx;
info->acl_sent = btr.btr_stats.acl_tx;
info->sco_recv = btr.btr_stats.sco_rx;
info->sco_sent = btr.btr_stats.sco_tx;
info->bytes_recv = btr.btr_stats.byte_rx;
info->bytes_sent = btr.btr_stats.byte_tx;
/* can only get the rest from enabled devices */
if ((info->enabled) == 0)
return 0;
memset(&sa, 0, sizeof(sa));
sa.bt_len = sizeof(sa);
sa.bt_family = AF_BLUETOOTH;
bdaddr_copy(&sa.bt_bdaddr, &info->bdaddr);
if (bind(s, (struct sockaddr *)&sa, sizeof(sa)) == -1
|| connect(s, (struct sockaddr *)&sa, sizeof(sa)) == -1)
return -1;
memset(&req, 0, sizeof(req));
req.opcode = HCI_CMD_READ_BUFFER_SIZE;
req.rparam = &bp;
req.rlen = sizeof(bp);
if (bt_devreq(s, &req, 5) == -1)
return -1;
info->acl_pkts = bp.max_acl_size;
info->sco_pkts = bp.max_sco_size;
memset(&req, 0, sizeof(req));
req.opcode = HCI_CMD_READ_LOCAL_FEATURES;
req.rparam = &fp;
req.rlen = sizeof(fp);
if (bt_devreq(s, &req, 5) == -1)
return -1;
memcpy(info->features, fp.features, HCI_FEATURES_SIZE);
return 0;
}
int
bt_devinfo(const char *name, struct bt_devinfo *info)
{
int rv, s;
if (name == NULL || info == NULL) {
errno = EINVAL;
return -1;
}
s = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (s == -1)
return -1;
rv = bt__devinfo(s, name, info);
close(s);
return rv;
}
int
bt_devenum(bt_devenum_cb_t cb, void *arg)
{
struct btreq btr;
struct bt_devinfo info;
int count, fd, rv, s;
s = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (s == -1)
return -1;
memset(&btr, 0, sizeof(btr));
count = 0;
while (ioctl(s, SIOCNBTINFO, &btr) != -1) {
count++;
if (cb == NULL)
continue;
fd = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (fd == -1) {
close(s);
return -1;
}
if (bt__devinfo(fd, btr.btr_name, &info) == -1) {
close(fd);
close(s);
return -1;
}
rv = (*cb)(fd, &info, arg);
close(fd);
if (rv != 0)
break;
}
close(s);
return count;
}