summaryrefslogtreecommitdiff
path: root/emulator/btdev.h
diff options
context:
space:
mode:
authorEder Ruiz Maria <eder.ruiz@openbossa.org>2013-07-20 20:17:13 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-07-24 09:02:52 -0700
commit37199df506f43cea3cd3ed920d6141e7a9174940 (patch)
tree0f5dd89c542dfc71c0a583fb33afe21dee794eaf /emulator/btdev.h
parentd1abf2b7d89b4c1c92b09d5acd59e7a64af06bbd (diff)
downloadbluez-37199df506f43cea3cd3ed920d6141e7a9174940.tar.gz
emulator: Add support for pre/post command/event hooks
Now who use emulator can add hooks to manipulate hci packets before and after process commands and send events.
Diffstat (limited to 'emulator/btdev.h')
-rw-r--r--emulator/btdev.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/emulator/btdev.h b/emulator/btdev.h
index 9fb023cb1..085093f40 100644
--- a/emulator/btdev.h
+++ b/emulator/btdev.h
@@ -23,6 +23,7 @@
*/
#include <stdint.h>
+#include <stdbool.h>
#define BTDEV_RESPONSE_DEFAULT 0
#define BTDEV_RESPONSE_COMMAND_STATUS 1
@@ -53,6 +54,9 @@ typedef void (*btdev_command_func) (uint16_t opcode,
typedef void (*btdev_send_func) (const void *data, uint16_t len,
void *user_data);
+typedef bool (*btdev_hook_func) (const void *data, uint16_t len,
+ void *user_data);
+
enum btdev_type {
BTDEV_TYPE_BREDRLE,
BTDEV_TYPE_BREDR,
@@ -60,6 +64,13 @@ enum btdev_type {
BTDEV_TYPE_AMP,
};
+enum btdev_hook_type {
+ BTDEV_HOOK_PRE_CMD,
+ BTDEV_HOOK_POST_CMD,
+ BTDEV_HOOK_PRE_EVT,
+ BTDEV_HOOK_POST_EVT,
+};
+
struct btdev;
struct btdev *btdev_create(enum btdev_type type, uint16_t id);
@@ -74,3 +85,7 @@ void btdev_set_send_handler(struct btdev *btdev, btdev_send_func handler,
void *user_data);
void btdev_receive_h4(struct btdev *btdev, const void *data, uint16_t len);
+
+int btdev_add_hook(struct btdev *btdev, enum btdev_hook_type type,
+ uint16_t opcode, btdev_hook_func handler,
+ void *user_data);