CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
cdi_core_api.h File Reference

This file declares the public API data types, structures and functions that comprise the CDI low-level transport SDK API. More...

#include <stdbool.h>
#include <stdint.h>
#include <time.h>
#include "cdi_log_enums.h"
#include "cdi_utility_api.h"

Go to the source code of this file.

Data Structures

struct  CdiPtpTimestamp
 A structure for holding a PTP timestamp defined in seconds and nanoseconds. This PTP time as defined by SMPTE ST 2059-2 and IEEE 1588-2008 with the exception that the seconds field is an unsigned 32 bit integer instead of the specified 48 bit integer. More...
 
struct  CdiCoreExtraData
 Extra data that is sent along with payloads to the receiver. It will be provided to the receiver through registered user receive data callback functions. More...
 
struct  CdiCoreTxPayloadConfig
 A structure used to configure a transmit payload. More...
 
struct  CdiCoreConnectionCbData
 A structure of this type is passed as the parameter to CdiCoreConnectionCallback(). It contains data related to the status of a single connection. More...
 
struct  CdiCoreCbData
 A structure of this type is passed as part of the data to the TX/RX registered user callback functions. It contains data related to the transmission of a single payload. More...
 
struct  CdiAdapterData
 Configuration data used by the CdiCoreNetworkAdapterInitialize() API function. More...
 
struct  CdiPayloadCounterStats
 Transfer statistics data specific to payloads that contain counters that increment for the duration of the connection. They are never reset. More...
 
struct  CdiPayloadTimeIntervalStats
 Transfer statistics data specific to payloads that are reset at the start of each time interval as specified using CdiStatsConfigData.stats_period_seconds. A snapshot of the current values is made and provided through the user-registered callback function CdiCoreStatsCallback(). More...
 
struct  CdiAdapterEndpointStats
 Transfer statistics data specific to an adapter endpoint. Used in the CdiTransferStats structure as a parameter of the user-registered CdiCoreStatsCallback() API function. More...
 
struct  CdiTransferStats
 Transfer statistics data. Used as a parameter of the user-registered CdiCoreStatsCallback() API function. More...
 
struct  CdiCoreStatsCbData
 A structure of this type is passed as the parameter to CdiCoreStatsCallback(). It contains data related to the statistics of a single connection. More...
 
struct  CdiStatsConfigData
 A structure that is used to hold statistics gathering configuration data. More...
 
struct  CdiTxConfigData
 Configuration data used by one of the Cdi...TxCreate() API functions. More...
 
struct  CdiSglEntry
 This structure represents a single, contiguous region of memory as part of a scatter-gather list. More...
 
struct  CdiSgList
 This structure defines a scatter-gather list (SGL) which is used to represent an array of data comprising one or more contiguous regions of memory. More...
 
struct  CdiRxConfigData
 Configuration data used by one of the Cdi...RxCreate() API functions. More...
 
struct  CdiCloudWatchConfigData
 A structure that is used to hold statistics gathering configuration data that is specific to CloudWatch. More...
 
struct  CdiCoreConfigData
 SDK configuration data used by the CdiCoreInitialize() API function. More...
 
struct  CdiCoreReadOnlySettings
 SDK read-only settings used internally by SDK. More...
 

Macros

#define _POSIX_C_SOURCE   200112L
 This define ensures that "struct timespec" is defined prior to using it.
 
#define CDI_SDK_VERSION   3
 CDI version.
 
#define CDI_SDK_MAJOR_VERSION   0
 CDI major version.
 
#define CDI_SDK_MINOR_VERSION   2
 CDI minor version.
 
#define CDI_PROTOCOL_VERSION   2
 CDI protocol version.
 
#define CDI_PROTOCOL_MAJOR_VERSION   3
 CDI protocol major version.
 
