@@ -720,7 +720,7 @@ static void attach_node_reply(struct l_dbus_proxy *proxy,
ivi != iv_index) {
iv_index = ivi;
mesh_db_set_iv_index(ivi);
- remote_clear_blacklisted_addresses(ivi);
+ remote_clear_rejected_addresses(ivi);
}
return;
@@ -1858,7 +1858,7 @@ static void property_changed(struct l_dbus_proxy *proxy, const char *name,
iv_index = ivi;
mesh_db_set_iv_index(ivi);
- remote_clear_blacklisted_addresses(ivi);
+ remote_clear_rejected_addresses(ivi);
}
}
}
@@ -1246,7 +1246,7 @@ bool mesh_db_set_iv_index(uint32_t ivi)
return save_config();
}
-static int get_blacklisted_by_iv_index(json_object *jarray, uint32_t iv_index)
+static int get_rejected_by_iv_index(json_object *jarray, uint32_t iv_index)
{
int i, cnt;
@@ -1268,12 +1268,12 @@ static int get_blacklisted_by_iv_index(json_object *jarray, uint32_t iv_index)
return -1;
}
-static bool load_blacklisted(json_object *jobj)
+static bool load_rejected_addresses(json_object *jobj)
{
json_object *jarray;
int i, cnt;
- json_object_object_get_ex(jobj, "blacklistedAddresses", &jarray);
+ json_object_object_get_ex(jobj, "rejectedAddresses", &jarray);
if (!jarray || json_object_get_type(jarray) != json_type_array)
return true;
@@ -1304,15 +1304,14 @@ static bool load_blacklisted(json_object *jobj)
if (sscanf(str, "%04hx", &unicast) != 1)
return false;
- remote_add_blacklisted_address(unicast, iv_index,
- false);
+ remote_add_rejected_address(unicast, iv_index, false);
}
}
return true;
}
-bool mesh_db_add_blacklisted_addr(uint16_t unicast, uint32_t iv_index)
+bool mesh_db_add_rejected_addr(uint16_t unicast, uint32_t iv_index)
{
json_object *jarray, *jobj, *jaddrs, *jstring;
int idx;
@@ -1321,14 +1320,13 @@ bool mesh_db_add_blacklisted_addr(uint16_t unicast, uint32_t iv_index)
if (!cfg || !cfg->jcfg)
return false;
- json_object_object_get_ex(cfg->jcfg, "blacklistedAddresses", &jarray);
+ json_object_object_get_ex(cfg->jcfg, "rejectedAddresses", &jarray);
if (!jarray) {
jarray = json_object_new_array();
- json_object_object_add(cfg->jcfg, "blacklistedAddresses",
- jarray);
+ json_object_object_add(cfg->jcfg, "rejectedAddresses", jarray);
}
- idx = get_blacklisted_by_iv_index(jarray, iv_index);
+ idx = get_rejected_by_iv_index(jarray, iv_index);
if (idx < 0) {
jobj = json_object_new_object();
@@ -1362,7 +1360,7 @@ fail:
return false;
}
-bool mesh_db_clear_blacklisted(uint32_t iv_index)
+bool mesh_db_clear_rejected(uint32_t iv_index)
{
json_object *jarray;
int idx;
@@ -1370,11 +1368,11 @@ bool mesh_db_clear_blacklisted(uint32_t iv_index)
if (!cfg || !cfg->jcfg)
return false;
- json_object_object_get_ex(cfg->jcfg, "blacklistedAddresses", &jarray);
+ json_object_object_get_ex(cfg->jcfg, "rejectedAddresses", &jarray);
if (!jarray || json_object_get_type(jarray) != json_type_array)
return false;
- idx = get_blacklisted_by_iv_index(jarray, iv_index);
+ idx = get_rejected_by_iv_index(jarray, iv_index);
if (idx < 0)
return true;
@@ -1437,7 +1435,7 @@ bool mesh_db_create(const char *fname, const uint8_t token[8],
if (!jarray)
goto fail;
- json_object_object_add(jcfg, "blacklistedAddresses", jarray);
+ json_object_object_add(jcfg, "rejectedAddresses", jarray);
write_int(jcfg, "ivIndex", 0);
@@ -1504,7 +1502,7 @@ bool mesh_db_load(const char *fname)
load_remotes(jcfg);
- load_blacklisted(jcfg);
+ load_rejected_addresses(jcfg);
return true;
fail:
@@ -49,5 +49,5 @@ bool mesh_db_node_model_binding_del(uint16_t unicast, uint8_t ele, bool vendor,
uint32_t mod_id, uint16_t app_idx);
struct l_queue *mesh_db_load_groups(void);
bool mesh_db_add_group(struct mesh_group *grp);
-bool mesh_db_add_blacklisted_addr(uint16_t unicast, uint32_t iv_index);
-bool mesh_db_clear_blacklisted(uint32_t iv_index);
+bool mesh_db_add_rejected_addr(uint16_t unicast, uint32_t iv_index);
+bool mesh_db_clear_rejected(uint32_t iv_index);
@@ -34,13 +34,13 @@ struct remote_node {
uint8_t num_ele;
};
-struct blacklisted_addr {
+struct rejected_addr {
uint32_t iv_index;
uint16_t unicast;
};
static struct l_queue *nodes;
-static struct l_queue *blacklisted;
+static struct l_queue *reject_list;
static bool key_present(struct l_queue *keys, uint16_t app_idx)
{
@@ -124,7 +124,7 @@ uint8_t remote_del_node(uint16_t unicast)
for (i = 0; i < num_ele; ++i) {
l_queue_destroy(rmt->els[i], NULL);
- remote_add_blacklisted_address(unicast + i, iv_index, true);
+ remote_add_rejected_address(unicast + i, iv_index, true);
}
l_free(rmt->els);
@@ -333,9 +333,9 @@ static void print_node(void *rmt, void *user_data)
print_element(node->els[i], i);
}
-static bool match_black_addr(const void *a, const void *b)
+static bool match_rejected_addr(const void *a, const void *b)
{
- const struct blacklisted_addr *addr = a;
+ const struct rejected_addr *addr = a;
uint16_t unicast = L_PTR_TO_UINT(b);
return addr->unicast == unicast;
@@ -348,11 +348,11 @@ static uint16_t get_next_addr(uint16_t high, uint16_t addr,
int i = 0;
for (i = 0; i < ele_cnt; i++) {
- struct blacklisted_addr *black;
+ struct rejected_addr *reject;
- black = l_queue_find(blacklisted, match_black_addr,
+ reject = l_queue_find(reject_list, match_rejected_addr,
L_UINT_TO_PTR(addr + i));
- if (!black)
+ if (!reject)
break;
}
@@ -367,10 +367,10 @@ static uint16_t get_next_addr(uint16_t high, uint16_t addr,
static bool check_iv_index(const void *a, const void *b)
{
- const struct blacklisted_addr *black_addr = a;
+ const struct rejected_addr *reject = a;
uint32_t iv_index = L_PTR_TO_UINT(b);
- return (abs_diff(iv_index, black_addr->iv_index) > 2);
+ return (abs_diff(iv_index, reject->iv_index) > 2);
}
void remote_print_node(uint16_t addr)
@@ -435,36 +435,35 @@ uint16_t remote_get_next_unicast(uint16_t low, uint16_t high, uint8_t ele_cnt)
return addr;
}
-void remote_add_blacklisted_address(uint16_t addr, uint32_t iv_index,
- bool save)
+void remote_add_rejected_address(uint16_t addr, uint32_t iv_index, bool save)
{
- struct blacklisted_addr *black_addr;
+ struct rejected_addr *reject;
- if (!blacklisted)
- blacklisted = l_queue_new();
+ if (!reject_list)
+ reject_list = l_queue_new();
- black_addr = l_new(struct blacklisted_addr, 1);
- black_addr->unicast = addr;
- black_addr->iv_index = iv_index;
+ reject = l_new(struct rejected_addr, 1);
+ reject->unicast = addr;
+ reject->iv_index = iv_index;
- l_queue_push_tail(blacklisted, black_addr);
+ l_queue_push_tail(reject_list, reject);
if (save)
- mesh_db_add_blacklisted_addr(addr, iv_index);
+ mesh_db_add_rejected_addr(addr, iv_index);
}
-void remote_clear_blacklisted_addresses(uint32_t iv_index)
+void remote_clear_rejected_addresses(uint32_t iv_index)
{
- struct blacklisted_addr *black_addr;
+ struct rejected_addr *reject;
- black_addr = l_queue_remove_if(blacklisted, check_iv_index,
+ reject = l_queue_remove_if(reject_list, check_iv_index,
L_UINT_TO_PTR(iv_index));
- while (black_addr) {
- l_free(black_addr);
- black_addr = l_queue_remove_if(blacklisted, check_iv_index,
+ while (reject) {
+ l_free(reject);
+ reject = l_queue_remove_if(reject_list, check_iv_index,
L_UINT_TO_PTR(iv_index));
}
- mesh_db_clear_blacklisted(iv_index);
+ mesh_db_clear_rejected(iv_index);
}
@@ -13,9 +13,8 @@ bool remote_add_node(const uint8_t uuid[16], uint16_t unicast,
uint8_t remote_del_node(uint16_t unicast);
bool remote_set_model(uint16_t unicast, uint8_t ele_idx, uint32_t mod_id,
bool vendor);
-void remote_add_blacklisted_address(uint16_t addr, uint32_t iv_index,
- bool save);
-void remote_clear_blacklisted_addresses(uint32_t iv_index);
+void remote_add_rejected_address(uint16_t addr, uint32_t iv_index, bool save);
+void remote_clear_rejected_addresses(uint32_t iv_index);
uint16_t remote_get_next_unicast(uint16_t low, uint16_t high, uint8_t ele_cnt);
bool remote_add_net_key(uint16_t addr, uint16_t net_idx);
bool remote_del_net_key(uint16_t addr, uint16_t net_idx);
From: Archie Pusaka <apusaka@chromium.org> "reject list" is preferred, as reflected in https://specificationrefs.bluetooth.com/language-mapping/Appropriate_Language_Mapping_Table.pdf --- tools/mesh-cfgclient.c | 4 ++-- tools/mesh/mesh-db.c | 28 +++++++++++----------- tools/mesh/mesh-db.h | 4 ++-- tools/mesh/remote.c | 53 +++++++++++++++++++++--------------------- tools/mesh/remote.h | 5 ++-- 5 files changed, 45 insertions(+), 49 deletions(-)