CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
This file contains definitions and functions for the socket adapter. More...
#include "adapter_api.h"
#include <sys/uio.h>
#include "cdi_os_api.h"
#include "internal.h"
#include "internal_log.h"
#include "private.h"
#include "protocol.h"
Data Structures | |
struct | ReceiveBufferRecord |
Definition of memory space where rx data is placed. More... | |
struct | SocketEndpointState |
State definition for socket endpoint. More... | |
Macros | |
#define | kSocketMtu (1500 - 0x2a) |
Ethernet frame size less MAC/IP/UDP headers. | |
Functions | |
static CdiReturnStatus | SocketConnectionCreate (AdapterConnectionHandle handle, int port_number, const char *bind_ip_addr_str) |
Forward declaration of function. | |
static CdiReturnStatus | SocketConnectionDestroy (AdapterConnectionHandle handle) |
Forward declaration of function. | |
static CdiReturnStatus | SocketEndpointOpen (AdapterEndpointHandle endpoint, const char *remote_address_str, int port_number, const char *bind_ip_addr_str) |
Forward declaration of function. | |
static CdiReturnStatus | SocketEndpointClose (AdapterEndpointHandle handle) |
Forward declaration of function. | |
static CdiReturnStatus | SocketEndpointSend (const AdapterEndpointHandle handle, const Packet *packet_ptr, bool flush_packets) |
Forward declaration of function. | |
static CdiReturnStatus | SocketEndpointRxBuffersFree (const AdapterEndpointHandle handle, const CdiSgList *sgl_ptr) |
Forward declaration of function. | |
static CdiReturnStatus | SocketEndpointGetPort (const AdapterEndpointHandle handle, int *ret_port_number_ptr) |
Forward declaration of function. | |
static CdiReturnStatus | SocketAdapterShutdown (CdiAdapterHandle adapter) |
Forward declaration of function. | |
static EndpointTransmitQueueLevel | SocketGetTransmitQueueLevel (AdapterEndpointHandle handle) |
static CDI_THREAD | SocketReceiveThread (void *arg) |
static bool | SocketEndpointPoolItemInit (const void *context_ptr, void *item_ptr) |
CdiReturnStatus | SocketNetworkAdapterInitialize (CdiAdapterState *adapter_state_ptr) |
Variables | |
static struct AdapterVirtualFunctionPtrTable | socket_endpoint_functions |
Define the virtual table API interface for this adapter. | |
This file contains definitions and functions for the socket adapter.
|
static |
Forward declaration of function.
Shuts down the adapter, freeing any resources associated with it.
adapter | The handle of the adapter which is to be shut down. |
|
static |
Forward declaration of function.
Closes the endpoint and frees any resources associated with it.
endpoint_handle | The handle of the endpoint to be closed. |
|
static |
Forward declaration of function.
Returns the destination port number associated with the specified endpoint.
handle | The handle of the endpoint whose port number is of interest. |
ret_port_number_ptr | Address of the location where the port number is to be written. |
|
static |
Forward declaration of function.
Open a socket endpoint using the specified adapter.
endpoint_handle | Handle of adapter endpoint to open. |
remote_address_str | Pointer to remote target's IP address string. |
port_number | Destination port to use. |
bind_address_str | Pointer to optional bind IP address string. |
|
static |
Initialization function for socket pool item.
context_ptr | Unused, reserve for future use. |
item_ptr | Pointer to item being initialized. |
|
static |
Forward declaration of function.
Returns the SGL entries contained in the supplied SGL to their free pool.
handle | The endpoint to which the SGL entries belong. |
sgl_ptr | Pointer to the SGL that contains the entries to be freed. |
|
static |
Forward declaration of function.
Sends a packet to the destination of the endpoint.
handle | The handle of the endpoint on which to send the packet. |
packet_ptr | A pointer to the packet data to be sent to the remote endpoint. |
flush_packets | true if this packet and any that might be queued to be sent should be sent immediately or false if this packet can wait in the queue. The socket adapter does not queue packets so this argument is ignored and always treated as true. |
|
static |
Returns the adapter endpoint's transmit queue level which is always kEndpointTransmitQueueNa for this type.
handle | The handle of the adapter endpoint to query. |
CdiReturnStatus SocketNetworkAdapterInitialize | ( | CdiAdapterState * | adapter_state_ptr | ) |
Initializes socket based adapter specified by the values in the provided CdiAdapterState structure.
adapter_state_ptr | The address of the generic adapter state preinitialized with the generic values including the CdiAdapterData structure which contains the values provided to the SDK by the user program. |
|
static |
Thread to receive packets over socket.
arg | Pointer to thread. |
|
static |
Define the virtual table API interface for this adapter.