#define CDI_PROBE_VERSION   5
 CDI probe command version. Possible value are: For Protocol version 2.0 (CDI_PROTOCOL_VERSION.CDI_PROTOCOL_MAJOR_VERSION): 0: SDK 1.x.x. Only supports protocol version 1.0. 1: not used 2: SDK 2.0.x, Only supports protocol version 1.0 3: SDK 2.1.x. Supports the new protocol version command. See kProbeCommandProtocolVersion. Supports protocols version 1.0 and 2.0.
 
#define CDI_MAX_SIMULTANEOUS_CONNECTIONS   (30)
 Define to limit the max number of allowable Tx or Rx connections that can be created in the SDK.
 
#define CDI_MAX_ENDPOINTS_PER_CONNECTION   (5)
 Define to limit the max number of allowable Tx or Rx endpoints for a single connection that can be created in the SDK.
 
#define CDI_MAX_SIMULTANEOUS_TX_PAYLOADS_PER_CONNECTION   (8)
 Define to limit the max number of allowable payloads that can be simultaneously sent on a single connection in the SDK. NOTE: This value is used to mask the MSBs of array indices so this value must be a power of two.
 
#define CDI_MAX_SIMULTANEOUS_TX_PAYLOAD_SGL_ENTRIES_PER_CONNECTION   (CDI_MAX_SIMULTANEOUS_TX_PAYLOADS_PER_CONNECTION*3500)
 Define to limit the max number of allowable payload SGL entries that can be simultaneously sent on a single connection in the SDK. 3500 SGL entries supports 4K at 10-bits packed using 2110-20.
 
#define CDI_MAX_SIMULTANEOUS_RX_PAYLOADS_PER_CONNECTION   (32)
 Define to limit the max number of allowable payloads that can be simultaneously received on a single connection in the SDK. This number should be larger than the respective Tx limit since more payloads can potentially be in flight in the receive logic. This is because Tx packets can get acknowledged to the transmitter before being fully processed by the receiver, allowing the transmitter to send more. This number must also be as large or larger than the maximum SRD packet ordering window so that we can be sure we make enough room in our state arrays for tracking all possible payloads that could be in flight at the same time. NOTE: This value must be a power of two because it is used to mask the MSBs of array indices.
 
#define CDI_MAX_RX_PAYLOAD_OUT_OF_ORDER_BUFFER   (8192)
 Define the size of the Rx payload buffer used to hold out of order payloads. Value must be a power of 2. Sized to allow receive of 4K RGB 4:4:4 12 bit.
 
#define CDI_MAX_RX_PACKET_OUT_OF_ORDER_WINDOW   (5000)
 Define to limit the max number packets of that can arrive out of order and be put back in order. Sized to allow receive of 4K RGB 4:4:4 12 bit.
 
#define CDI_MAX_CONNECTION_NAME_STRING_LENGTH   (128)
 Maximum connection name string length.
 
#define CDI_MAX_STREAM_NAME_STRING_LENGTH   (CDI_MAX_CONNECTION_NAME_STRING_LENGTH+10)
 Maximum stream name string length.
 
#define CDI_MAX_LOG_FILENAME_LENGTH   (1024)
 Maximum log filename string length.
 
#define CDI_ENABLED_RX_BUFFER_DELAY_DEFAULT_MS   (67)
 When Rx Buffer delay is enabled using "-1", this is the delay used in milliseconds. This is 4 video frames at 60FPS (4*16.6ms= 66.4ms). This value is the recommended buffer size for transport between instances that are not in a cluster placement group.
 
#define CDI_MAXIMUM_RX_BUFFER_DELAY_MS   (100)
 Maximum Rx buffer delay in milliseconds. This is approximately 6 video frames at 60FPS (6*16.6ms= ~100ms).
 
#define CDI_RX_BUFFER_DELAY_BUFFER_MS_DIVISOR   (10)
 The millisecond divisor used to calculate how many additional packet buffers to allocate for the Rx buffer. A value of 10 here corresponds to 100FPS (10ms).
 

Typedefs

typedef struct CdiLogMethodData CdiLogMethodData
 Forward structure declaration to create pointer to log data when used.
 
