nRF5 IoT SDK
v0.9.0
|
Packet buffer management for IPv6 stack layers to minimize data copy across stack layers. More...
Data Structures | |
struct | iot_pbuffer_t |
Packet buffer used for exchanging IPv6 payload across layers in both receive and transmit paths. More... | |
struct | iot_pbuffer_alloc_param_t |
Parameters required to allocate the packet buffer. More... | |
Enumerations | |
enum | iot_pbuffer_type_t { UNASSIGNED_TYPE = 0, RAW_PACKET_TYPE = 1, IPV6_PACKET_TYPE = 2, ICMP6_PACKET_TYPE = 3, UDP6_PACKET_TYPE = 4, COAP_PACKET_TYPE = 5 } |
IPv6 packet type identifiers that are needed to ensure that enough space is reserved for headers from layers below during memory allocation. More... | |
enum | iot_pbuffer_flags_t { PBUFFER_FLAG_DEFAULT = 0, PBUFFER_FLAG_NO_MEM_ALLOCATION = 1 } |
Additional information that must be provided to the module during allocation or reallocation to ensure optimal utilization of memory and avoid unnecessary data copies. More... | |
Functions | |
uint32_t | iot_pbuffer_init (void) |
Function for initializing the module. More... | |
uint32_t | iot_pbuffer_allocate (iot_pbuffer_alloc_param_t *p_param, iot_pbuffer_t **pp_pbuffer) |
Function for allocating a packet buffer. More... | |
uint32_t | iot_pbuffer_reallocate (iot_pbuffer_alloc_param_t *p_param, iot_pbuffer_t *p_pbuffer) |
Function for reallocating a packet buffer. More... | |
uint32_t | iot_pbuffer_free (iot_pbuffer_t *p_pbuffer, bool free_flag) |
Function for freeing a packet buffer. More... | |
Packet buffer management for IPv6 stack layers to minimize data copy across stack layers.
This module interfaces with the Memory Manager to allocate packet buffers for the IPv6 stack layers, without each layer having to ensure sufficient header space for layers below.
enum iot_pbuffer_flags_t |
Additional information that must be provided to the module during allocation or reallocation to ensure optimal utilization of memory and avoid unnecessary data copies.
enum iot_pbuffer_type_t |
IPv6 packet type identifiers that are needed to ensure that enough space is reserved for headers from layers below during memory allocation.
uint32_t iot_pbuffer_allocate | ( | iot_pbuffer_alloc_param_t * | p_param, |
iot_pbuffer_t ** | pp_pbuffer | ||
) |
Function for allocating a packet buffer.
[in] | p_param | Pointer to allocation parameters that indicate the length of the payload requested, the type of payload, and additional information using the flags. This parameter cannot be NULL. |
[out] | pp_pbuffer | Pointer to allocated packet buffer. This parameter shall not be NULL. |
NRF_SUCCESS | If the packet buffer was successfully allocated. Otherwise, an error code that indicates the reason for the failure is returned. |
uint32_t iot_pbuffer_free | ( | iot_pbuffer_t * | p_pbuffer, |
bool | free_flag | ||
) |
Function for freeing a packet buffer.
This function frees the packet buffer. If the parameter free_flag is set, the function tries to free the memory allocated as well. This action is performed irrespective of whether the memory was allocated using the PBUFFER_FLAG_DEFAULT or the PBUFFER_FLAG_NO_MEM_ALLOCATION flag.
[in] | p_pbuffer | Pointer to the packet buffer requested to be freed. This parameter shall not be NULL. |
[in] | free_flag | Indicates if the allocated memory should be freed or not when freeing the packet buffer. |
NRF_SUCCESS | If the packet buffer was successfully freed. Otherwise, an error code that indicates the reason for the failure is returned. |
uint32_t iot_pbuffer_init | ( | void | ) |
Function for initializing the module.
NRF_SUCCESS | If the module was successfully initialized. Otherwise, an error code that indicates the reason for the failure is returned. |
uint32_t iot_pbuffer_reallocate | ( | iot_pbuffer_alloc_param_t * | p_param, |
iot_pbuffer_t * | p_pbuffer | ||
) |
Function for reallocating a packet buffer.
Reallocation requests are treated as follows:
[in] | p_param | Pointer to reallocation parameters that indicate the length of the payload requested, the type of payload, and additional information using the flags. This parameter cannot be NULL. |
[in] | p_pbuffer | Pointer to the packet buffer being reallocated. This parameter shall not be NULL. |
NRF_SUCCESS | If the packet buffer was successfully reallocated. Otherwise, an error code that indicates the reason for the failure is returned. |