Disable IPSP feature
[platform/upstream/bluez.git] / emulator / hciemu.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2012-2014  Intel Corporation. All rights reserved.
6  *
7  *
8  *  This library is free software; you can redistribute it and/or
9  *  modify it under the terms of the GNU Lesser General Public
10  *  License as published by the Free Software Foundation; either
11  *  version 2.1 of the License, or (at your option) any later version.
12  *
13  *  This library is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  *  Lesser General Public License for more details.
17  *
18  *  You should have received a copy of the GNU Lesser General Public
19  *  License along with this library; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 #include <stdbool.h>
25 #include <stdint.h>
26
27 struct hciemu;
28
29 enum hciemu_type {
30         HCIEMU_TYPE_BREDRLE,
31         HCIEMU_TYPE_BREDR,
32         HCIEMU_TYPE_LE,
33 };
34
35 enum hciemu_hook_type {
36         HCIEMU_HOOK_PRE_CMD,
37         HCIEMU_HOOK_POST_CMD,
38         HCIEMU_HOOK_PRE_EVT,
39         HCIEMU_HOOK_POST_EVT,
40 };
41
42 struct hciemu *hciemu_new(enum hciemu_type type);
43
44 struct hciemu *hciemu_ref(struct hciemu *hciemu);
45 void hciemu_unref(struct hciemu *hciemu);
46
47 struct bthost *hciemu_client_get_host(struct hciemu *hciemu);
48
49 const char *hciemu_get_address(struct hciemu *hciemu);
50 uint8_t *hciemu_get_features(struct hciemu *hciemu);
51
52 const uint8_t *hciemu_get_master_bdaddr(struct hciemu *hciemu);
53 const uint8_t *hciemu_get_client_bdaddr(struct hciemu *hciemu);
54
55 typedef void (*hciemu_command_func_t)(uint16_t opcode, const void *data,
56                                                 uint8_t len, void *user_data);
57
58 typedef bool (*hciemu_hook_func_t)(const void *data, uint16_t len,
59                                                         void *user_data);
60
61 bool hciemu_add_master_post_command_hook(struct hciemu *hciemu,
62                         hciemu_command_func_t function, void *user_data);
63
64 int hciemu_add_hook(struct hciemu *hciemu, enum hciemu_hook_type type,
65                                 uint16_t opcode, hciemu_hook_func_t function,
66                                 void *user_data);
67
68 bool hciemu_del_hook(struct hciemu *hciemu, enum hciemu_hook_type type,
69                                                         uint16_t opcode);