typedef struct CdiAdapterStateCdiAdapterHandle
 Type used as the handle (pointer to an opaque structure) for a network adapter. Each handle represents an instance of a network adapter.
 
typedef struct CdiConnectionStateCdiConnectionHandle
 Type used as the handle (pointer to an opaque structure) for a transmitter or receiver connection. Each handle represents a single data flow.
 
typedef struct CdiEndpointStateCdiEndpointHandle
 Type used as the handle (pointer to an opaque structure) for a transmitter or receiver endpoint. Each handle represents a single data flow.
 
typedef struct CdiMemoryStateCdiMemoryHandle
 Type used as the handle (pointer to an opaque structure) for holding private SDK data that relates to memory.
 
typedef void * CdiUserCbParameter
 Type used as user defined data that is passed to the registered user RX/TX callback functions.
 
typedef struct CdiPtpTimestamp CdiPtpTimestamp
 A structure for holding a PTP timestamp defined in seconds and nanoseconds. This PTP time as defined by SMPTE ST 2059-2 and IEEE 1588-2008 with the exception that the seconds field is an unsigned 32 bit integer instead of the specified 48 bit integer.
 
typedef void(* CdiCoreConnectionCallback) (const CdiCoreConnectionCbData *data_ptr)
 Prototype of connection callback function. The user code must implement a function with this prototype and provide it in CdiTxConfigData or CdiRxConfigData structure when using one of the Cdi...Create() API functions.
 
typedef void(* CdiCoreStatsCallback) (const CdiCoreStatsCbData *data_ptr)
 Prototype of statistics callback function. The user code must implement a function with this prototype and provide it as a parameter to the CdiCoreStatsRegisterCallback() API function.
 
typedef struct CdiSglEntry CdiSglEntry
 This typedef is declared here so we can use it as a pointer element within the structure.
 

Enumerations

enum  CdiReturnStatus {
  kCdiStatusOk = 0 , kCdiStatusFatal = 1 , kCdiStatusNotEnoughMemory = 2 , kCdiStatusNotInitialized = 3 ,
  kCdiStatusMaxLatencyExceeded = 4 , kCdiStatusInvalidHandle = 5 , kCdiStatusInvalidParameter = 6 , kCdiStatusNotConnected = 7 ,
  kCdiStatusQueueFull = 8 , kCdiStatusInvalidConnectionType = 9 , kCdiStatusRxPayloadError = 10 , kCdiStatusRxWrongProtocolType = 11 ,
  kCdiStatusCreateLogFailed = 12 , kCdiStatusCreateThreadFailed = 13 , kCdiStatusShuttingDown = 14 , kCdiStatusWrongDirection = 15 ,
  kCdiStatusGetPortFailed = 16 , kCdiStatusNotReady = 17 , kCdiStatusSendFailed = 18 , kCdiStatusAllocationFailed = 19 ,
  kCdiStatusOpenFailed = 20 , kCdiStatusDuplicateConnection = 21 , kCdiStatusInvalidSgl = 22 , kCdiStatusEndpointManagerState = 23 ,
  kCdiStatusBufferOverflow = 24 , kCdiStatusRxPayloadMissing = 25 , kCdiStatusArraySizeExceeded = 26 , kCdiStatusNonFatal = 27 ,
  kCdiStatusCloudWatchNotEnabled = 28 , kCdiStatusCloudWatchThrottling = 29 , kCdiStatusCloudWatchInvalidCredentials = 30 , kCdiStatusInternalIdle = 31 ,
  kCdiStatusAdapterDuplicateEntry = 32 , kCdiStatusProfileNotSupported = 33 , kCdiStatusProbePacketCrcError = 34 , kCdiStatusProbePacketInvalidSize = 35 ,
  kCdiStatusRxPayloadBackPressure = 36 , kCdiStatusDuplicateBaselineVersion = 37 , kCdiStatusInvalidPayload = 38 , kCdiStatusLibraryLoadFailed = 39 ,
  kCdiStatusLibrarySymbolNotFound = 40 , kCdiStatusLibraryWrongVersion = 41 , kCdiStatusRetry = 42
}
 Values used for API function return codes. More...
 
