13#ifndef CDI_INTERNAL_H__
14#define CDI_INTERNAL_H__
81 return handle != NULL && handle->
magic == kMagicEndpoint;
93 return handle != NULL && handle->
magic == kMagicMemory;
105 return handle != NULL && handle->
magic == kMagicAdapter;
237#define PAYLOAD_ERROR(con_state_ptr, app_cb_data_ptr, status_code, ...) { \
238 PayloadErrorSet(con_state_ptr, app_cb_data_ptr, status_code, __VA_ARGS__); \
239 CdiLogger(CdiLoggerThreadLogGet(), kLogComponentGeneric, kLogError, __FUNCTION__, __LINE__ , __VA_ARGS__); }
250#define BACK_PRESSURE_ERROR(back_pressure_state, log_level, ...) \
251 if (kCdiBackPressureNone == back_pressure_state) { \
252 back_pressure_state = kCdiBackPressureActive; \
253 CdiLogger(CdiLoggerThreadLogGet(), kLogComponentGeneric, log_level, __FUNCTION__, __LINE__, __VA_ARGS__); \
332 memset(source_sgl_ptr, 0,
sizeof(*source_sgl_ptr));
379void BytesToHexString(
const void* data_ptr,
int data_byte_count,
char* dest_buffer_str,
int dest_buffer_size);
389void DeviceGidToString(
const uint8_t* device_gid_ptr,
int gid_length,
char* dest_buffer_str,
int dest_buffer_size);
The declarations in this header file correspond to the definitions in adapter.c.
This file declares the public API data types, structures and functions that comprise the CDI low-leve...
CdiReturnStatus
Values used for API function return codes.
Definition cdi_core_api.h:189
void(* CdiCoreStatsCallback)(const CdiCoreStatsCbData *data_ptr)
Prototype of statistics callback function. The user code must implement a function with this prototyp...
Definition cdi_core_api.h:606
void * CdiUserCbParameter
Type used as user defined data that is passed to the registered user RX/TX callback functions.
Definition cdi_core_api.h:182
This file declares the public API data types, structures and functions that comprise the CDI log API.
struct CdiSignalType_t * CdiSignalType
Define portable signal type. Don't use void* here, which prevents the compiler from type checking.
Definition cdi_os_api.h:189
struct CdiThreadID_t * CdiThreadID
Define portable thread type. Separate name from type, otherwise the typedef that follows it will gene...
Definition cdi_os_api.h:312
This file declares the public API data types, structures and functions that comprise the CDI Raw payl...
CdiConnectionProtocolType
This enumeration is used in the CdiConnectionState structure to indicate what connection layer is bei...
Definition cdi_utility_api.h:71
This header file contains definitions used to define the build configuration of the CDI SDK's impleme...
CdiGlobalContext cdi_global_context
global configuration data.
Definition internal.c:44
static void SglSetEmptyForExternalUse(CdiSgList *sgl_ptr)
Definition internal.h:341
CdiReturnStatus ConnectionCommonResourcesCreate(CdiConnectionHandle handle, CdiCoreStatsCallback stats_cb_ptr, CdiUserCbParameter stats_user_cb_param, const CdiStatsConfigData *stats_config_ptr)
Definition internal.c:553
int CdiGatherInternal(const CdiSgList *sgl_ptr, int offset, void *dest_data_ptr, int byte_count)
Definition internal.c:366
static bool IsValidMemoryHandle(const CdiMemoryHandle handle)
Definition internal.h:91
CdiReturnStatus ConnectionCommonPacketMessageThreadCreate(CdiConnectionHandle handle, char const *thread_name)
Definition internal.c:636
CdiReturnStatus CdiGlobalInitialization(const CdiCoreConfigData *core_config_ptr)
Definition internal.c:251
void DeviceGidToString(const uint8_t *device_gid_ptr, int gid_length, char *dest_buffer_str, int dest_buffer_size)
Definition internal.c:890
CdiReturnStatus CoreStatsConfigureInternal(CdiConnectionHandle handle, const CdiStatsConfigData *new_config_ptr, bool force_changes)
Definition internal.c:649
CdiReturnStatus AdapterInitializeInternal(CdiAdapterData *adapter_data_ptr, CdiAdapterHandle *ret_handle_ptr)
Definition internal.c:412
static void SglMoveEntries(CdiSgList *destination_sgl_ptr, CdiSgList *source_sgl_ptr)
Definition internal.h:311
CdiReturnStatus SdkShutdownInternal(void)
Definition internal.c:746
void ConnectionCommonResourcesDestroy(CdiConnectionHandle handle)
Definition internal.c:619
static bool IsValidTxHandle(const CdiConnectionHandle handle)
Definition internal.h:42
void EndpointDestroyInternal(CdiEndpointHandle handle)
Definition internal.c:741
static bool IsValidRxHandle(const CdiConnectionHandle handle)
Definition internal.h:55
void SdkThreadJoin(CdiThreadID thread_id, CdiSignalType shutdown_signal)
Definition internal.c:907
void BytesToHexString(const void *data_ptr, int data_byte_count, char *dest_buffer_str, int dest_buffer_size)
Definition internal.c:879
static void SglAppend(CdiSgList *sgl_list_ptr, CdiSglEntry *sgl_add_ptr)
Definition internal.h:289
CdiReturnStatus NetworkAdapterDestroyInternal(CdiAdapterHandle handle)
Definition internal.c:526
CdiLogHandle CdiLogGlobalGetInternal(void)
Definition internal.c:917
void ConnectionDestroyInternal(CdiConnectionHandle handle)
Definition internal.c:709
void DumpPayloadConfiguration(const CdiCoreExtraData *core_extra_data_ptr, int extra_data_size, const uint8_t *extra_data_array, CdiConnectionProtocolType protocol_type)
Definition internal.c:784
void PayloadErrorFreeBuffer(CdiPoolHandle pool_handle, AppPayloadCallbackData *app_cb_data_ptr)
Definition internal.c:700
static bool IsValidEndpointHandle(const CdiEndpointHandle handle)
Definition internal.h:79
bool FreeSglEntries(CdiPoolHandle pool_handle, CdiSglEntry *sgl_entry_head_ptr)
Definition internal.c:762
static bool IsValidConnectionHandle(const CdiConnectionHandle handle)
Definition internal.h:68
void PayloadErrorSet(CdiConnectionState *con_state_ptr, AppPayloadCallbackData *app_cb_data_ptr, CdiReturnStatus status_code, const char *format_str,...)
Definition internal.c:675
static bool IsValidAdapterHandle(const CdiAdapterHandle handle)
Definition internal.h:103
The declarations in this header file is used for logging.
@ kHandleTypeTx
Transmitter type handle.
Definition private.h:98
@ kHandleTypeRx
Receiver type handle.
Definition private.h:99
This defines a structure that contains all of the data required to use the application registered pay...
Definition private.h:106
Configuration data used by the CdiCoreNetworkAdapterInitialize() API function.
Definition cdi_core_api.h:480
Structure definition behind the handles shared with the user's application program....
Definition adapter_api.h:384
uint32_t magic
Set to kMagicAdapter when allocated, checked at every API function to help ensure validity.
Definition adapter_api.h:389
Structure definition behind the connection handles shared with the user's application program....
Definition private.h:371
CdiAdapterState * adapter_state_ptr
The instance of the adapter this Tx/Rx object is associated with.
Definition private.h:390
ConnectionHandleType handle_type
Indicates which structure of the union is valid.
Definition private.h:405
uint32_t magic
Set to kMagicConnection when allocated, checked at every API function to help ensure validity.
Definition private.h:375
SDK configuration data used by the CdiCoreInitialize() API function.
Definition cdi_core_api.h:869
Structure definition behind the connection handles shared with the user's application program....
Definition private.h:330
uint32_t magic
Set to kMagicEndpoint when allocated, checked at every API function to help ensure validity.
Definition private.h:332
CdiSglEntry empty_sgl_entry
Empty scatter-gather-list entry.
Definition private.h:52
Structure used to hold state data for a single log of any type (stdout, callback or file).
Definition logger.c:79
Structure definition behind the Scatter-Gather List internal data handles shared with the user's appl...
Definition private.h:456
uint32_t magic
Set to kMagicMem when allocated, checked at every API function to help ensure validity.
Definition private.h:458
This structure represents the current state of a memory pool.
Definition pool.c:46
This structure defines a scatter-gather list (SGL) which is used to represent an array of data compri...
Definition cdi_core_api.h:728
CdiSglEntry * sgl_tail_ptr
Pointer to the last entry in the singly-linked list of SGL entries.
Definition cdi_core_api.h:738
int total_data_size
Total size of data in the list, in units of bytes. This value can be calculated by walking the sgl_ar...
Definition cdi_core_api.h:732
CdiSglEntry * sgl_head_ptr
Pointer to the first entry in the singly-linked list of SGL entries.
Definition cdi_core_api.h:735
void * internal_data_ptr
Handle to internal data used within the SDK that relates to this SGL. Do not use or modify this value...
Definition cdi_core_api.h:741
This structure represents a single, contiguous region of memory as part of a scatter-gather list.
Definition cdi_core_api.h:709
int size_in_bytes
The size of the data in bytes.
Definition cdi_core_api.h:714
CdiSglEntry * next_ptr
The next entry in the list or NULL if this is the final entry in the list.
Definition cdi_core_api.h:721
A structure that is used to hold statistics gathering configuration data.
Definition cdi_core_api.h:611