Port database for sockets. More...
Functions |
|
| uint32_t | portdb_init (uint32_t max_len) |
|
Function for initializing the port database.
More...
|
|
| void | portdb_deinit (void) |
|
Function for deinitializing the portdb.
More...
|
|
| void | portdb_reset (void) |
|
Function to reset all ports without freeing any memories.
|
|
| uint32_t | portdb_alloc (uint16_t *p_port) |
|
Function for allocating a port.
More...
|
|
| uint32_t | portdb_register (uint16_t port) |
|
Function for registering a port.
More...
|
|
| void | portdb_free (uint16_t port) |
|
Function for freeing a port.
More...
|
|
Detailed Description
Port database for sockets.
The port database provides a functionality for registering, allocating, and freeing ports.
Function Documentation
| uint32_t portdb_alloc | ( | uint16_t * | p_port | ) |
Function for allocating a port.
Looks for an available port in the database and allocates it to the caller.
- Parameters
-
[out] p_port Pointer to a variable where the allocated port number should be stored.
- Return values
-
NRF_SUCCESS If a free port was located and successfully allocated. SOCKET_NO_AVAILABLE_PORTS If no available ports were found.
| void portdb_deinit | ( | void | ) |
Function for deinitializing the portdb.
This will free all memory allocated by this portdb.
| void portdb_free | ( | uint16_t | port | ) |
Function for freeing a port.
Mark a given port as free and make it available for others to register or allocate.
- Parameters
-
[in] port The port to mark as free.
| uint32_t portdb_init | ( | uint32_t | max_len | ) |
Function for initializing the port database.
This must be called before allocating and freeing ports.
- Parameters
-
max_len The max length of the portdb.
- Return values
-
NRF_SUCCESS If successfully initialized.
| uint32_t portdb_register | ( | uint16_t | port | ) |
Function for registering a port.
Marks a given port in the database as being in use.
- Parameters
-
[in] port The port to mark as in use.
- Return values
-
NRF_SUCCESS If port was successfully marked as in use. SOCKET_NO_AVAILABLE_PORTS If there was no slot in which to register the port. SOCKET_PORT_IN_USE If the port has already been registered or allocated.