aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bluetooth/bluetooth.h
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-01-20 14:27:18 +0200
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-01-23 01:58:08 -0200
commit679efe2b4fcbe575bc4c94c410039e35c169bfb6 (patch)
tree7a7f022a3f62e38398cd2cedca276e1701aeeb5b /include/net/bluetooth/bluetooth.h
parentBluetooth: Check for valid key->authenticated value for LTKs (diff)
downloadlinux-dev-679efe2b4fcbe575bc4c94c410039e35c169bfb6.tar.xz
linux-dev-679efe2b4fcbe575bc4c94c410039e35c169bfb6.zip
Bluetooth: Add helper functions for testing bdaddr types
This patch adds two helper functions to test for valid bdaddr type values. These will be particularely useful in the mgmt code to check that user space has passed valid values to the kernel. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'include/net/bluetooth/bluetooth.h')
-rw-r--r--include/net/bluetooth/bluetooth.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 2554b3f5222a..9531beee09b5 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -166,6 +166,29 @@ typedef struct {
#define BDADDR_LE_PUBLIC 0x01
#define BDADDR_LE_RANDOM 0x02
+static inline bool bdaddr_type_is_valid(__u8 type)
+{
+ switch (type) {
+ case BDADDR_BREDR:
+ case BDADDR_LE_PUBLIC:
+ case BDADDR_LE_RANDOM:
+ return true;
+ }
+
+ return false;
+}
+
+static inline bool bdaddr_type_is_le(__u8 type)
+{
+ switch (type) {
+ case BDADDR_LE_PUBLIC:
+ case BDADDR_LE_RANDOM:
+ return true;
+ }
+
+ return false;
+}
+
#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0} })
#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} })