enum  CdiConnectionStatus { kCdiConnectionStatusDisconnected , kCdiConnectionStatusConnected }
 This enumeration is used to indicate the current state of a connection. NOTE: Any changes made here MUST also be made to "connection_status_key_array" in cdi_utility_api.c. More...
 
enum  CdiAdapterTypeSelection { kCdiAdapterTypeEfa , kCdiAdapterTypeSocket , kCdiAdapterTypeSocketLibfabric }
 This selector determines the type of network adapter in the API function. NOTE: Any changes made here MUST also be made to "adapter_type_key_array" in cdi_avm_api.c. More...
 
enum  CdiBufferType { kCdiLinearBuffer = 0 , kCdiSgl = 1 }
 Values used to determine type of receive buffer to configure for a receiver connection. NOTE: Any changes made here MUST also be made to "buffer_type_key_array" in cdi_utility_api.c. More...
 

Functions

CDI_INTERFACE CdiReturnStatus CdiCoreInitialize (const CdiCoreConfigData *core_config_ptr)
 
CDI_INTERFACE CdiReturnStatus CdiCoreNetworkAdapterInitialize (CdiAdapterData *adapter_data_ptr, CdiAdapterHandle *ret_handle_ptr)
 
CDI_INTERFACE CdiReturnStatus CdiCoreNetworkAdapterDestroy (CdiAdapterHandle handle)
 
CDI_INTERFACE CdiReturnStatus CdiCoreRxFreeBuffer (const CdiSgList *sgl_ptr)
 
CDI_INTERFACE int CdiCoreGather (const CdiSgList *sgl_ptr, int offset, void *dest_data_ptr, int byte_count)
 
CDI_INTERFACE CdiReturnStatus CdiCoreStatsReconfigure (CdiConnectionHandle handle, const CdiStatsConfigData *config_ptr)
 
CDI_INTERFACE CdiReturnStatus CdiCoreConnectionDestroy (CdiConnectionHandle handle)
 
CDI_INTERFACE CdiReturnStatus CdiCoreShutdown (void)
 
CDI_INTERFACE void CdiCoreGetUtcTime (struct timespec *ret_time_ptr)
 
CDI_INTERFACE CdiPtpTimestamp CdiCoreGetPtpTimestamp (CdiPtpTimestamp *ret_ptp_time_ptr)
 Get the current TAI time as a PTP timestamp.
 
CDI_INTERFACE uint64_t CdiCoreGetUtcTimeMicroseconds (void)
 
CDI_INTERFACE uint64_t CdiCoreGetTaiTimeMicroseconds ()
 
CDI_INTERFACE const char * CdiCoreStatusToString (CdiReturnStatus status)
 
CDI_INTERFACE const CdiCoreReadOnlySettingsCdiCoreGetSettings ()
 

Detailed Description

This file declares the public API data types, structures and functions that comprise the CDI low-level transport SDK API.

Macro Definition Documentation

◆ CDI_MAX_SIMULTANEOUS_RX_PAYLOADS_PER_CONNECTION

#define CDI_MAX_SIMULTANEOUS_RX_PAYLOADS_PER_CONNECTION   (32)

Define to limit the max number of allowable payloads that can be simultaneously received on a single connection in the SDK. This number should be larger than the respective Tx limit since more payloads can potentially be in flight in the receive logic. This is because Tx packets can get acknowledged to the transmitter before being fully processed by the receiver, allowing the transmitter to send more. This number must also be as large or larger than the maximum SRD packet ordering window so that we can be sure we make enough room in our state arrays for tracking all possible payloads that could be in flight at the same time. NOTE: This value must be a power of two because it is used to mask the MSBs of array indices.

See also
RxPacketReceive

◆ CDI_PROBE_VERSION

#define CDI_PROBE_VERSION   5

