The declarations in this header file correspond to the definitions in payload.c.
More...
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include "private_avm.h"
#include "cdi_core_api.h"
#include "cdi_pool_api.h"
Go to the source code of this file.
|
typedef struct CdiPacketizerState * | CdiPacketizerStateHandle |
| An opaque type for the packetizer to keep track of its progress in case it must be suspended for lack of resources.
|
|
typedef struct CdiConnectionState | CdiConnectionState |
| Forward reference of structure to create pointers later.
|
|
typedef struct TxPayloadState | TxPayloadState |
| Forward reference of structure to create pointers later.
|
|
typedef struct CdiRawPacketHeader | CdiRawPacketHeader |
| Forward reference of structure to create pointers later.
|
|
typedef struct CdiRawExtraPacketHeader | CdiRawExtraPacketHeader |
| Forward reference of structure to create pointers later.
|
|
typedef struct CdiProtocol | CdiProtocol |
| Forward reference of structure to create pointers later.
|
|
typedef struct CdiProtocol * | CdiProtocolHandle |
| Forward reference of structure to create pointers later.
|
|
The declarations in this header file correspond to the definitions in payload.c.
◆ TxPayloadState
typedef struct TxPayloadState TxPayloadState |
Forward reference of structure to create pointers later.
Forward reference of structure to allow pointer creation.
◆ CdiPayloadType
Enumeration used to identify packet type.
Enumerator |
---|
kPayloadTypeData | Payload contains application payload data.
|
kPayloadTypeDataOffset | Payload contains application payload data with data offset field in each packet.
|
kPayloadTypeProbe | Payload contains probe data.
|
kPayloadTypeKeepAlive | Payload is being used for keeping the connection alive (don't use app payload callbacks).
|
◆ PayloadInit()
Initialize an CdiPayloadPacketState structure before using CdiPayloadPacketizerPacketGet() to split the payload into packets. NOTE: If an error occurs, caller is responsible for freeing the pool buffers that it allocates.
- Parameters
-
con_state_ptr | Pointer to connection state data. |
source_sgl_ptr | Pointer to Tx Payload source SGL list. |
payload_state_ptr | Pointer to payload state data. |
- Returns
- true if successful, otherwise an error occurred.
◆ PayloadPacketizerCreate()
Creates a packetizer state object. This must be destroyed with CdiPayloadPacketizerDestroy() when the connection is closed.
- Returns
- Handle for the created packetizer state or NULL if the creation failed.
◆ PayloadPacketizerDestroy()
Frees the memory previously allocated for a packetizer state object through CdiPayloadPacketizerCreate().
- Parameters
-
packetizer_state_handle | The handle of the packetizer state to be destroyed. |
◆ PayloadPacketizerPacketGet()
Get the next packet for a payload. Must use CdiPayloadPacketizerStateInit() for a new payload before using this function. If false is returned, one of the pools from which required resources are taken is dry so this function should be called again until it returns true.
NOTE: All the pools used in this function are not thread-safe, so must ensure that only one thread is accessing them at a time.
- Parameters
-
protocol_handle | Handle of protocol to use. |
packetizer_state_handle | Handle of the packetizer state for this connection. |
header_ptr | Pointer to the header data structure to be filled in for the new packet. |
header_buffer_size | Size of header data buffer in bytes. |
packet_sgl_entry_pool_handle | CDI packet SGL list entry pool. |
payload_state_ptr | Pointer to payload state data. |
packet_sgl_ptr | Pointer to returned packet SGL list |
ret_is_last_packet_ptr | Pointer to returned last packet state. True if last packet, otherwise false. |
- Returns
- true if packet returned, otherwise a pool was empty so false is returned.
◆ PayloadPacketizerStateInit()
Initializes a packetizer state object. This function should be called before calling CdiPayloadPacketizerPacketGet() the first time for a given payload.
- Parameters
-
packetizer_state_handle | Handle of packetizer object. |