CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
This file contains internal definitions and implementation used with the SDK that is not part of the API. More...
#include "internal_rx.h"
#include <string.h>
#include "adapter_api.h"
#include "cdi_logger_api.h"
#include "cdi_pool_api.h"
#include "endpoint_manager.h"
#include "internal.h"
#include "private.h"
#include "private_avm.h"
#include "receive_buffer.h"
#include "rx_reorder_packets.h"
#include "rx_reorder_payloads.h"
#include "statistics.h"
Macros | |
#define | SIZE_OF_CDI_PACKET_AVM_WITH_CONFIG_SDK_1 (58) |
Size of CDIPacketAvmWithConfig structure used in SDK 1.x.x. | |
This file contains internal definitions and implementation used with the SDK that is not part of the API.
|
static |
Copy the packet payloads's contents to its proper location within the current linear receive payload buffer. It takes into account the case of packets with a data offset in the case where a packet's size somewhere in the payload was reduced to limit the number of SGL entries required.
con_state_ptr | Pointer to connection state structure. |
packet_ptr | Pointer to packet whose contents are to be copied. |
payload_state_ptr | Pointer to payload structure being updated. |
header_ptr | Pointer to CDI header that contains data to be added to payload state. |
|
static |
Finalizes the payload state. Call this once all data expected for the payload has been received.
con_state_ptr | Pointer to connection state structure. |
payload_state_ptr | Pointer to payload structure being updated. |
|
static |
Free payload memory state.
sgl_ptr | Pointer to payload scatter-gather list. |
|
static |
Free resources specific to a payload. Adapter packet resources are freed separately.
sgl_ptr | Pointer to payload scatter-gather list. |
|
static |
Initializes the state data for a payload. Call this when the first packet of a payload is received.
protocol_handle | Handle to protocol being used. |
endpoint_ptr | Pointer to endpoint state structure. |
packet_ptr | Pointer to the first packet received for a given payload. |
payload_state_ptr | Pointer to payload structure being updated. |
header_ptr | Pointer to decoded packet header. |
payload_memory_state_ptr | Pointer to location to write the address of a pool allocated CdiMemoryState structure. |
|
static |
Call the AVM payload user-registered callback function.
con_state_ptr | Pointer to connection state data. |
app_cb_data_ptr | Pointer to application callback data. |
core_cb_data_ptr | Pointer to core callback data. |
|
static |
Call the Raw payload user-registered callback function.
con_state_ptr | Pointer to connection state data. |
app_cb_data_ptr | Pointer to application callback data. |
core_cb_data_ptr | Pointer to core callback data. |
|
static |
Queue back pressure payload to application.
con_state_ptr | Pointer to connection state data. |
endpoint_ptr | Pointer to endpoint data. |
decoded_header_ptr | Pointer to decoded packet header. |
void RxConnectionDestroyInternal | ( | CdiConnectionHandle | con_handle | ) |
CdiReturnStatus RxCreateInternal | ( | CdiConnectionProtocolType | protocol_type, |
CdiRxConfigData * | config_data_ptr, | ||
CdiCallback | rx_cb_ptr, | ||
CdiConnectionHandle * | ret_handle_ptr ) |
Create a raw receiver connection.
protocol_type | Specifies the protocol for payload (E.g. RAW or AVM) |
config_data_ptr | Address of a structure with all of the parameters to use for setting up the connection. |
rx_cb_ptr | The address of a function which will be called whenever a payload is received from the remote host. |
ret_handle_ptr | An address which will receive the handle of the newly created connection. |
CdiReturnStatus RxEndpointCreateDynamicPools | ( | CdiEndpointHandle | handle | ) |
Create dynamically allocated memory pools for the specified endpoint.
handle | Handle of endpoint to create dynamic memory pools. |
void RxEndpointDestroy | ( | CdiEndpointHandle | handle | ) |
Destroy resources associated with the specified endpoint.
handle | Handle of endpoint to destroy. |
void RxEndpointFlushResources | ( | CdiEndpointState * | endpoint_ptr | ) |
Flush resources associated with Rx. NOTE: This function should only be called after the thread has been paused using EndpointManagerThreadWait().
endpoint_ptr | Pointer to endpoint to free resources. |
CdiReturnStatus RxEnqueueFreeBuffer | ( | const CdiSgList * | sgl_ptr | ) |
Enqueue to free the receive buffer.
sgl_ptr | The scatter-gather list containing the memory to be freed. |
void RxFreePayloadResources | ( | CdiEndpointState * | endpoint_ptr, |
RxPayloadState * | payload_state_ptr, | ||
bool | free_memory_state ) |
Free payload resources.
endpoint_ptr | Pointer to connection state structure. |
payload_state_ptr | Pointer to payload structure being updated. |
free_memory_state |
void RxInvokeAppPayloadCallback | ( | CdiConnectionState * | con_state_ptr, |
AppPayloadCallbackData * | app_cb_data_ptr ) |
Invoke the user registered Rx callback function for a payload.
con_state_ptr | Pointer to connection state data. |
app_cb_data_ptr | Pointer to application callback data. |
void RxPacketReceive | ( | void * | param_ptr, |
Packet * | packet_ptr, | ||
EndpointMessageType | message_type ) |
A packet has been received by the receiver. Need to reassemble it into a payload and send the payload SGL to the application.
param_ptr | Pointer to connection that the packet was received on as a void*. |
packet_ptr | Pointer to the received packet. |
message_type | Endpoint message type. |
bool RxPollFreeBuffer | ( | void * | param_ptr, |
CdiSgList * | ret_packet_buffer_sgl_ptr ) |
Called from PollThread() in the adapter to poll if any Rx buffers need to be freed. If there are any, this function will free payload level resources and then return a list of adapter packet buffer SGLs that need to be freed by the caller.
param_ptr | A pointer to data used by the function. |
ret_packet_buffer_sgl_ptr | Pointer to address where to write the returned packet buffer SGL that needs to be freed by the caller. |
void RxSendPayload | ( | CdiEndpointState * | endpoint_ptr, |
RxPayloadState * | send_payload_state_ptr ) |
Send the payload on to the next stage because it is complete or determined to be in error.
endpoint_ptr | Pointer to endpoint state structure. |
send_payload_state_ptr | Pointer to the payload state for the completed payload. |
|
static |
Function to set status code and optional error message string in the core callback and frees any receive buffer resources.
rs | Return status code. |
error_msg_str | Pointer to optional error message string. |
core_cb_data_ptr | Pointer to the core callback data structure. |
payload_sgl_ptr | Pointer to the payload SGL list to free. |
|
static |
Update application callback data with header packet sequence number 0.
app_payload_cb_data_ptr | Address where to write the application callback data. |
num0_info_ptr | Pointer to CDI header for packet sequence number 0. |
|
static |
Update payload state when header packet sequence number 0 arrives.
payload_state_ptr | Pointer to payload structure being updated. |
header_ptr | Pointer to CDI header that contains data to be added to payload state. |
|
static |
Update payload statistics data whenever a payload has either been successfully received or an error occurred while being received.
endpoint_ptr | Pointer to endpoint state data. |
work_request_ptr | Pointer to work request data. |