CDI probe command version. Possible value are: For Protocol version 2.0 (CDI_PROTOCOL_VERSION.CDI_PROTOCOL_MAJOR_VERSION): 0: SDK 1.x.x. Only supports protocol version 1.0. 1: not used 2: SDK 2.0.x, Only supports protocol version 1.0 3: SDK 2.1.x. Supports the new protocol version command. See kProbeCommandProtocolVersion. Supports protocols version 1.0 and 2.0.

For Protocol version 2.1 (CDI_PROTOCOL_VERSION.CDI_PROTOCOL_MAJOR_VERSION): 4: SDK 2.2.x. Supports bidirectional sockets for probe control interface. Logic added to maintain compatibility with previous probe version that used unidirectional sockets.

  1. SDK 2.4.1 Rx waits for connected ping from Tx before enabling adapter level endpoint (ie. libfabric).

Typedef Documentation

◆ CdiCoreConnectionCallback

typedef void(* CdiCoreConnectionCallback) (const CdiCoreConnectionCbData *data_ptr)

Prototype of connection callback function. The user code must implement a function with this prototype and provide it in CdiTxConfigData or CdiRxConfigData structure when using one of the Cdi...Create() API functions.

This callback function is invoked whenever the connection status changes.

Parameters
data_ptrA pointer to an CdiCoreConnectionCbData structure.

◆ CdiCoreStatsCallback

typedef void(* CdiCoreStatsCallback) (const CdiCoreStatsCbData *data_ptr)

Prototype of statistics callback function. The user code must implement a function with this prototype and provide it as a parameter to the CdiCoreStatsRegisterCallback() API function.

This callback function is invoked whenever statistics gathering interval has expired.

Parameters
data_ptrA pointer to an CdiCoreStatsCbData structure.

Enumeration Type Documentation

◆ CdiAdapterTypeSelection

This selector determines the type of network adapter in the API function. NOTE: Any changes made here MUST also be made to "adapter_type_key_array" in cdi_avm_api.c.

Enumerator
kCdiAdapterTypeEfa 

This adapter type is the typical choice for high throughput, reliable delivery of data. In order to use it, the host must meet a number of requirements documented elsewhere.

kCdiAdapterTypeSocket 

This adapter type has significant performance limitations and is mainly useful for testing since there are no special instances required for using applications with the SOCKET adapter.

This adapter is implemented using kernel UDP sockets. UDP sockets do not provide the reliable delivery of messages, or datagrams, that EFA provides. Additionally since this uses the kernel UDP socket instead of a polled mode network driver the throughput is significantly constrained relative to EFA. Furthermore, the SOCKET adapter does not use the same out-of-band connection management that is used by the EFA. Without the out-of-band connection management the transmitting side does not have visibility into whether the receiving side is present and receiving data.

Due to these differences the successful use of the SOCKET adapter requires several special considerations:

  1. Keep the bandwidth utilization low by using a combination of small payloads and low frame rates.
  2. Ensure that the receive side is started before the transmitting side.
  3. Use the local interface, which should work more reliably than a physical network interface.
  4. If the above is not adequate for testing purposes consider tuning the kernel to increase network buffer sizes.
kCdiAdapterTypeSocketLibfabric 

This adapter type is mainly useful for testing. This is similar to kCdiAdapterTypeSocket except that it uses libfabric to perform the work of sending over the socket.

◆ CdiBufferType

Values used to determine type of receive buffer to configure for a receiver connection. NOTE: Any changes made here MUST also be made to "buffer_type_key_array" in cdi_utility_api.c.

Enumerator
kCdiLinearBuffer 

Use a linear buffer to store received payload data. Depending on hardware capabilities, this may require memcpy.

kCdiSgl 

Use scatter-gather buffers to store received payload data.

◆ CdiConnectionStatus

This enumeration is used to indicate the current state of a connection. NOTE: Any changes made here MUST also be made to "connection_status_key_array" in cdi_utility_api.c.

Enumerator
kCdiConnectionStatusDisconnected 

Disconnected. The SDK is trying to establish the connection.

