5.11.0.0R3
Software Development Kit
 
Loading...
Searching...
No Matches
Packet management

Functions

wiced_result_t wiced_buffer_eap_set_data_end (void *ptr, uint8_t *data_end)
 
wiced_result_t wiced_buffer_eap_set_data_start (void *ptr, uint8_t *data_start)
 
wiced_result_t wiced_packet_create (uint16_t content_length, wiced_packet_t **packet, uint8_t **data, uint16_t *available_space)
 
wiced_result_t wiced_packet_create_tcp (wiced_tcp_socket_t *socket, uint16_t content_length, wiced_packet_t **packet, uint8_t **data, uint16_t *available_space)
 
wiced_result_t wiced_packet_create_udp (wiced_udp_socket_t *socket, uint16_t content_length, wiced_packet_t **packet, uint8_t **data, uint16_t *available_space)
 
wiced_result_t wiced_packet_create_udp_no_wait (wiced_udp_socket_t *socket, uint16_t content_length, wiced_packet_t **packet, uint8_t **data, uint16_t *available_space)
 
wiced_result_t wiced_packet_delete (wiced_packet_t *packet)
 
wiced_result_t wiced_packet_get_data (wiced_packet_t *packet, uint16_t offset, uint8_t **data, uint16_t *fragment_available_data_length, uint16_t *total_available_data_length)
 
wiced_result_t wiced_packet_get_next_fragment (wiced_packet_t *packet, wiced_packet_t **next_packet_fragment)
 
wiced_result_t wiced_packet_pool_allocate_packet (wiced_packet_pool_ref packet_pool, wiced_packet_type_t packet_type, wiced_packet_t **packet, uint8_t **data, uint16_t *available_space, uint32_t timeout)
 
wiced_result_t wiced_packet_pool_deinit (wiced_packet_pool_ref packet_pool)
 
wiced_result_t wiced_packet_pool_init (wiced_packet_pool_ref packet_pool, uint8_t *memory_pointer, uint32_t memory_size, char *pool_name)
 
wiced_result_t wiced_packet_set_data_end (wiced_packet_t *packet, uint8_t *data_end)
 
wiced_result_t wiced_packet_set_data_start (wiced_packet_t *packet, uint8_t *data_start)
 

Detailed Description

Functions for allocating/releasing/processing packets from the WICED packet pool

Function Documentation

◆ wiced_buffer_eap_set_data_end()

wiced_result_t wiced_buffer_eap_set_data_end ( void * ptr,
uint8_t * data_end )

Set the size of data in a packet

If data has been added to a packet, this function should be called to ensure the packet length is updated

Parameters
[in,out]ptr: The packet handle
[in]data_end: A pointer to the address immediately after the last data byte in the packet buffer
Returns
wiced_result_t

◆ wiced_buffer_eap_set_data_start()

wiced_result_t wiced_buffer_eap_set_data_start ( void * ptr,
uint8_t * data_start )

Set the size of data in a packet

If data has been processed in this packet, this function should be called to ensure calls to wiced_packet_get_data() skip the processed data.

Parameters
[in,out]ptr: The packet handle
[in]data_start: A pointer to the address immediately after the last processed byte in the packet buffer
Returns
wiced_result_t

◆ wiced_packet_create()

wiced_result_t wiced_packet_create ( uint16_t content_length,
wiced_packet_t ** packet,
uint8_t ** data,
uint16_t * available_space )

Allocates a general packet from the pool but it doesn't wait for memory instead returns error immediately

Allocates a general packet from the main packet pool. Packet will not be usable for TCP/UDP as it will not have the required headers.

Note
: Packets are fixed size. and applications must be very careful to avoid writing past the end of the packet buffer. The available_space parameter should be used for this.
Parameters
[in]content_length: The intended length of content if known. (This can be adjusted at a later point with wiced_packet_set_data_end if not known)
[out]packet: Pointer to a packet handle which will receive the allocated packet
[out]data: Pointer pointer which will receive the data pointer for the packet. This is where data should be written
[out]available_space: Pointer to a variable which will receive the space available for data in the packet in bytes
Returns
wiced_result_t

◆ wiced_packet_create_tcp()

wiced_result_t wiced_packet_create_tcp ( wiced_tcp_socket_t * socket,
uint16_t content_length,
wiced_packet_t ** packet,
uint8_t ** data,
uint16_t * available_space )

Allocates a TCP packet from the pool

Allocates a TCP packet from the main packet pool.

Note
: Packets are fixed size. and applications must be very careful to avoid writing past the end of the packet buffer. The available_space parameter should be used for this.
Parameters
[in,out]socket: An open TCP socket for which the packet should be created
[in]content_length: The intended length of TCP content if known. (This can be adjusted at a later point with wiced_packet_set_data_end if not known)
[out]packet: Pointer to a packet handle which will receive the allocated packet
[out]data: Pointer pointer which will receive the data pointer for the packet. This is where TCP data should be written
[out]available_space: Pointer to a variable which will receive the space available for TCP data in the packet in bytes
Returns
wiced_result_t

◆ wiced_packet_create_udp()

wiced_result_t wiced_packet_create_udp ( wiced_udp_socket_t * socket,
uint16_t content_length,
wiced_packet_t ** packet,
uint8_t ** data,
uint16_t * available_space )

Allocates a UDP packet from the pool

Allocates a UDP packet from the main packet pool.

