An internal module of Peer Manager. This module keeps track of which peer IDs are in use and which are free.
More...
An internal module of Peer Manager. This module keeps track of which peer IDs are in use and which are free.
Function for claiming an unused peer ID.
- Parameters
-
peer_id | The peer ID to allocate. If this is PM_PEER_ID_INVALID, the first available will be allocated. |
- Returns
- The allocated peer ID.
- Return values
-
PM_PEER_ID_INVALID | If no peer ID could be allocated or module is not initialized. |
Function for freeing a peer ID and clearing all data associated with it in persistent storage.
- Parameters
-
[in] | peer_id | Peer ID to free. |
Function for finding out whether a peer ID is in use.
- Parameters
-
[in] | peer_id | The peer ID to inquire about. |
- Return values
-
true | peer_id is in use. |
false | peer_id is free, or the module is not initialized. |
uint32_t peer_id_n_ids |
( |
void |
| ) |
|
Function for querying the number of valid peer IDs available. I.E the number of peers in persistent storage.
- Returns
- The number of valid peer IDs, or 0 if module is not initialized.
Function for getting the next peer ID in the sequence of all used peer IDs. Can be used to loop through all used peer IDs.
- Note
- PM_PEER_ID_INVALID is considered to be before the first and after the last ordinary peer ID.
- Parameters
-
[in] | prev_peer_id | The previous peer ID. |
- Returns
- The next peer ID.
-
The first used peer ID if prev_peer_id was PM_PEER_ID_INVALID.
- Return values
-
PM_PEER_ID_INVALID | if prev_peer_id was the last ordinary peer ID or the module is not initialized. |