kCdiConnectionStatusConnected 

Connected and ready for use.

◆ CdiReturnStatus

Values used for API function return codes.

NOTE: Additions to and removals from this enumeration need to be reflected in CdiCoreStatusToString().

Enumerator
kCdiStatusOk 

The API function succeeded.

kCdiStatusFatal 

An unspecified, unrecoverable error occurred.

kCdiStatusNotEnoughMemory 

An attemt to allocated memory from the heap failed.

kCdiStatusNotInitialized 

The appropriate SDK initialization function has not yet been called.

kCdiStatusMaxLatencyExceeded 

A chunk of data was not delivered to the receiver before its deadline was reached.

kCdiStatusInvalidHandle 

The handle passed in to an SDK function is not valid.

kCdiStatusInvalidParameter 

A parameter passed in to an SDK function is not valid.

kCdiStatusNotConnected 

This status is only returned by CdiTxPayload() when the connection to the receiver has not been established or when the receiver has become disconnected due to either network problems or the receiving host becoming non-responsive.

kCdiStatusQueueFull 

The operation failed due to a queue resource being full.

kCdiStatusInvalidConnectionType 

The operation failed due to the connection type is not valid for the requested operation.

kCdiStatusRxPayloadError 

A payload was received, but an error occurred. The payload is being discarded.

kCdiStatusRxWrongProtocolType 

A payload was received, but it was not using the protocol specified by the received connection. This means either a AVM payload was received on a RAW connection or a RAW payload was received on a AVM connection.

kCdiStatusCreateLogFailed 

Unable to create a log file.

kCdiStatusCreateThreadFailed 

Unable to create a thread.

kCdiStatusShuttingDown 

The current connection is shutting down, so resources that may be actively being used (E.g. a FIFO) will abort and return this status.

kCdiStatusWrongDirection 

An attempt was made to perform an Rx function on a Tx connection, or vice-versa.

kCdiStatusGetPortFailed 

When performing a port query, the function failed.

kCdiStatusNotReady 

Attempt to use a connection that is stopped.

kCdiStatusSendFailed 

Tx data failed to post to endpoint queue.

kCdiStatusAllocationFailed 

Attempt to allocate a non-memory resource failed.

kCdiStatusOpenFailed 

Attempt to open a connection (e.g. socket) failed.

kCdiStatusDuplicateConnection 

Attempt was made to create an identical endpoint that is already in use.

kCdiStatusInvalidSgl 

Invalid SGL found when processing.

kCdiStatusEndpointManagerState 

An endpoint state change occurred.

kCdiStatusBufferOverflow 

Buffer is not large enough to hold data.

kCdiStatusRxPayloadMissing 

No packets were received for a payload.

kCdiStatusArraySizeExceeded 

The size of an internal array that does not dynamically grow was exceeded.

kCdiStatusNonFatal 

An unspecified, recoverable error occurred.

kCdiStatusCloudWatchNotEnabled 

The SDK was built without CloudWatch being enabled. The CloudWatch SDK is required and must be specifically referenced as part of building the SDK. See RELEASE_NOTES file or Setup/Install Guide for details.

kCdiStatusCloudWatchThrottling 

A CloudWatch request was throttled. Need to try the request again at a later time.

kCdiStatusCloudWatchInvalidCredentials 

A CloudWatch request failed due to invalid credentials. Verify that the access and secret keys have been setup correctly.

kCdiStatusInternalIdle 

Internal only status: the function succeeded but did nothing productive.

kCdiStatusAdapterDuplicateEntry 

An attempt was made to create a duplicate adapter entry.

kCdiStatusProfileNotSupported 

An attempt was made to use a profile that is not supported.

kCdiStatusProbePacketCrcError 

Failed to decode a probe packet due to a CRC error.

kCdiStatusProbePacketInvalidSize 

Failed to decode a probe packet due to invalid size.

kCdiStatusRxPayloadBackPressure 

Payloads are being received, but back pressure is preventing allocation of resources to store them. Payloads are being discarded until another status message is provided (ie. kCdiStatusOk).

