From: Archie Pusaka Date: Wed, 15 Sep 2021 08:31:58 +0000 (+0800) Subject: emulator: Inclusive language changes X-Git-Tag: submit/tizen/20220313.220938~163 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf058589262ef0f0e9e4a594e24763e7df8a5cd4;p=platform%2Fupstream%2Fbluez.git emulator: Inclusive language changes BT core spec 5.3 promotes the usage of inclusive languages. This CL replaces some terms with the more appropriate counterparts, such as "central", "peripheral", and "accept list". Signed-off-by: Marcel Holtmann Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- diff --git a/android/tester-main.c b/android/tester-main.c index 40302ea..6ebec86 100755 --- a/android/tester-main.c +++ b/android/tester-main.c @@ -2784,7 +2784,7 @@ void emu_remote_connect_hci_action(void) struct step *step = g_new0(struct step, 1); const uint8_t *master_addr; - master_addr = hciemu_get_master_bdaddr(data->hciemu); + master_addr = hciemu_get_central_bdaddr(data->hciemu); tester_print("Trying to connect hci"); diff --git a/emulator/btdev.c b/emulator/btdev.c index 343c065..148e32b 100755 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -33,7 +33,7 @@ #include "monitor/bt.h" #include "btdev.h" -#define WL_SIZE 16 +#define AL_SIZE 16 #define RL_SIZE 16 #define CIS_SIZE 3 @@ -61,7 +61,7 @@ struct btdev_conn { struct btdev_conn *link; }; -struct btdev_wl { +struct btdev_al { uint8_t type; bdaddr_t addr; }; @@ -191,7 +191,7 @@ struct btdev { } __attribute__ ((packed)) le_cig; uint8_t le_iso_path[2]; - struct btdev_wl le_wl[WL_SIZE]; + struct btdev_al le_al[AL_SIZE]; struct btdev_rl le_rl[RL_SIZE]; uint8_t le_rl_enable; uint16_t le_rl_timeout; @@ -445,18 +445,18 @@ static int cmd_set_event_mask(struct btdev *dev, const void *data, uint8_t len) return 0; } -static void wl_reset(struct btdev_wl *wl) +static void al_reset(struct btdev_al *al) { - wl->type = 0xff; - bacpy(&wl->addr, BDADDR_ANY); + al->type = 0xff; + bacpy(&al->addr, BDADDR_ANY); } -static void wl_clear(struct btdev *dev) +static void al_clear(struct btdev *dev) { int i; - for (i = 0; i < WL_SIZE; i++) - wl_reset(&dev->le_wl[i]); + for (i = 0; i < AL_SIZE; i++) + al_reset(&dev->le_al[i]); } static void rl_reset(struct btdev_rl *rl) @@ -484,7 +484,7 @@ static void btdev_reset(struct btdev *btdev) btdev->le_scan_enable = 0x00; btdev->le_adv_enable = 0x00; - wl_clear(btdev); + al_clear(btdev); rl_clear(btdev); } @@ -3566,25 +3566,25 @@ static int cmd_le_create_conn_complete(struct btdev *dev, const void *data, return 0; } -static int cmd_read_wl_size(struct btdev *dev, const void *data, uint8_t len) +static int cmd_read_al_size(struct btdev *dev, const void *data, uint8_t len) { struct bt_hci_rsp_le_read_accept_list_size rsp; rsp.status = BT_HCI_ERR_SUCCESS; - rsp.size = WL_SIZE; + rsp.size = AL_SIZE; cmd_complete(dev, BT_HCI_CMD_LE_READ_ACCEPT_LIST_SIZE, &rsp, sizeof(rsp)); return 0; } -static bool wl_can_change(struct btdev *dev) +static bool al_can_change(struct btdev *dev) { - /* filter policy uses the White List and advertising is enable. */ + /* filter policy uses the Accept List and advertising is enable. */ if (dev->le_adv_enable && dev->le_adv_filter_policy) return false; - /* scanning filter policy uses the White List and scanning is enabled */ + /* scan filter policy uses the Accept List and scanning is enabled */ if (dev->le_scan_enable) { switch (dev->le_scan_filter_policy) { case 0x00: @@ -3601,23 +3601,23 @@ static bool wl_can_change(struct btdev *dev) return true; } -static int cmd_wl_clear(struct btdev *dev, const void *data, uint8_t len) +static int cmd_al_clear(struct btdev *dev, const void *data, uint8_t len) { uint8_t status; /* This command shall not be used when: - * • any advertising filter policy uses the White List and advertising - * is enabled, - * • the scanning filter policy uses the White List and scanning is + * • any advertising filter policy uses the Accept List and + * advertising is enabled, + * • the scanning filter policy uses the Accept List and scanning is * enabled, or - * • the initiator filter policy uses the White List and an + * • the initiator filter policy uses the Accept List and an * HCI_LE_Create_Connection or HCI_LE_Extended_Create_Connection * command is outstanding. */ - if (!wl_can_change(dev)) + if (!al_can_change(dev)) return -EPERM; - wl_clear(dev); + al_clear(dev); status = BT_HCI_ERR_SUCCESS; cmd_complete(dev, BT_HCI_CMD_LE_CLEAR_ACCEPT_LIST, &status, @@ -3626,16 +3626,16 @@ static int cmd_wl_clear(struct btdev *dev, const void *data, uint8_t len) return 0; } -#define WL_ADDR_EQUAL(_wl, _type, _addr) \ - (_wl->type == _type && !bacmp(&_wl->addr, (bdaddr_t *)_addr)) +#define AL_ADDR_EQUAL(_al, _type, _addr) \ + (_al->type == _type && !bacmp(&_al->addr, (bdaddr_t *)_addr)) -static void wl_add(struct btdev_wl *wl, uint8_t type, bdaddr_t *addr) +static void al_add(struct btdev_al *al, uint8_t type, bdaddr_t *addr) { - wl->type = type; - bacpy(&wl->addr, addr); + al->type = type; + bacpy(&al->addr, addr); } -static int cmd_add_wl(struct btdev *dev, const void *data, uint8_t len) +static int cmd_add_al(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_add_to_accept_list *cmd = data; uint8_t status; @@ -3643,28 +3643,28 @@ static int cmd_add_wl(struct btdev *dev, const void *data, uint8_t len) int i, pos = -1; /* This command shall not be used when: - * • any advertising filter policy uses the White List and advertising - * is enabled, - * • the scanning filter policy uses the White List and scanning is + * • any advertising filter policy uses the Accept List and + * advertising is enabled, + * • the scanning filter policy uses the Accept List and scanning is * enabled, or - * • the initiator filter policy uses the White List and an + * • the initiator filter policy uses the Accept List and an * HCI_LE_Create_Connection or HCI_LE_Extended_Create_Connection * command is outstanding. */ - if (!wl_can_change(dev)) + if (!al_can_change(dev)) return -EPERM; /* Valid range for address type is 0x00 to 0x01 */ if (cmd->addr_type > 0x01) return -EINVAL; - for (i = 0; i < WL_SIZE; i++) { - struct btdev_wl *wl = &dev->le_wl[i]; + for (i = 0; i < AL_SIZE; i++) { + struct btdev_al *al = &dev->le_al[i]; - if (WL_ADDR_EQUAL(wl, cmd->addr_type, &cmd->addr)) { + if (AL_ADDR_EQUAL(al, cmd->addr_type, &cmd->addr)) { exists = true; break; - } else if (pos < 0 && wl->type == 0xff) + } else if (pos < 0 && al->type == 0xff) pos = i; } @@ -3677,7 +3677,7 @@ static int cmd_add_wl(struct btdev *dev, const void *data, uint8_t len) return 0; } - wl_add(&dev->le_wl[pos], cmd->addr_type, (bdaddr_t *)&cmd->addr); + al_add(&dev->le_al[pos], cmd->addr_type, (bdaddr_t *)&cmd->addr); status = BT_HCI_ERR_SUCCESS; cmd_complete(dev, BT_HCI_CMD_LE_ADD_TO_ACCEPT_LIST, @@ -3686,7 +3686,7 @@ static int cmd_add_wl(struct btdev *dev, const void *data, uint8_t len) return 0; } -static int cmd_remove_wl(struct btdev *dev, const void *data, uint8_t len) +static int cmd_remove_al(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_remove_from_accept_list *cmd = data; uint8_t status; @@ -3694,37 +3694,37 @@ static int cmd_remove_wl(struct btdev *dev, const void *data, uint8_t len) char addr[18]; /* This command shall not be used when: - * • any advertising filter policy uses the White List and advertising - * is enabled, - * • the scanning filter policy uses the White List and scanning is + * • any advertising filter policy uses the Accept List and + * advertising is enabled, + * • the scanning filter policy uses the Accept List and scanning is * enabled, or - * • the initiator filter policy uses the White List and an + * • the initiator filter policy uses the Accept List and an * HCI_LE_Create_Connection or HCI_LE_Extended_Create_Connection * command is outstanding. */ - if (!wl_can_change(dev)) + if (!al_can_change(dev)) return -EPERM; /* Valid range for address type is 0x00 to 0x01 */ if (cmd->addr_type > 0x01) return -EINVAL; - for (i = 0; i < WL_SIZE; i++) { - struct btdev_wl *wl = &dev->le_wl[i]; + for (i = 0; i < AL_SIZE; i++) { + struct btdev_al *al = &dev->le_al[i]; - ba2str(&wl->addr, addr); + ba2str(&al->addr, addr); util_debug(dev->debug_callback, dev->debug_data, - "type 0x%02x addr %s", dev->le_wl[i].type, + "type 0x%02x addr %s", dev->le_al[i].type, addr); - if (WL_ADDR_EQUAL(wl, cmd->addr_type, &cmd->addr)) { - wl_reset(wl); + if (AL_ADDR_EQUAL(al, cmd->addr_type, &cmd->addr)) { + al_reset(al); break; } } - if (i == WL_SIZE) + if (i == AL_SIZE) return -EINVAL; status = BT_HCI_ERR_SUCCESS; @@ -4313,10 +4313,10 @@ static int cmd_gen_dhkey(struct btdev *dev, const void *data, uint8_t len) cmd_set_scan_enable_complete), \ CMD(BT_HCI_CMD_LE_CREATE_CONN, cmd_le_create_conn, \ cmd_le_create_conn_complete), \ - CMD(BT_HCI_CMD_LE_READ_ACCEPT_LIST_SIZE, cmd_read_wl_size, NULL), \ - CMD(BT_HCI_CMD_LE_CLEAR_ACCEPT_LIST, cmd_wl_clear, NULL), \ - CMD(BT_HCI_CMD_LE_ADD_TO_ACCEPT_LIST, cmd_add_wl, NULL), \ - CMD(BT_HCI_CMD_LE_REMOVE_FROM_ACCEPT_LIST, cmd_remove_wl, NULL), \ + CMD(BT_HCI_CMD_LE_READ_ACCEPT_LIST_SIZE, cmd_read_al_size, NULL), \ + CMD(BT_HCI_CMD_LE_CLEAR_ACCEPT_LIST, cmd_al_clear, NULL), \ + CMD(BT_HCI_CMD_LE_ADD_TO_ACCEPT_LIST, cmd_add_al, NULL), \ + CMD(BT_HCI_CMD_LE_REMOVE_FROM_ACCEPT_LIST, cmd_remove_al, NULL), \ CMD(BT_HCI_CMD_LE_CONN_UPDATE, cmd_conn_update, \ cmd_conn_update_complete), \ CMD(BT_HCI_CMD_LE_READ_REMOTE_FEATURES, cmd_le_read_remote_features, \ @@ -5887,10 +5887,10 @@ static void set_le_commands(struct btdev *btdev) btdev->commands[26] |= 0x04; /* LE Set Scan Parameters */ btdev->commands[26] |= 0x08; /* LE Set Scan Enable */ btdev->commands[26] |= 0x10; /* LE Create Connection */ - btdev->commands[26] |= 0x40; /* LE Read White List Size */ - btdev->commands[26] |= 0x80; /* LE Clear White List */ - btdev->commands[27] |= 0x01; /* LE Add Device to White List */ - btdev->commands[27] |= 0x02; /* LE Remove Device from White List */ + btdev->commands[26] |= 0x40; /* LE Read Accept List Size */ + btdev->commands[26] |= 0x80; /* LE Clear Accept List */ + btdev->commands[27] |= 0x01; /* LE Add Device to Accept List */ + btdev->commands[27] |= 0x02; /* LE Remove Device from Accept List */ btdev->commands[27] |= 0x04; /* LE Connection Update */ btdev->commands[27] |= 0x20; /* LE Read Remote Used Features */ btdev->commands[27] |= 0x40; /* LE Encrypt */ @@ -6077,13 +6077,13 @@ static void set_bredrle_features(struct btdev *btdev) btdev->features[2] |= 0x08; /* Transparent SCO */ btdev->features[3] |= 0x40; /* RSSI with inquiry results */ btdev->features[3] |= 0x80; /* Extended SCO link */ - btdev->features[4] |= 0x08; /* AFH capable slave */ - btdev->features[4] |= 0x10; /* AFH classification slave */ + btdev->features[4] |= 0x08; /* AFH capable peripheral */ + btdev->features[4] |= 0x10; /* AFH classification peripheral */ btdev->features[4] |= 0x40; /* LE Supported */ btdev->features[5] |= 0x02; /* Sniff subrating */ btdev->features[5] |= 0x04; /* Pause encryption */ - btdev->features[5] |= 0x08; /* AFH capable master */ - btdev->features[5] |= 0x10; /* AFH classification master */ + btdev->features[5] |= 0x08; /* AFH capable central */ + btdev->features[5] |= 0x10; /* AFH classification central */ btdev->features[6] |= 0x01; /* Extended Inquiry Response */ btdev->features[6] |= 0x02; /* Simultaneous LE and BR/EDR */ btdev->features[6] |= 0x08; /* Secure Simple Pairing */ @@ -6113,15 +6113,15 @@ static void set_bredrle_features(struct btdev *btdev) if (btdev->type >= BTDEV_TYPE_BREDRLE52) { btdev->le_features[1] |= 0x20; /* LE PER ADV */ - btdev->le_features[3] |= 0x10; /* LE CIS Master */ - btdev->le_features[3] |= 0x20; /* LE CIS Slave */ + btdev->le_features[3] |= 0x10; /* LE CIS Central */ + btdev->le_features[3] |= 0x20; /* LE CIS Peripheral */ btdev->le_features[3] |= 0x40; /* LE ISO Broadcaster */ btdev->le_features[3] |= 0x80; /* LE Synchronized Receiver */ btdev->le_features[4] |= 0x01; /* LE ISO channels */ } - btdev->feat_page_2[0] |= 0x01; /* CSB - Master Operation */ - btdev->feat_page_2[0] |= 0x02; /* CSB - Slave Operation */ + btdev->feat_page_2[0] |= 0x01; /* CPB - Central Operation */ + btdev->feat_page_2[0] |= 0x02; /* CPB - Peripheral Operation */ btdev->feat_page_2[0] |= 0x04; /* Synchronization Train */ btdev->feat_page_2[0] |= 0x08; /* Synchronization Scan */ btdev->feat_page_2[0] |= 0x10; /* Inquiry Response Notification */ @@ -6139,12 +6139,12 @@ static void set_bredr_features(struct btdev *btdev) btdev->features[1] |= 0x08; /* SCO link */ btdev->features[3] |= 0x40; /* RSSI with inquiry results */ btdev->features[3] |= 0x80; /* Extended SCO link */ - btdev->features[4] |= 0x08; /* AFH capable slave */ - btdev->features[4] |= 0x10; /* AFH classification slave */ + btdev->features[4] |= 0x08; /* AFH capable peripheral */ + btdev->features[4] |= 0x10; /* AFH classification peripheral */ btdev->features[5] |= 0x02; /* Sniff subrating */ btdev->features[5] |= 0x04; /* Pause encryption */ - btdev->features[5] |= 0x08; /* AFH capable master */ - btdev->features[5] |= 0x10; /* AFH classification master */ + btdev->features[5] |= 0x08; /* AFH capable central */ + btdev->features[5] |= 0x10; /* AFH classification central */ btdev->features[6] |= 0x01; /* Extended Inquiry Response */ btdev->features[6] |= 0x08; /* Secure Simple Pairing */ btdev->features[6] |= 0x10; /* Encapsulated PDU */ @@ -6165,12 +6165,12 @@ static void set_bredr20_features(struct btdev *btdev) btdev->features[1] |= 0x08; /* SCO link */ btdev->features[3] |= 0x40; /* RSSI with inquiry results */ btdev->features[3] |= 0x80; /* Extended SCO link */ - btdev->features[4] |= 0x08; /* AFH capable slave */ - btdev->features[4] |= 0x10; /* AFH classification slave */ + btdev->features[4] |= 0x08; /* AFH capable peripheral */ + btdev->features[4] |= 0x10; /* AFH classification peripheral */ btdev->features[5] |= 0x02; /* Sniff subrating */ btdev->features[5] |= 0x04; /* Pause encryption */ - btdev->features[5] |= 0x08; /* AFH capable master */ - btdev->features[5] |= 0x10; /* AFH classification master */ + btdev->features[5] |= 0x08; /* AFH capable central */ + btdev->features[5] |= 0x10; /* AFH classification central */ btdev->features[7] |= 0x80; /* Extended features */ btdev->max_page = 1; @@ -6185,7 +6185,7 @@ static void set_le_features(struct btdev *btdev) btdev->le_features[0] |= 0x01; /* LE Encryption */ btdev->le_features[0] |= 0x02; /* Connection Parameters Request */ - btdev->le_features[0] |= 0x08; /* Slave-initiated Features Exchange */ + btdev->le_features[0] |= 0x08; /* Peripheral-initd Features Exchange */ } static void set_le_states(struct btdev *btdev) @@ -6198,7 +6198,7 @@ static void set_le_states(struct btdev *btdev) btdev->le_states[4] = 0xff; btdev->le_states[5] = 0x03; - wl_clear(btdev); + al_clear(btdev); rl_clear(btdev); btdev->le_rl_enable = 0x00; btdev->le_rl_timeout = 0x0384; /* 900 secs or 15 minutes */ diff --git a/emulator/hciemu.c b/emulator/hciemu.c index ddfabff..49874cc 100755 --- a/emulator/hciemu.c +++ b/emulator/hciemu.c @@ -83,7 +83,7 @@ static void run_command_hook(void *data, void *user_data) run_data->len, hook->user_data); } -static void master_command_callback(uint16_t opcode, +static void central_command_callback(uint16_t opcode, const void *data, uint8_t len, btdev_callback callback, void *user_data) { @@ -229,7 +229,7 @@ static bool create_vhci(struct hciemu *hciemu) if (!btdev) return false; - btdev_set_command_handler(btdev, master_command_callback, hciemu); + btdev_set_command_handler(btdev, central_command_callback, hciemu); fd = open("/dev/vhci", O_RDWR | O_NONBLOCK | O_CLOEXEC); if (fd < 0) { @@ -461,7 +461,7 @@ static void bthost_print(const char *str, void *user_data) "bthost: %s", str); } -static void btdev_master_debug(const char *str, void *user_data) +static void btdev_central_debug(const char *str, void *user_data) { struct hciemu *hciemu = user_data; @@ -499,7 +499,7 @@ bool hciemu_set_debug(struct hciemu *hciemu, hciemu_debug_func_t callback, hciemu->debug_destroy = destroy; hciemu->debug_data = user_data; - btdev_set_debug(hciemu->dev, btdev_master_debug, hciemu, NULL); + btdev_set_debug(hciemu->dev, btdev_central_debug, hciemu, NULL); queue_foreach(hciemu->clients, hciemu_client_set_debug, hciemu); @@ -527,7 +527,7 @@ uint8_t *hciemu_get_features(struct hciemu *hciemu) return btdev_get_features(hciemu->dev); } -const uint8_t *hciemu_get_master_bdaddr(struct hciemu *hciemu) +const uint8_t *hciemu_get_central_bdaddr(struct hciemu *hciemu) { if (!hciemu || !hciemu->dev) return NULL; @@ -555,7 +555,7 @@ const uint8_t *hciemu_get_client_bdaddr(struct hciemu *hciemu) return hciemu_client_bdaddr(client); } -uint8_t hciemu_get_master_scan_enable(struct hciemu *hciemu) +uint8_t hciemu_get_central_scan_enable(struct hciemu *hciemu) { if (!hciemu || !hciemu->dev) return 0; @@ -563,7 +563,7 @@ uint8_t hciemu_get_master_scan_enable(struct hciemu *hciemu) return btdev_get_scan_enable(hciemu->dev); } -uint8_t hciemu_get_master_le_scan_enable(struct hciemu *hciemu) +uint8_t hciemu_get_central_le_scan_enable(struct hciemu *hciemu) { if (!hciemu || !hciemu->dev) return 0; @@ -571,7 +571,8 @@ uint8_t hciemu_get_master_le_scan_enable(struct hciemu *hciemu) return btdev_get_le_scan_enable(hciemu->dev); } -void hciemu_set_master_le_states(struct hciemu *hciemu, const uint8_t *le_states) +void hciemu_set_central_le_states(struct hciemu *hciemu, + const uint8_t *le_states) { if (!hciemu || !hciemu->dev) return; @@ -579,7 +580,7 @@ void hciemu_set_master_le_states(struct hciemu *hciemu, const uint8_t *le_states btdev_set_le_states(hciemu->dev, le_states); } -bool hciemu_add_master_post_command_hook(struct hciemu *hciemu, +bool hciemu_add_central_post_command_hook(struct hciemu *hciemu, hciemu_command_func_t function, void *user_data) { struct hciemu_command_hook *hook; @@ -602,7 +603,7 @@ bool hciemu_add_master_post_command_hook(struct hciemu *hciemu, return true; } -bool hciemu_clear_master_post_command_hooks(struct hciemu *hciemu) +bool hciemu_clear_central_post_command_hooks(struct hciemu *hciemu) { if (!hciemu) return false; diff --git a/emulator/hciemu.h b/emulator/hciemu.h index 8bf2d07..3d3d93b 100755 --- a/emulator/hciemu.h +++ b/emulator/hciemu.h @@ -50,14 +50,14 @@ struct bthost *hciemu_client_get_host(struct hciemu *hciemu); const char *hciemu_get_address(struct hciemu *hciemu); uint8_t *hciemu_get_features(struct hciemu *hciemu); -const uint8_t *hciemu_get_master_bdaddr(struct hciemu *hciemu); +const uint8_t *hciemu_get_central_bdaddr(struct hciemu *hciemu); const uint8_t *hciemu_get_client_bdaddr(struct hciemu *hciemu); -uint8_t hciemu_get_master_scan_enable(struct hciemu *hciemu); +uint8_t hciemu_get_central_scan_enable(struct hciemu *hciemu); -uint8_t hciemu_get_master_le_scan_enable(struct hciemu *hciemu); +uint8_t hciemu_get_central_le_scan_enable(struct hciemu *hciemu); -void hciemu_set_master_le_states(struct hciemu *hciemu, +void hciemu_set_central_le_states(struct hciemu *hciemu, const uint8_t *le_states); typedef void (*hciemu_command_func_t)(uint16_t opcode, const void *data, @@ -66,10 +66,10 @@ typedef void (*hciemu_command_func_t)(uint16_t opcode, const void *data, typedef bool (*hciemu_hook_func_t)(const void *data, uint16_t len, void *user_data); -bool hciemu_add_master_post_command_hook(struct hciemu *hciemu, +bool hciemu_add_central_post_command_hook(struct hciemu *hciemu, hciemu_command_func_t function, void *user_data); -bool hciemu_clear_master_post_command_hooks(struct hciemu *hciemu); +bool hciemu_clear_central_post_command_hooks(struct hciemu *hciemu); int hciemu_add_hook(struct hciemu *hciemu, enum hciemu_hook_type type, uint16_t opcode, hciemu_hook_func_t function, diff --git a/emulator/le.c b/emulator/le.c index 23f2579..07a44c5 100755 --- a/emulator/le.c +++ b/emulator/le.c @@ -34,7 +34,7 @@ #include "phy.h" #include "le.h" -#define WHITE_LIST_SIZE 16 +#define ACCEPT_LIST_SIZE 16 #define RESOLV_LIST_SIZE 16 #define SCAN_CACHE_SIZE 64 @@ -102,8 +102,8 @@ struct bt_le { uint8_t le_conn_own_addr_type; uint8_t le_conn_enable; - uint8_t le_white_list_size; - uint8_t le_white_list[WHITE_LIST_SIZE][7]; + uint8_t le_accept_list_size; + uint8_t le_accept_list[ACCEPT_LIST_SIZE][7]; uint8_t le_states[8]; uint16_t le_default_tx_len; @@ -122,27 +122,27 @@ struct bt_le { uint8_t scan_cache_count; }; -static bool is_in_white_list(struct bt_le *hci, uint8_t addr_type, +static bool is_in_accept_list(struct bt_le *hci, uint8_t addr_type, const uint8_t addr[6]) { int i; - for (i = 0; i < hci->le_white_list_size; i++) { - if (hci->le_white_list[i][0] == addr_type && - !memcmp(&hci->le_white_list[i][1], addr, 6)) + for (i = 0; i < hci->le_accept_list_size; i++) { + if (hci->le_accept_list[i][0] == addr_type && + !memcmp(&hci->le_accept_list[i][1], addr, 6)) return true; } return false; } -static void clear_white_list(struct bt_le *hci) +static void clear_accept_list(struct bt_le *hci) { int i; - for (i = 0; i < hci->le_white_list_size; i++) { - hci->le_white_list[i][0] = 0xff; - memset(&hci->le_white_list[i][1], 0, 6); + for (i = 0; i < hci->le_accept_list_size; i++) { + hci->le_accept_list[i][0] = 0xff; + memset(&hci->le_accept_list[i][1], 0, 6); } } @@ -243,10 +243,10 @@ static void reset_defaults(struct bt_le *hci) hci->commands[26] |= 0x08; /* LE Set Scan Enable */ hci->commands[26] |= 0x10; /* LE Create Connection */ hci->commands[26] |= 0x20; /* LE Create Connection Cancel */ - hci->commands[26] |= 0x40; /* LE Read White List Size */ - hci->commands[26] |= 0x80; /* LE Clear White List */ - hci->commands[27] |= 0x01; /* LE Add Device To White List */ - hci->commands[27] |= 0x02; /* LE Remove Device From White List */ + hci->commands[26] |= 0x40; /* LE Read Accept List Size */ + hci->commands[26] |= 0x80; /* LE Clear Accept List */ + hci->commands[27] |= 0x01; /* LE Add Device To Accept List */ + hci->commands[27] |= 0x02; /* LE Remove Device From Accept List */ //hci->commands[27] |= 0x04; /* LE Connection Update */ //hci->commands[27] |= 0x08; /* LE Set Host Channel Classification */ //hci->commands[27] |= 0x10; /* LE Read Channel Map */ @@ -343,7 +343,7 @@ static void reset_defaults(struct bt_le *hci) hci->le_features[0] |= 0x01; /* LE Encryption */ //hci->le_features[0] |= 0x02; /* Connection Parameter Request Procedure */ //hci->le_features[0] |= 0x04; /* Extended Reject Indication */ - //hci->le_features[0] |= 0x08; /* Slave-initiated Features Exchange */ + //hci->le_features[0] |= 0x08; /* Peripheral-initd Features Exchange */ hci->le_features[0] |= 0x10; /* LE Ping */ hci->le_features[0] |= 0x20; /* LE Data Packet Length Extension */ hci->le_features[0] |= 0x40; /* LL Privacy */ @@ -389,8 +389,8 @@ static void reset_defaults(struct bt_le *hci) hci->le_conn_enable = 0x00; - hci->le_white_list_size = WHITE_LIST_SIZE; - clear_white_list(hci); + hci->le_accept_list_size = ACCEPT_LIST_SIZE; + clear_accept_list(hci); memset(hci->le_states, 0, sizeof(hci->le_states)); hci->le_states[0] |= 0x01; /* Non-connectable Advertising */ @@ -399,8 +399,8 @@ static void reset_defaults(struct bt_le *hci) hci->le_states[0] |= 0x08; /* High Duty Cycle Directed Advertising */ hci->le_states[0] |= 0x10; /* Passive Scanning */ hci->le_states[0] |= 0x20; /* Active Scanning */ - hci->le_states[0] |= 0x40; /* Initiating + Connection (Master Role) */ - hci->le_states[0] |= 0x80; /* Connection (Slave Role) */ + hci->le_states[0] |= 0x40; /* Initiating + Conn (Central Role) */ + hci->le_states[0] |= 0x80; /* Connection (Peripheral Role) */ hci->le_states[1] |= 0x01; /* Passive Scanning + * Non-connectable Advertising */ @@ -1208,31 +1208,31 @@ static void cmd_le_create_conn_cancel(struct bt_le *hci, &evt, sizeof(evt)); } -static void cmd_le_read_white_list_size(struct bt_le *hci, +static void cmd_le_read_accept_list_size(struct bt_le *hci, const void *data, uint8_t size) { struct bt_hci_rsp_le_read_accept_list_size rsp; rsp.status = BT_HCI_ERR_SUCCESS; - rsp.size = hci->le_white_list_size; + rsp.size = hci->le_accept_list_size; cmd_complete(hci, BT_HCI_CMD_LE_READ_ACCEPT_LIST_SIZE, &rsp, sizeof(rsp)); } -static void cmd_le_clear_white_list(struct bt_le *hci, +static void cmd_le_clear_accept_list(struct bt_le *hci, const void *data, uint8_t size) { uint8_t status; - clear_white_list(hci); + clear_accept_list(hci); status = BT_HCI_ERR_SUCCESS; cmd_complete(hci, BT_HCI_CMD_LE_CLEAR_ACCEPT_LIST, &status, sizeof(status)); } -static void cmd_le_add_to_white_list(struct bt_le *hci, +static void cmd_le_add_to_accept_list(struct bt_le *hci, const void *data, uint8_t size) { const struct bt_hci_cmd_le_add_to_accept_list *cmd = data; @@ -1247,13 +1247,13 @@ static void cmd_le_add_to_white_list(struct bt_le *hci, return; } - for (i = 0; i < hci->le_white_list_size; i++) { - if (hci->le_white_list[i][0] == cmd->addr_type && - !memcmp(&hci->le_white_list[i][1], + for (i = 0; i < hci->le_accept_list_size; i++) { + if (hci->le_accept_list[i][0] == cmd->addr_type && + !memcmp(&hci->le_accept_list[i][1], cmd->addr, 6)) { exists = true; break; - } else if (pos < 0 && hci->le_white_list[i][0] == 0xff) + } else if (pos < 0 && hci->le_accept_list[i][0] == 0xff) pos = i; } @@ -1269,15 +1269,15 @@ static void cmd_le_add_to_white_list(struct bt_le *hci, return; } - hci->le_white_list[pos][0] = cmd->addr_type; - memcpy(&hci->le_white_list[pos][1], cmd->addr, 6); + hci->le_accept_list[pos][0] = cmd->addr_type; + memcpy(&hci->le_accept_list[pos][1], cmd->addr, 6); status = BT_HCI_ERR_SUCCESS; cmd_complete(hci, BT_HCI_CMD_LE_ADD_TO_ACCEPT_LIST, &status, sizeof(status)); } -static void cmd_le_remove_from_white_list(struct bt_le *hci, +static void cmd_le_remove_from_accept_list(struct bt_le *hci, const void *data, uint8_t size) { const struct bt_hci_cmd_le_remove_from_accept_list *cmd = data; @@ -1291,9 +1291,9 @@ static void cmd_le_remove_from_white_list(struct bt_le *hci, return; } - for (i = 0; i < hci->le_white_list_size; i++) { - if (hci->le_white_list[i][0] == cmd->addr_type && - !memcmp(&hci->le_white_list[i][1], + for (i = 0; i < hci->le_accept_list_size; i++) { + if (hci->le_accept_list[i][0] == cmd->addr_type && + !memcmp(&hci->le_accept_list[i][1], cmd->addr, 6)) { pos = i; break; @@ -1306,8 +1306,8 @@ static void cmd_le_remove_from_white_list(struct bt_le *hci, return; } - hci->le_white_list[pos][0] = 0xff; - memset(&hci->le_white_list[pos][1], 0, 6); + hci->le_accept_list[pos][0] = 0xff; + memset(&hci->le_accept_list[pos][1], 0, 6); status = BT_HCI_ERR_SUCCESS; cmd_complete(hci, BT_HCI_CMD_LE_REMOVE_FROM_ACCEPT_LIST, @@ -1831,13 +1831,13 @@ static const struct { { BT_HCI_CMD_LE_CREATE_CONN_CANCEL, cmd_le_create_conn_cancel, 0, true }, { BT_HCI_CMD_LE_READ_ACCEPT_LIST_SIZE, - cmd_le_read_white_list_size, 0, true }, + cmd_le_read_accept_list_size, 0, true }, { BT_HCI_CMD_LE_CLEAR_ACCEPT_LIST, - cmd_le_clear_white_list, 0, true }, + cmd_le_clear_accept_list, 0, true }, { BT_HCI_CMD_LE_ADD_TO_ACCEPT_LIST, - cmd_le_add_to_white_list, 7, true }, + cmd_le_add_to_accept_list, 7, true }, { BT_HCI_CMD_LE_REMOVE_FROM_ACCEPT_LIST, - cmd_le_remove_from_white_list, 7, true }, + cmd_le_remove_from_accept_list, 7, true }, { BT_HCI_CMD_LE_ENCRYPT, cmd_le_encrypt, 32, true }, { BT_HCI_CMD_LE_RAND, cmd_le_rand, 0, true }, @@ -1963,7 +1963,7 @@ static void phy_recv_callback(uint16_t type, const void *data, if (hci->le_scan_filter_policy == 0x01 || hci->le_scan_filter_policy == 0x03) { - if (!is_in_white_list(hci, tx_addr_type, + if (!is_in_accept_list(hci, tx_addr_type, tx_addr)) break; } diff --git a/emulator/serial.c b/emulator/serial.c index d74e566..0edec6e 100755 --- a/emulator/serial.c +++ b/emulator/serial.c @@ -150,19 +150,19 @@ static void open_pty(struct serial *serial) serial->fd = posix_openpt(O_RDWR | O_NOCTTY); if (serial->fd < 0) { - perror("Failed to get master pseudo terminal"); + perror("Failed to get central pseudo terminal"); return; } if (grantpt(serial->fd) < 0) { - perror("Failed to grant slave pseudo terminal"); + perror("Failed to grant peripheral pseudo terminal"); close(serial->fd); serial->fd = -1; return; } if (unlockpt(serial->fd) < 0) { - perror("Failed to unlock slave pseudo terminal"); + perror("Failed to unlock peripheral pseudo terminal"); close(serial->fd); serial->fd = -1; return; diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c index fbd44b7..b125b35 100644 --- a/profiles/audio/avctp.c +++ b/profiles/audio/avctp.c @@ -1724,7 +1724,7 @@ static GIOChannel *avctp_server_socket(const bdaddr_t *src, gboolean master, BT_IO_OPT_SOURCE_BDADDR, src, BT_IO_OPT_PSM, psm, BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM, - BT_IO_OPT_CENTRAL, central, + BT_IO_OPT_CENTRAL, master, BT_IO_OPT_MODE, mode, BT_IO_OPT_INVALID); if (!io) { diff --git a/tools/btiotest.c b/tools/btiotest.c index 0a1f781..f53de03 100755 --- a/tools/btiotest.c +++ b/tools/btiotest.c @@ -343,7 +343,7 @@ static void l2cap_listen(const char *src, uint8_t addr_type, uint16_t psm, BT_IO_OPT_PSM, psm, BT_IO_OPT_CID, cid, BT_IO_OPT_SEC_LEVEL, sec, - BT_IO_OPT_CENTRAL, central, + BT_IO_OPT_CENTRAL, master, BT_IO_OPT_INVALID); else l2_srv = bt_io_listen(conn, cfm, data, @@ -353,7 +353,7 @@ static void l2cap_listen(const char *src, uint8_t addr_type, uint16_t psm, BT_IO_OPT_PSM, psm, BT_IO_OPT_CID, cid, BT_IO_OPT_SEC_LEVEL, sec, - BT_IO_OPT_CENTRAL, central, + BT_IO_OPT_CENTRAL, master, BT_IO_OPT_INVALID); if (!l2_srv) { @@ -427,7 +427,7 @@ static void rfcomm_listen(const char *src, uint8_t ch, gboolean defer, BT_IO_OPT_SOURCE, src, BT_IO_OPT_CHANNEL, ch, BT_IO_OPT_SEC_LEVEL, sec, - BT_IO_OPT_CENTRAL, central, + BT_IO_OPT_CENTRAL, master, BT_IO_OPT_INVALID); else rc_srv = bt_io_listen(conn, cfm, @@ -435,7 +435,7 @@ static void rfcomm_listen(const char *src, uint8_t ch, gboolean defer, &err, BT_IO_OPT_CHANNEL, ch, BT_IO_OPT_SEC_LEVEL, sec, - BT_IO_OPT_CENTRAL, central, + BT_IO_OPT_CENTRAL, master, BT_IO_OPT_INVALID); if (!rc_srv) { diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c index 11d549f..169a989 100755 --- a/tools/l2cap-tester.c +++ b/tools/l2cap-tester.c @@ -1116,7 +1116,7 @@ static int create_l2cap_sock(struct test_data *data, uint16_t psm, return err; } - master_bdaddr = hciemu_get_master_bdaddr(data->hciemu); + master_bdaddr = hciemu_get_central_bdaddr(data->hciemu); if (!master_bdaddr) { tester_warn("No master bdaddr"); close(sk); @@ -1301,7 +1301,7 @@ static void test_connect(const void *test_data) } if (l2data->direct_advertising) - hciemu_add_master_post_command_hook(data->hciemu, + hciemu_add_central_post_command_hook(data->hciemu, direct_adv_cmd_complete, NULL); sk = create_l2cap_sock(data, 0, l2data->cid, l2data->sec_level, @@ -1419,7 +1419,7 @@ static gboolean test_close_socket_1_part_3(gpointer arg) return FALSE; } - if (hciemu_get_master_le_scan_enable(data->hciemu)) { + if (hciemu_get_central_le_scan_enable(data->hciemu)) { tester_print("Delayed check whether scann is off failed"); tester_test_failed(); return FALSE; @@ -1440,7 +1440,7 @@ static gboolean test_close_socket_1_part_2(gpointer args) * was added to kernel whitelist, and scan was started. We * should be still scanning. */ - if (!hciemu_get_master_le_scan_enable(data->hciemu)) { + if (!hciemu_get_central_le_scan_enable(data->hciemu)) { tester_print("Error - should be still scanning"); tester_test_failed(); return FALSE; @@ -1467,7 +1467,7 @@ static gboolean test_close_socket_2_part_3(gpointer arg) int err; /* Scan should be already over, we're trying to create connection */ - if (hciemu_get_master_le_scan_enable(data->hciemu)) { + if (hciemu_get_central_le_scan_enable(data->hciemu)) { tester_print("Error - should no longer scan"); tester_test_failed(); return FALSE; @@ -1563,7 +1563,7 @@ static void test_close_socket(const void *test_data) const struct l2cap_data *l2data = data->test_data; const uint8_t *client_bdaddr; - hciemu_add_master_post_command_hook(data->hciemu, + hciemu_add_central_post_command_hook(data->hciemu, test_close_socket_router, data); if (l2data->client_bdaddr != NULL) @@ -1668,7 +1668,7 @@ static void test_connect_2(const void *test_data) test_2_connect_cb_cnt = 0; test_scan_enable_counter = 0; - hciemu_add_master_post_command_hook(data->hciemu, + hciemu_add_central_post_command_hook(data->hciemu, test_connect_2_router, data); if (l2data->server_psm) { @@ -1869,7 +1869,7 @@ static void test_server(const void *test_data) tester_print("Listening for connections"); } - master_bdaddr = hciemu_get_master_bdaddr(data->hciemu); + master_bdaddr = hciemu_get_central_bdaddr(data->hciemu); if (!master_bdaddr) { tester_warn("No master bdaddr"); tester_test_failed(); diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 03e56ac..4ed479f 100755 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -365,7 +365,7 @@ static void read_index_list_callback(uint8_t status, uint16_t length, hciemu_set_debug(data->hciemu, print_debug, "hciemu: ", NULL); if (test && test->setup_le_states) - hciemu_set_master_le_states(data->hciemu, test->le_states); + hciemu_set_central_le_states(data->hciemu, test->le_states); } static void test_pre_setup(const void *test_data) @@ -7136,7 +7136,7 @@ static void command_setup_hci_callback(uint16_t opcode, const void *param, return; } - hciemu_clear_master_post_command_hooks(data->hciemu); + hciemu_clear_central_post_command_hooks(data->hciemu); test_setup_condition_complete(data); } @@ -7202,7 +7202,7 @@ static void setup_command_generic(const void *test_data) tester_print("Registering setup expected HCI command callback"); tester_print("Setup expected HCI command 0x%04x", test->setup_expect_hci_command); - hciemu_add_master_post_command_hook(data->hciemu, + hciemu_add_central_post_command_hook(data->hciemu, command_setup_hci_callback, data); test_add_setup_condition(data); } @@ -9533,7 +9533,7 @@ static void setup_ll_privacy_device(const void *test_data) tester_print("Setup expected HCI command 0x%04x", test->setup_expect_hci_command); - hciemu_add_master_post_command_hook(data->hciemu, + hciemu_add_central_post_command_hook(data->hciemu, command_setup_hci_callback, data); test_add_setup_condition(data); @@ -9690,7 +9690,7 @@ static void test_command_generic(const void *test_data) if (test->expect_hci_command) { tester_print("Registering HCI command callback"); - hciemu_add_master_post_command_hook(data->hciemu, + hciemu_add_central_post_command_hook(data->hciemu, command_hci_callback, data); test_add_condition(data); } @@ -9724,13 +9724,13 @@ static void check_scan(void *user_data) { struct test_data *data = tester_get_data(); - if (hciemu_get_master_le_scan_enable(data->hciemu)) { + if (hciemu_get_central_le_scan_enable(data->hciemu)) { tester_warn("LE scan still enabled"); tester_test_failed(); return; } - if (hciemu_get_master_scan_enable(data->hciemu)) { + if (hciemu_get_central_scan_enable(data->hciemu)) { tester_warn("BR/EDR scan still enabled"); tester_test_failed(); return; @@ -9821,7 +9821,7 @@ static void test_pairing_acceptor(const void *test_data) test_add_condition(data); } - master_bdaddr = hciemu_get_master_bdaddr(data->hciemu); + master_bdaddr = hciemu_get_central_bdaddr(data->hciemu); if (!master_bdaddr) { tester_warn("No master bdaddr"); tester_test_failed(); @@ -9886,7 +9886,7 @@ static void test_command_generic_connect(const void *test_data) data->mgmt_alt_ev_id = id; test_add_condition(data); - master_bdaddr = hciemu_get_master_bdaddr(data->hciemu); + master_bdaddr = hciemu_get_central_bdaddr(data->hciemu); if (!master_bdaddr) { tester_warn("No master bdaddr"); tester_test_failed(); @@ -9965,7 +9965,7 @@ static void add_device_callback(uint8_t status, uint16_t len, const void *param, if (test->client_enable_adv) return; - master_bdaddr = hciemu_get_master_bdaddr(data->hciemu); + master_bdaddr = hciemu_get_central_bdaddr(data->hciemu); if (!master_bdaddr) { tester_warn("No master bdaddr"); tester_test_failed(); diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c index 9bae5b9..78b0866 100755 --- a/tools/rfcomm-tester.c +++ b/tools/rfcomm-tester.c @@ -542,7 +542,7 @@ static void test_connect(const void *test_data) bthost_add_rfcomm_server(bthost, cli->server_channel, rfcomm_connect_cb, NULL); - master_addr = hciemu_get_master_bdaddr(data->hciemu); + master_addr = hciemu_get_central_bdaddr(data->hciemu); client_addr = hciemu_get_client_bdaddr(data->hciemu); sk = create_rfcomm_sock((bdaddr_t *) master_addr, 0); @@ -680,7 +680,7 @@ static void test_server(const void *test_data) GIOChannel *io; int sk; - master_addr = hciemu_get_master_bdaddr(data->hciemu); + master_addr = hciemu_get_central_bdaddr(data->hciemu); sk = create_rfcomm_sock((bdaddr_t *) master_addr, srv->server_channel); if (sk < 0) { diff --git a/tools/sco-tester.c b/tools/sco-tester.c index b31fd5a..75f9f58 100755 --- a/tools/sco-tester.c +++ b/tools/sco-tester.c @@ -540,7 +540,7 @@ static int create_sco_sock(struct test_data *data) return err; } - master_bdaddr = hciemu_get_master_bdaddr(data->hciemu); + master_bdaddr = hciemu_get_central_bdaddr(data->hciemu); if (!master_bdaddr) { tester_warn("No master bdaddr"); return -ENODEV; diff --git a/tools/smp-tester.c b/tools/smp-tester.c index 644c451..b075c5d 100755 --- a/tools/smp-tester.c +++ b/tools/smp-tester.c @@ -767,7 +767,7 @@ static void init_bdaddr(struct test_data *data) { const uint8_t *master_bdaddr, *client_bdaddr; - master_bdaddr = hciemu_get_master_bdaddr(data->hciemu); + master_bdaddr = hciemu_get_central_bdaddr(data->hciemu); if (!master_bdaddr) { tester_warn("No master bdaddr"); tester_test_failed(); @@ -808,7 +808,7 @@ static void test_client(const void *test_data) if (smp->expect_hci_command) { tester_print("Registering HCI command callback"); - hciemu_add_master_post_command_hook(data->hciemu, + hciemu_add_central_post_command_hook(data->hciemu, command_hci_callback, data); test_add_condition(data); } @@ -889,7 +889,7 @@ static void test_server(const void *test_data) if (smp->expect_hci_command) { tester_print("Registering HCI command callback"); - hciemu_add_master_post_command_hook(data->hciemu, + hciemu_add_central_post_command_hook(data->hciemu, command_hci_callback, data); test_add_condition(data); }