ble/peer.h header reference
[Bluetooth Low Energy library module]
The source code of this header can be browsed online.
Description [link]
this header contains definitions for peer data definitions.
Members [link]
Types [link]
- struct ble_peer_s
- struct ble_subscription_s
Functions [link]
- void ble_peer_addr_set(struct ble_peer_s *peer, const struct ble_addr_s *addr)
- error_t ble_peer_csrk_get(struct ble_peer_s *peer, uint8_t *csrk)
- error_t ble_peer_id_get(struct ble_peer_s *peer, uint8_t *random, uint16_t *ediv)
- void ble_peer_identity_set(struct ble_peer_s *peer, uint16_t ediv, const uint8_t *rand)
- void ble_peer_init(struct ble_peer_s *peer, struct ble_security_db_s *db, const struct ble_addr_s *addr)
- void ble_peer_irk_set(struct ble_peer_s *peer, const uint8_t *irk)
- error_t ble_peer_ltk_get(struct ble_peer_s *peer, uint8_t *ltk)
- void ble_peer_ltk_set(struct ble_peer_s *peer, const uint8_t *ltk)
- error_t ble_peer_master_sk_get(struct ble_peer_s *peer, const uint8_t skd[static 16], uint16_t ediv[static 1], uint8_t rand[static 8], uint8_t sk[static 16])
- error_t ble_peer_paired(struct ble_peer_s *peer, bool_t bonded, bool_t mitm_protection, bool_t secure_pairing, const uint8_t *stk)
- error_t ble_peer_reset(struct ble_peer_s *peer)
- error_t ble_peer_save(struct ble_peer_s *peer)
- error_t ble_peer_sk_get(struct ble_peer_s *peer, const uint8_t *skd, const uint8_t *rand, const uint16_t ediv, uint8_t *sk)
- void ble_peer_subscriptions_set(struct ble_peer_s *peer, struct ble_subscription_s subscriptions[static 8])
Members detail [link]
#define BLE_PEER_H_ [link]
This macro is declared in ble/peer.h source file, line 21.
#define BLE_SUBSCRIBED_CHAR_COUNT [link]
This macro is declared in ble/peer.h source file, line 40.
void ble_peer_addr_set(struct ble_peer_s *peer, const struct ble_addr_s *addr) [link]
This function is declared in ble/peer.h source file, line 139.
this function sets peer's public address
error_t ble_peer_csrk_get(struct ble_peer_s *peer, uint8_t *csrk) [link]
This function is declared in ble/peer.h source file, line 162.
this function retrieves peer-distributed CSRK
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )) and ( defined( CONFIG_BLE_SECURITY_DB )
error_t ble_peer_id_get(struct ble_peer_s *peer, uint8_t *random, uint16_t *ediv) [link]
This function is declared in ble/peer.h source file, line 166.
this function retrieves peer-distributed identification
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )) and ( defined( CONFIG_BLE_SECURITY_DB )
void ble_peer_identity_set(struct ble_peer_s *peer, uint16_t ediv, const uint8_t *rand) [link]
This function is declared in ble/peer.h source file, line 193.
this function sets peer-distributed identity
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )
void ble_peer_init(struct ble_peer_s *peer, struct ble_security_db_s *db, const struct ble_addr_s *addr) [link]
This function is declared in ble/peer.h source file, line 129.
this function initializes a peer as member of a given peer database with a given lookup adress. Depending on lookup address, peer data may or may not be filled from database.
void ble_peer_irk_set(struct ble_peer_s *peer, const uint8_t *irk) [link]
This function is declared in ble/peer.h source file, line 170.
this function sets peer-distributed IRK
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )) and ( defined( CONFIG_BLE_SECURITY_DB )
error_t ble_peer_ltk_get(struct ble_peer_s *peer, uint8_t *ltk) [link]
This function is declared in ble/peer.h source file, line 158.
this function retrieves peer-distributed LTK
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )) and ( defined( CONFIG_BLE_SECURITY_DB )
void ble_peer_ltk_set(struct ble_peer_s *peer, const uint8_t *ltk) [link]
This function is declared in ble/peer.h source file, line 188.
this function sets peer-distributed LTK
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )
error_t ble_peer_master_sk_get(struct ble_peer_s *peer, const uint8_t skd[static 16], uint16_t ediv[static 1], uint8_t rand[static 8], uint8_t sk[static 16]) [link]
This function is declared in ble/peer.h source file, line 202.
this function retrieves a session key from peer when we are the master side of connection.
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )
error_t ble_peer_paired(struct ble_peer_s *peer, bool_t bonded, bool_t mitm_protection, bool_t secure_pairing, const uint8_t *stk) [link]
This function is declared in ble/peer.h source file, line 178.
this function marks peer as paired.
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )
error_t ble_peer_reset(struct ble_peer_s *peer) [link]
This function is declared in ble/peer.h source file, line 134.
this function resets peer data, only lookup address is preserved.
struct ble_peer_s [link]
This struct is declared in ble/gattdb/client.h source file, line 50.
this struct is data associated to a peer. Peer can be identified from its adrress before connection, or from its Peer ID on encryption request. Some entries in this object are derived from calculations, other are distributed by the peer itself on pairing and are saved verbatim.
Peer also contains subscription information, which is the list of characteristics the peer subscribed to during last connection. They are saved/restored by GATT server.
Field | Description |
---|---|
struct ble_subscription_s subscriptions[8]; | Subscription list |
uint64_t id; | Peer serial ID, allocated on pairing |
struct ble_addr_s lookup_addr; | Peer lookup address, this may contain a resolvable address or public device address. |
struct ble_addr_s addr; | Peer public address |
uint8_t rand[8]; | Peer-distributed rand |
uint16_t ediv; | Peer-distributed ediv |
uint8_t ltk[16]; | Peer-distributed LTK |
uint8_t stk[16]; | STK negociated by SM during pairing Phase 2 |
uint8_t irk[16]; | Peer-distributed Identity Resolving Key |
struct ble_security_db_s * db; | Pointer to security DB context |
bool_t irk_present:1; | Whether peer has an associated IRK |
bool_t paired:1; | Whether peer is paired |
bool_t bonded:1; | Whether peer is bonded |
bool_t mitm_protection:1; | Whether peer requested MITM protection while pairing |
bool_t secure_pairing:1; | Whether pairing was secure |
bool_t stk_present:1; | Whether we currently hold a valid STK |
bool_t identity_present:1; | Whether peer rand and ediv are present |
bool_t ltk_present:1; | Whether peer LTK is valid |
bool_t addr_present:1; | Whether peer address is valid |
bool_t dirty:1; | Whether some data changed and should be flushed to non-volatile storage |
bool_t subscriptions_dirty:1; | Whether subscription changed and should be flushed to non-volatile storage |
error_t ble_peer_save(struct ble_peer_s *peer) [link]
This function is declared in ble/peer.h source file, line 183.
this function saves peer in persistent storage.
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )
error_t ble_peer_sk_get(struct ble_peer_s *peer, const uint8_t *skd, const uint8_t *rand, const uint16_t ediv, uint8_t *sk) [link]
This function is declared in ble/peer.h source file, line 152.
this function retrieves Session Key from entry when we are on the slave side of connection, either derived from LTK or STK, depending if present in peer.
Preprocessor condition: defined( CONFIG_BLE_CRYPTO )
void ble_peer_subscriptions_set(struct ble_peer_s *peer, struct ble_subscription_s subscriptions[static 8]) [link]
This function is declared in ble/peer.h source file, line 210.
this function retrieves the subscription list from security DB.
struct ble_subscription_s [link]
This struct is declared in ble/gattdb/client.h source file, line 55.
this struct is a subscription entry saved for a peer.
Field | Description |
---|---|
uint8_t registry_index:3; | |
uint8_t char_index:4; | |
uint8_t mode:1; |