Note
: Packets are fixed size. and applications must be very careful to avoid writing past the end of the packet buffer. The available_space parameter should be used for this.
Parameters
[in,out]socket: An open UDP socket for which the packet should be created
[in]content_length: The intended length of UDP content if known. (This can be adjusted at a later point with wiced_packet_set_data_end if not known)
[out]packet: Pointer to a packet handle which will receive the allocated packet
[out]data: Pointer pointer which will receive the data pointer for the packet. This is where UDP data should be written
[out]available_space: Pointer to a variable which will receive the space available for UDP data in the packet in bytes
Returns
wiced_result_t

◆ wiced_packet_create_udp_no_wait()

wiced_result_t wiced_packet_create_udp_no_wait ( wiced_udp_socket_t * socket,
uint16_t content_length,
wiced_packet_t ** packet,
uint8_t ** data,
uint16_t * available_space )

Allocates a UDP packet from the pool

Allocates a UDP packet from the main packet pool.

Note
: Packets are fixed size. and applications must be very careful to avoid writing past the end of the packet buffer. The available_space parameter should be used for this.
Parameters
[in,out]socket: An open UDP socket for which the packet should be created
[in]content_length: The intended length of UDP content if known. (This can be adjusted at a later point with wiced_packet_set_data_end if not known)
[out]packet: Pointer to a packet handle which will receive the allocated packet
[out]data: Pointer pointer which will receive the data pointer for the packet. This is where UDP data should be written
[out]available_space: Pointer to a variable which will receive the space available for UDP data in the packet in bytes
Returns
wiced_result_t

◆ wiced_packet_delete()

wiced_result_t wiced_packet_delete ( wiced_packet_t * packet)

Releases a packet back to the pool

Releases a packet that is in use, back to the main packet pool, allowing re-use.

Parameters
[in,out]packet: The packet to be released
Returns
wiced_result_t

◆ wiced_packet_get_data()

wiced_result_t wiced_packet_get_data ( wiced_packet_t * packet,
uint16_t offset,
uint8_t ** data,
uint16_t * fragment_available_data_length,
uint16_t * total_available_data_length )

Gets a data buffer pointer for a packet

Retrieves a data buffer pointer for a given packet handle at a particular offset. For fragmented packets, the offset input is used to traverse through the packet chain.

Parameters
[in,out]packet: The packet handle for which to get a data pointer
[in]offset: The offset from the starting address.
[out]data: A pointer which will receive the data pointer
[out]fragment_available_data_length: Receives the length of data in the current fragment after the specified offset
[out]total_available_data_length: Receives the total length of data in the all fragments after the specified offset
Returns
wiced_result_t

◆ wiced_packet_get_next_fragment()

wiced_result_t wiced_packet_get_next_fragment ( wiced_packet_t * packet,
wiced_packet_t ** next_packet_fragment )

Get the next fragment from a packet chain

Retrieves the next fragment from a given packet handle

Parameters
[in]packet: The packet handle
[out]next_packet_fragment: The packet handle of the next fragment
Returns
wiced_result_t

◆ wiced_packet_pool_allocate_packet()

wiced_result_t wiced_packet_pool_allocate_packet ( wiced_packet_pool_ref packet_pool,
wiced_packet_type_t packet_type,
wiced_packet_t ** packet,
uint8_t ** data,
uint16_t * available_space,
uint32_t timeout )

Allocates a general packet from the specified packet pool

Allocates the desired packet type from the packet pool. Care must be taken to allocate the correct packet type to make sure that the packet has the proper headers for use by the network layer.

Note
: Packets are fixed size. and applications must be very careful to avoid writing past the end of the packet buffer. The available_space parameter should be used for this.
Parameters
[in]packet_pool: Handle to the packet pool
[in]packet_type: Type of packet to allocate
[out]packet: Pointer to a packet handle which will receive the allocated packet
[out]data: Pointer pointer which will receive the data pointer for the packet. This is where data should be written
[out]available_space: Pointer to a variable which will receive the space available for data in the packet in bytes
[in]timeout: Timeout value in milliseconds or WICED_NEVER_TIMEOUT
Returns
wiced_result_t

◆ wiced_packet_pool_deinit()

wiced_result_t wiced_packet_pool_deinit ( wiced_packet_pool_ref packet_pool)

Destroy a network packet pool

Parameters
[in,out]packet_pool: A pointer to a packet pool handle that will be de-initialized
Returns
wiced_result_t

◆ wiced_packet_pool_init()

wiced_result_t wiced_packet_pool_init ( wiced_packet_pool_ref packet_pool,
uint8_t * memory_pointer,
uint32_t memory_size,
char * pool_name )

Creates a network packet pool from a chunk of memory

Parameters
[out]packet_pool: Handle to a packet pool instance which will be initialized
[in]memory_pointer: Pointer to a chunk of memory
[in]memory_size: Size of the memory chunk
[in]pool_name: Packet pool name string
Returns
wiced_result_t

◆ wiced_packet_set_data_end()

wiced_result_t wiced_packet_set_data_end ( wiced_packet_t * packet,
uint8_t * data_end )

Set the size of data in a packet

If data has been added to a packet, this function should be called to ensure the packet length is updated

Parameters
[in,out]packet: The packet handle
[in]data_end: A pointer to the address immediately after the last data byte in the packet buffer
Returns
wiced_result_t

◆ wiced_packet_set_data_start()

wiced_result_t wiced_packet_set_data_start ( wiced_packet_t * packet,
uint8_t * data_start )

Set the size of data in a packet

If data has been processed in this packet, this function should be called to ensure calls to wiced_packet_get_data() skip the processed data.

Parameters
[in,out]packet: The packet handle
[in]data_start: A pointer to the address immediately after the last processed byte in the packet buffer
Returns
wiced_result_t