aboutsummaryrefslogtreecommitdiff
path: root/lib/libbluetooth/bluetooth.h
diff options
context:
space:
mode:
authorMaksim Yevmenkin <emax@FreeBSD.org>2008-08-13 19:35:31 +0000
committerMaksim Yevmenkin <emax@FreeBSD.org>2008-08-13 19:35:31 +0000
commit55034c7d1d465a5f79c2f80cbced395be852e2ee (patch)
treec236468ebf274a689bf171a115862588b700bb15 /lib/libbluetooth/bluetooth.h
parentf40611e24f47a5ed6ad7a8320e8d2d6eace83b64 (diff)
downloadsrc-55034c7d1d465a5f79c2f80cbced395be852e2ee.tar.gz
src-55034c7d1d465a5f79c2f80cbced395be852e2ee.zip
Import handy shorthand Bluetooth address (BD_ADDR) utility functions
from NetBSD and document them. Obtained from: NetBSD MFC after: 1 week
Notes
Notes: svn path=/head/; revision=181698
Diffstat (limited to 'lib/libbluetooth/bluetooth.h')
-rw-r--r--lib/libbluetooth/bluetooth.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/libbluetooth/bluetooth.h b/lib/libbluetooth/bluetooth.h
index d9797876e790..0b62466e8ccd 100644
--- a/lib/libbluetooth/bluetooth.h
+++ b/lib/libbluetooth/bluetooth.h
@@ -72,6 +72,36 @@ void bt_endprotoent (void);
char const * bt_ntoa (bdaddr_t const *ba, char *str);
int bt_aton (char const *str, bdaddr_t *ba);
+/*
+ * bdaddr utility functions (from NetBSD)
+ */
+
+static __inline int
+bdaddr_same(const bdaddr_t *a, const bdaddr_t *b)
+{
+ return (a->b[0] == b->b[0] && a->b[1] == b->b[1] &&
+ a->b[2] == b->b[2] && a->b[3] == b->b[3] &&
+ a->b[4] == b->b[4] && a->b[5] == b->b[5]);
+}
+
+static __inline int
+bdaddr_any(const bdaddr_t *a)
+{
+ return (a->b[0] == 0 && a->b[1] == 0 && a->b[2] == 0 &&
+ a->b[3] == 0 && a->b[4] == 0 && a->b[5] == 0);
+}
+
+static __inline void
+bdaddr_copy(bdaddr_t *d, const bdaddr_t *s)
+{
+ d->b[0] = s->b[0];
+ d->b[1] = s->b[1];
+ d->b[2] = s->b[2];
+ d->b[3] = s->b[3];
+ d->b[4] = s->b[4];
+ d->b[5] = s->b[5];
+}
+
__END_DECLS
#endif /* ndef _BLUETOOTH_H_ */