kCdiStatusDuplicateBaselineVersion 

An attempt was made to register an already registered baseline profile.

kCdiStatusInvalidPayload 

A received payload cannot be read because of format errors.

kCdiStatusLibraryLoadFailed 

Failed to dynamically load a shared library.

kCdiStatusLibrarySymbolNotFound 

Failed to find symbol in dynamically loaded library.

kCdiStatusLibraryWrongVersion 

Wrong version of dynamically loaded library.

kCdiStatusRetry 

Resource not available. Retry the operation.

Function Documentation

◆ CdiCoreConnectionDestroy()

CDI_INTERFACE CdiReturnStatus CdiCoreConnectionDestroy ( CdiConnectionHandle handle)

Destroy a specific TX or RX connection and free resources that were created for it.

Parameters
handleConnection handle returned by Cdi...TxCreate() API functions.
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiCoreGather()

CDI_INTERFACE int CdiCoreGather ( const CdiSgList * sgl_ptr,
int offset,
void * dest_data_ptr,
int byte_count )

Gather received data represented by a scatter-gather list into a contiguous buffer. The caller is responsible for ensuring that the destination buffer is large enough to hold the data.

A subset of the entire payload of the SGL can be extracted by using a non-zero value for offset and/or a smaller number for byte_count than sgl->total_data_size. The number of bytes copied is the smaller of (sgl->total_data_size - offset) or byte_count.

Parameters
sgl_ptrThe scatter-gather list containing the data to be gathered.
offsetNumber of bytes to skip in SGL before starting the copy.
dest_data_ptrWhere to write the gathered data in linear format.
byte_countThe number of bytes to copy.
Returns
The number of bytes copied. This will be less than byte_count if fewer than that number of bytes are present in the source SGL starting from the specified offset. A value of -1 indicates that a fatal error was encountered such as NULL values for sgl_ptr or dest_data_ptr.

◆ CdiCoreGetPtpTimestamp()

CDI_INTERFACE CdiPtpTimestamp CdiCoreGetPtpTimestamp ( CdiPtpTimestamp * ret_ptp_time_ptr)

Get the current TAI time as a PTP timestamp.

There seems to be no trivial solutions for automatically getting the current leap second adjustment. All leap second adjustments occur on either December 31st or June 30th. The next possible leap second introduction is June 30th 2021. This function applies a fixed 37 second adjustment to UTC time to get TAI time.

Parameters
ret_ptp_time_ptrPointer to CdiPtpTimestamp to return the current PtpTimestamp to. This may be NULL.
Returns
The same value that is written to the location pointed to by ret_ptp_time_ptr.

◆ CdiCoreGetSettings()

CDI_INTERFACE const CdiCoreReadOnlySettings * CdiCoreGetSettings ( )

Returns the core configuration read-only settings.

Returns
Pointer to const structure that contains the settings.

◆ CdiCoreGetTaiTimeMicroseconds()

CDI_INTERFACE uint64_t CdiCoreGetTaiTimeMicroseconds ( )

Get the current TAI time in microseconds.

Returns
Current TAI time in microseconds.

◆ CdiCoreGetUtcTime()

CDI_INTERFACE void CdiCoreGetUtcTime ( struct timespec * ret_time_ptr)

Get the current synced AWS network UTC time in a timespec structure. This function will be kept up to date with the best practices for getting high accuracy time from Amazon Time Sync Service as improved accuracy time is available. All EC2 instances that call this function should be using the Amazon Time Sync Service. Amazon Time Sync Service setup directions for Linux can be found at: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html#configure-amazon-time-service. For Windows follow the directions at: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/windows-set-time.html

Parameters
ret_time_ptrAddress where to write the UTC timestamp in a timespec structure as defined by time.h.

◆ CdiCoreGetUtcTimeMicroseconds()

CDI_INTERFACE uint64_t CdiCoreGetUtcTimeMicroseconds ( void )

