MYNEWT-754 BLE Host - Add some missing consts.

X-Original-Commit: 507773fdcd1aff62db51fe1f8afdf7b0014e4099
This commit is contained in:
Christopher Collins
2017-05-11 18:04:41 -07:00
parent 86f1ffc198
commit 405d3a7900
8 changed files with 68 additions and 65 deletions
+18 -18
View File
@@ -148,7 +148,7 @@ union ble_store_value {
* BLE_HS_ENOENT if no matching object was found;
* Other nonzero on error.
*/
typedef int ble_store_read_fn(int obj_type, union ble_store_key *key,
typedef int ble_store_read_fn(int obj_type, const union ble_store_key *key,
union ble_store_value *dst);
/**
@@ -164,7 +164,7 @@ typedef int ble_store_read_fn(int obj_type, union ble_store_key *key,
* @return 0 if the object was successfully written;
* Other nonzero on error.
*/
typedef int ble_store_write_fn(int obj_type, union ble_store_value *val);
typedef int ble_store_write_fn(int obj_type, const union ble_store_value *val);
/**
* Searches the store for the first object matching the specified criteria. If
@@ -179,35 +179,35 @@ typedef int ble_store_write_fn(int obj_type, union ble_store_value *val);
* BLE_HS_ENOENT if no matching object was found;
* Other nonzero on error.
*/
typedef int ble_store_delete_fn(int obj_type, union ble_store_key *key);
typedef int ble_store_delete_fn(int obj_type, const union ble_store_key *key);
int ble_store_read(int obj_type, union ble_store_key *key,
int ble_store_read(int obj_type, const union ble_store_key *key,
union ble_store_value *val);
int ble_store_write(int obj_type, union ble_store_value *val);
int ble_store_delete(int obj_type, union ble_store_key *key);
int ble_store_write(int obj_type, const union ble_store_value *val);
int ble_store_delete(int obj_type, const union ble_store_key *key);
int ble_store_read_our_sec(struct ble_store_key_sec *key_sec,
int ble_store_read_our_sec(const struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_sec);
int ble_store_write_our_sec(struct ble_store_value_sec *value_sec);
int ble_store_delete_our_sec(struct ble_store_key_sec *key_sec);
int ble_store_read_peer_sec(struct ble_store_key_sec *key_sec,
int ble_store_write_our_sec(const struct ble_store_value_sec *value_sec);
int ble_store_delete_our_sec(const struct ble_store_key_sec *key_sec);
int ble_store_read_peer_sec(const struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_sec);
int ble_store_write_peer_sec(struct ble_store_value_sec *value_sec);
int ble_store_delete_peer_sec(struct ble_store_key_sec *key_sec);
int ble_store_write_peer_sec(const struct ble_store_value_sec *value_sec);
int ble_store_delete_peer_sec(const struct ble_store_key_sec *key_sec);
int ble_store_read_cccd(struct ble_store_key_cccd *key,
int ble_store_read_cccd(const struct ble_store_key_cccd *key,
struct ble_store_value_cccd *out_value);
int ble_store_write_cccd(struct ble_store_value_cccd *value);
int ble_store_delete_cccd(struct ble_store_key_cccd *key);
int ble_store_write_cccd(const struct ble_store_value_cccd *value);
int ble_store_delete_cccd(const struct ble_store_key_cccd *key);
void ble_store_key_from_value_sec(struct ble_store_key_sec *out_key,
struct ble_store_value_sec *value);
const struct ble_store_value_sec *value);
void ble_store_key_from_value_cccd(struct ble_store_key_cccd *out_key,
struct ble_store_value_cccd *value);
const struct ble_store_value_cccd *value);
void ble_store_key_from_value(int obj_type,
union ble_store_key *out_key,
union ble_store_value *value);
const union ble_store_value *value);
typedef int ble_store_iterator_fn(int obj_type,
union ble_store_value *val,
+3 -2
View File
@@ -66,7 +66,7 @@ ble_hs_pvcy_set_resolve_enabled(int enable)
}
int
ble_hs_pvcy_remove_entry(uint8_t addr_type, uint8_t *addr)
ble_hs_pvcy_remove_entry(uint8_t addr_type, const uint8_t *addr)
{
uint8_t buf[BLE_HCI_CMD_HDR_LEN + BLE_HCI_RMV_FROM_RESOLV_LIST_LEN];
int rc;
@@ -105,7 +105,8 @@ ble_hs_pvcy_clear_entries(void)
}
int
ble_hs_pvcy_add_entry(uint8_t *addr, uint8_t addr_type, uint8_t *irk)
ble_hs_pvcy_add_entry(const uint8_t *addr, uint8_t addr_type,
const uint8_t *irk)
{
struct hci_add_dev_to_resolving_list add;
uint8_t buf[BLE_HCI_CMD_HDR_LEN + BLE_HCI_ADD_TO_RESOLV_LIST_LEN];
+3 -2
View File
@@ -28,8 +28,9 @@ extern "C" {
int ble_hs_pvcy_set_our_irk(const uint8_t *irk);
int ble_hs_pvcy_our_irk(const uint8_t **out_irk);
int ble_hs_pvcy_remove_entry(uint8_t addr_type, uint8_t *addr);
int ble_hs_pvcy_add_entry(uint8_t *addr, uint8_t addrtype, uint8_t *irk);
int ble_hs_pvcy_remove_entry(uint8_t addr_type, const uint8_t *addr);
int ble_hs_pvcy_add_entry(const uint8_t *addr, uint8_t addrtype,
const uint8_t *irk);
int ble_hs_pvcy_ensure_started(void);
#ifdef __cplusplus
+17 -16
View File
@@ -23,7 +23,7 @@
#include "ble_hs_priv.h"
int
ble_store_read(int obj_type, union ble_store_key *key,
ble_store_read(int obj_type, const union ble_store_key *key,
union ble_store_value *val)
{
int rc;
@@ -38,7 +38,7 @@ ble_store_read(int obj_type, union ble_store_key *key,
}
int
ble_store_write(int obj_type, union ble_store_value *val)
ble_store_write(int obj_type, const union ble_store_value *val)
{
int rc;
@@ -52,7 +52,7 @@ ble_store_write(int obj_type, union ble_store_value *val)
}
int
ble_store_delete(int obj_type, union ble_store_key *key)
ble_store_delete(int obj_type, const union ble_store_key *key)
{
int rc;
@@ -66,7 +66,7 @@ ble_store_delete(int obj_type, union ble_store_key *key)
}
int
ble_store_read_our_sec(struct ble_store_key_sec *key_sec,
ble_store_read_our_sec(const struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_sec)
{
union ble_store_value *store_value;
@@ -84,7 +84,8 @@ ble_store_read_our_sec(struct ble_store_key_sec *key_sec,
}
static int
ble_store_persist_sec(int obj_type, struct ble_store_value_sec *value_sec)
ble_store_persist_sec(int obj_type,
const struct ble_store_value_sec *value_sec)
{
union ble_store_value *store_value;
int rc;
@@ -101,7 +102,7 @@ ble_store_persist_sec(int obj_type, struct ble_store_value_sec *value_sec)
}
int
ble_store_write_our_sec(struct ble_store_value_sec *value_sec)
ble_store_write_our_sec(const struct ble_store_value_sec *value_sec)
{
int rc;
@@ -110,7 +111,7 @@ ble_store_write_our_sec(struct ble_store_value_sec *value_sec)
}
int
ble_store_delete_our_sec(struct ble_store_key_sec *key_sec)
ble_store_delete_our_sec(const struct ble_store_key_sec *key_sec)
{
union ble_store_key *store_key;
int rc;
@@ -121,7 +122,7 @@ ble_store_delete_our_sec(struct ble_store_key_sec *key_sec)
}
int
ble_store_delete_peer_sec(struct ble_store_key_sec *key_sec)
ble_store_delete_peer_sec(const struct ble_store_key_sec *key_sec)
{
union ble_store_key *store_key;
int rc;
@@ -132,7 +133,7 @@ ble_store_delete_peer_sec(struct ble_store_key_sec *key_sec)
}
int
ble_store_read_peer_sec(struct ble_store_key_sec *key_sec,
ble_store_read_peer_sec(const struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_sec)
{
union ble_store_value *store_value;
@@ -154,7 +155,7 @@ ble_store_read_peer_sec(struct ble_store_key_sec *key_sec,
}
int
ble_store_write_peer_sec(struct ble_store_value_sec *value_sec)
ble_store_write_peer_sec(const struct ble_store_value_sec *value_sec)
{
int rc;
@@ -180,7 +181,7 @@ ble_store_write_peer_sec(struct ble_store_value_sec *value_sec)
}
int
ble_store_read_cccd(struct ble_store_key_cccd *key,
ble_store_read_cccd(const struct ble_store_key_cccd *key,
struct ble_store_value_cccd *out_value)
{
union ble_store_value *store_value;
@@ -194,7 +195,7 @@ ble_store_read_cccd(struct ble_store_key_cccd *key,
}
int
ble_store_write_cccd(struct ble_store_value_cccd *value)
ble_store_write_cccd(const struct ble_store_value_cccd *value)
{
union ble_store_value *store_value;
int rc;
@@ -205,7 +206,7 @@ ble_store_write_cccd(struct ble_store_value_cccd *value)
}
int
ble_store_delete_cccd(struct ble_store_key_cccd *key)
ble_store_delete_cccd(const struct ble_store_key_cccd *key)
{
union ble_store_key *store_key;
int rc;
@@ -217,7 +218,7 @@ ble_store_delete_cccd(struct ble_store_key_cccd *key)
void
ble_store_key_from_value_cccd(struct ble_store_key_cccd *out_key,
struct ble_store_value_cccd *value)
const struct ble_store_value_cccd *value)
{
out_key->peer_addr = value->peer_addr;
out_key->chr_val_handle = value->chr_val_handle;
@@ -226,7 +227,7 @@ ble_store_key_from_value_cccd(struct ble_store_key_cccd *out_key,
void
ble_store_key_from_value_sec(struct ble_store_key_sec *out_key,
struct ble_store_value_sec *value)
const struct ble_store_value_sec *value)
{
out_key->peer_addr = value->peer_addr;
@@ -239,7 +240,7 @@ ble_store_key_from_value_sec(struct ble_store_key_sec *out_key,
void
ble_store_key_from_value(int obj_type,
union ble_store_key *out_key,
union ble_store_value *value)
const union ble_store_value *value)
{
switch (obj_type) {
case BLE_STORE_OBJ_TYPE_OUR_SEC:
@@ -27,10 +27,10 @@ extern "C" {
union ble_store_key;
union ble_store_value;
int ble_store_ram_read(int obj_type, union ble_store_key *key,
int ble_store_ram_read(int obj_type, const union ble_store_key *key,
union ble_store_value *value);
int ble_store_ram_write(int obj_type, union ble_store_value *val);
int ble_store_ram_delete(int obj_type, union ble_store_key *key);
int ble_store_ram_write(int obj_type, const union ble_store_value *val);
int ble_store_ram_delete(int obj_type, const union ble_store_key *key);
#ifdef __cplusplus
}
+19 -19
View File
@@ -48,7 +48,7 @@ static int ble_store_ram_num_cccds;
*****************************************************************************/
static void
ble_store_ram_print_value_sec(struct ble_store_value_sec *sec)
ble_store_ram_print_value_sec(const struct ble_store_value_sec *sec)
{
if (sec->ltk_present) {
BLE_HS_LOG(DEBUG, "ediv=%u rand=%llu authenticated=%d ltk=",
@@ -71,7 +71,7 @@ ble_store_ram_print_value_sec(struct ble_store_value_sec *sec)
}
static void
ble_store_ram_print_key_sec(struct ble_store_key_sec *key_sec)
ble_store_ram_print_key_sec(const struct ble_store_key_sec *key_sec)
{
if (ble_addr_cmp(&key_sec->peer_addr, BLE_ADDR_ANY)) {
BLE_HS_LOG(DEBUG, "peer_addr_type=%d peer_addr=",
@@ -86,11 +86,11 @@ ble_store_ram_print_key_sec(struct ble_store_key_sec *key_sec)
}
static int
ble_store_ram_find_sec(struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_secs,
ble_store_ram_find_sec(const struct ble_store_key_sec *key_sec,
const struct ble_store_value_sec *value_secs,
int num_value_secs)
{
struct ble_store_value_sec *cur;
const struct ble_store_value_sec *cur;
int skipped;
int i;
@@ -127,7 +127,7 @@ ble_store_ram_find_sec(struct ble_store_key_sec *key_sec,
}
static int
ble_store_ram_read_our_sec(struct ble_store_key_sec *key_sec,
ble_store_ram_read_our_sec(const struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_sec)
{
int idx;
@@ -143,7 +143,7 @@ ble_store_ram_read_our_sec(struct ble_store_key_sec *key_sec,
}
static int
ble_store_ram_write_our_sec(struct ble_store_value_sec *value_sec)
ble_store_ram_write_our_sec(const struct ble_store_value_sec *value_sec)
{
struct ble_store_key_sec key_sec;
int idx;
@@ -191,7 +191,7 @@ ble_store_ram_delete_obj(void *values, int value_size, int idx,
}
static int
ble_store_ram_delete_sec(struct ble_store_key_sec *key_sec,
ble_store_ram_delete_sec(const struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_secs,
int *num_value_secs)
{
@@ -213,7 +213,7 @@ ble_store_ram_delete_sec(struct ble_store_key_sec *key_sec,
}
static int
ble_store_ram_delete_our_sec(struct ble_store_key_sec *key_sec)
ble_store_ram_delete_our_sec(const struct ble_store_key_sec *key_sec)
{
int rc;
@@ -227,7 +227,7 @@ ble_store_ram_delete_our_sec(struct ble_store_key_sec *key_sec)
}
static int
ble_store_ram_delete_peer_sec(struct ble_store_key_sec *key_sec)
ble_store_ram_delete_peer_sec(const struct ble_store_key_sec *key_sec)
{
int rc;
@@ -241,7 +241,7 @@ ble_store_ram_delete_peer_sec(struct ble_store_key_sec *key_sec)
}
static int
ble_store_ram_read_peer_sec(struct ble_store_key_sec *key_sec,
ble_store_ram_read_peer_sec(const struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_sec)
{
int idx;
@@ -257,7 +257,7 @@ ble_store_ram_read_peer_sec(struct ble_store_key_sec *key_sec,
}
static int
ble_store_ram_write_peer_sec(struct ble_store_value_sec *value_sec)
ble_store_ram_write_peer_sec(const struct ble_store_value_sec *value_sec)
{
struct ble_store_key_sec key_sec;
int idx;
@@ -288,7 +288,7 @@ ble_store_ram_write_peer_sec(struct ble_store_value_sec *value_sec)
*****************************************************************************/
static int
ble_store_ram_find_cccd(struct ble_store_key_cccd *key)
ble_store_ram_find_cccd(const struct ble_store_key_cccd *key)
{
struct ble_store_value_cccd *cccd;
int skipped;
@@ -322,8 +322,8 @@ ble_store_ram_find_cccd(struct ble_store_key_cccd *key)
}
static int
ble_store_ram_read_cccd(struct ble_store_key_cccd *key_cccd,
struct ble_store_value_cccd *value_cccd)
ble_store_ram_read_cccd(const struct ble_store_key_cccd *key_cccd,
struct ble_store_value_cccd *value_cccd)
{
int idx;
@@ -337,7 +337,7 @@ ble_store_ram_read_cccd(struct ble_store_key_cccd *key_cccd,
}
static int
ble_store_ram_write_cccd(struct ble_store_value_cccd *value_cccd)
ble_store_ram_write_cccd(const struct ble_store_value_cccd *value_cccd)
{
struct ble_store_key_cccd key_cccd;
int idx;
@@ -369,7 +369,7 @@ ble_store_ram_write_cccd(struct ble_store_value_cccd *value_cccd)
* @return 0 if a key was found; else BLE_HS_ENOENT.
*/
int
ble_store_ram_read(int obj_type, union ble_store_key *key,
ble_store_ram_read(int obj_type, const union ble_store_key *key,
union ble_store_value *value)
{
int rc;
@@ -413,7 +413,7 @@ ble_store_ram_read(int obj_type, union ble_store_key *key,
* full.
*/
int
ble_store_ram_write(int obj_type, union ble_store_value *val)
ble_store_ram_write(int obj_type, const union ble_store_value *val)
{
int rc;
@@ -436,7 +436,7 @@ ble_store_ram_write(int obj_type, union ble_store_value *val)
}
int
ble_store_ram_delete(int obj_type, union ble_store_key *key)
ble_store_ram_delete(int obj_type, const union ble_store_key *key)
{
int rc;
+2 -2
View File
@@ -74,9 +74,9 @@ ble_gatts_notify_test_events[BLE_GATTS_NOTIFY_TEST_MAX_EVENTS];
static int ble_gatts_notify_test_num_events;
typedef int ble_store_write_fn(int obj_type, union ble_store_value *val);
typedef int ble_store_write_fn(int obj_type, const union ble_store_value *val);
typedef int ble_store_delete_fn(int obj_type, union ble_store_key *key);
typedef int ble_store_delete_fn(int obj_type, const union ble_store_key *key);
static int
ble_gatts_notify_test_util_gap_event(struct ble_gap_event *event, void *arg)
+3 -3
View File
@@ -2320,7 +2320,7 @@ ble_hs_test_util_num_peer_secs(void)
}
static int
ble_hs_test_util_store_read(int obj_type, union ble_store_key *key,
ble_hs_test_util_store_read(int obj_type, const union ble_store_key *key,
union ble_store_value *value)
{
int rc;
@@ -2335,7 +2335,7 @@ ble_hs_test_util_store_read(int obj_type, union ble_store_key *key,
}
static int
ble_hs_test_util_store_write(int obj_type, union ble_store_value *value)
ble_hs_test_util_store_write(int obj_type, const union ble_store_value *value)
{
int rc;
@@ -2348,7 +2348,7 @@ ble_hs_test_util_store_write(int obj_type, union ble_store_value *value)
}
static int
ble_hs_test_util_store_delete(int obj_type, union ble_store_key *key)
ble_hs_test_util_store_delete(int obj_type, const union ble_store_key *key)
{
int rc;