OSDN Git Service

HCI layer cleanup
[android-x86/system-bt.git] / hci / include / btsnoop.h
index 83c8107..8c21cd1 100644 (file)
@@ -1,10 +1,38 @@
+/******************************************************************************
+ *
+ *  Copyright (C) 2014 Google, Inc.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at:
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ ******************************************************************************/
+
 #pragma once
 
 #include <stdbool.h>
 
-#include "bt_hci_bdroid.h"
+#include "bt_types.h"
+
+typedef struct btsnoop_t {
+  // Open btsnoop, and dump captured packets to the file pointed to by |path|.
+  void (*open)(const char *path);
+
+  // Close btsnoop, so no more packets are captured.
+  void (*close)(void);
 
-void btsnoop_open(const char *p_path, const bool save_existing);
-void btsnoop_close(void);
+  // Capture |packet| and dump it to the btsnoop logs. If |is_received| is
+  // true, the packet is marked as incoming. Otherwise, the packet is marked
+  // as outgoing.
+  void (*capture)(const BT_HDR *packet, bool is_received);
+} btsnoop_t;
 
-void btsnoop_capture(const HC_BT_HDR *p_buf, bool is_rcvd);
+const btsnoop_t *btsnoop_get_interface();