Get the current synced AWS network UTC time in microseconds. It uses CdiCoreGetUtcTime().

Returns
Current UTC time in microseconds.

◆ CdiCoreInitialize()

CDI_INTERFACE CdiReturnStatus CdiCoreInitialize ( const CdiCoreConfigData * core_config_ptr)

Initialize the SDK. Must be called once before using any other SDK APIs. When done, must call CdiCoreShutdown() once.

NOTE: Newly created data structures that are passed in to this function should be properly initialized before being programmed with user values. Use memset or a zero structure initializer (= {0}) to set the whole structure to zero before setting the desired members to the actual values required.

Parameters
core_config_ptrPointer to core configuration data that is used to initialize the SDK. Value is required and cannot be NULL. Copies of the data in the configuration data structure are made as needed. A local variable can be used for composing the structure since its contents are not needed after this function returns.
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiCoreNetworkAdapterDestroy()

CDI_INTERFACE CdiReturnStatus CdiCoreNetworkAdapterDestroy ( CdiAdapterHandle handle)

Free resources associated with the specified network adapter that was previously created using CdiCoreNetworkAdapterInitialize(). NOTE: Before calling this function, all connections that use the adapter should be closed using CdiCoreConnectionDestroy().

Parameters
handleHandle of network adapter to destroy.
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiCoreNetworkAdapterInitialize()

CDI_INTERFACE CdiReturnStatus CdiCoreNetworkAdapterInitialize ( CdiAdapterData * adapter_data_ptr,
CdiAdapterHandle * ret_handle_ptr )

Create an instance of a network adapter. CdiCoreNetworkAdapterDestroy() must be called before CdiCoreShutdown() but after all connections using the adapter are closed using CdiCoreConnectionDestroy().

NOTE: Currently if the shared memory provider is enabled in the EFA Adapter (see FI_EFA_ENABLE_SHM_TRANSFER in CDI), libfabric uses fork() to determine capability (see rxr_check_cma_capability() in the EFA provider). This causes a double flush of cached write data of any open files. By default, the shared memory provider is disabled. If enabled, all open files must have used fflush() prior to using this API function. The CDI SDK always flushes all open log files that were created using the CDI logger API functions.

NOTE: Newly created data structures that are passed in to this function should be properly initialized before being programmed with user values. Use memset or a zero structure initializer (= {0}) to set the whole structure to zero before setting the desired members to the actual values required.

Parameters
adapter_data_ptrPointer to network adapter configuration data. Copies of the data in the configuration data structure are made as needed. A local variable can be used for composing the structure since its contents are not needed after this function returns.
ret_handle_ptrPointer to returned instance handle (used as parameter for other API functions).
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiCoreRxFreeBuffer()

CDI_INTERFACE CdiReturnStatus CdiCoreRxFreeBuffer ( const CdiSgList * sgl_ptr)

Free the receive buffer that was used in one of the Cdi...RxCallback() API functions.

Parameters
sgl_ptrThe scatter-gather list containing the memory to be freed.
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiCoreShutdown()

CDI_INTERFACE CdiReturnStatus CdiCoreShutdown ( void )

Application is shutting down. Stop open connections and free-up all resources being used by the SDK.

Returns
A value from the CdiReturnStatus enumeration.

◆ CdiCoreStatsReconfigure()

CDI_INTERFACE CdiReturnStatus CdiCoreStatsReconfigure ( CdiConnectionHandle handle,
const CdiStatsConfigData * config_ptr )

Configure transfer statistics.

Parameters
handleConnection handle returned by Cdi...TxCreate() API functions.
config_ptrPointer to statistics configuration data. Copies of the data in the configuration data structure are made as needed. A local variable can be used for composing the structure since its contents are not needed after this function returns.
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiCoreStatusToString()

CDI_INTERFACE const char * CdiCoreStatusToString ( CdiReturnStatus status)

Returns a short string that briefly describes the meaning of an CDI status code.

Parameters
statusThe value to be converted to a string.
Returns
const char* A character array which describes the requested code.