dxFeed C API  6.0.1
dxFeed C API library intended to provide market data access for DX clients
Functions
Connections

Connection establishment/teardown functions. More...

Collaboration diagram for Connections:

Functions

DXFEED_API ERRORCODE dxf_create_connection (const char *address, dxf_conn_termination_notifier_t notifier, dxf_conn_status_notifier_t conn_status_notifier, dxf_socket_thread_creation_notifier_t stcn, dxf_socket_thread_destruction_notifier_t stdn, void *user_data, OUT dxf_connection_t *connection)
 Creates connection with the specified parameters. More...
 
DXFEED_API ERRORCODE dxf_create_connection_auth_basic (const char *address, const char *user, const char *password, dxf_conn_termination_notifier_t notifier, dxf_conn_status_notifier_t conn_status_notifier, dxf_socket_thread_creation_notifier_t stcn, dxf_socket_thread_destruction_notifier_t stdn, void *user_data, OUT dxf_connection_t *connection)
 Creates connection with the specified parameters and basic authorization. More...
 
DXFEED_API ERRORCODE dxf_create_connection_auth_bearer (const char *address, const char *token, dxf_conn_termination_notifier_t notifier, dxf_conn_status_notifier_t conn_status_notifier, dxf_socket_thread_creation_notifier_t stcn, dxf_socket_thread_destruction_notifier_t stdn, void *user_data, OUT dxf_connection_t *connection)
 Creates connection with the specified parameters and token authorization. More...
 
DXFEED_API ERRORCODE dxf_create_connection_auth_custom (const char *address, const char *authscheme, const char *authdata, dxf_conn_termination_notifier_t notifier, dxf_conn_status_notifier_t conn_status_notifier, dxf_socket_thread_creation_notifier_t stcn, dxf_socket_thread_destruction_notifier_t stdn, void *user_data, OUT dxf_connection_t *connection)
 Creates connection with the specified parameters and custom described authorization. More...
 
DXFEED_API ERRORCODE dxf_close_connection (dxf_connection_t connection)
 Closes a connection. More...
 
DXFEED_API ERRORCODE dxf_get_connection_properties_snapshot (dxf_connection_t connection, OUT dxf_property_item_t **properties, OUT int *count)
 Retrieves the array of key-value pairs (properties) for specified connection. More...
 
DXFEED_API ERRORCODE dxf_free_connection_properties_snapshot (dxf_property_item_t *properties, int count)
 Frees memory allocated during dxf_get_connection_properties_snapshot function execution. More...
 
DXFEED_API ERRORCODE dxf_get_current_connected_address (dxf_connection_t connection, OUT char **address)
 Retrieves the null-terminated string with current connected address in format <host>:<port>. More...
 
DXFEED_API ERRORCODE dxf_get_current_connection_status (dxf_connection_t connection, OUT dxf_connection_status_t *status)
 Retrieves the current connection status. More...
 

Detailed Description

Connection establishment/teardown functions.

Function Documentation

◆ dxf_close_connection()

DXFEED_API ERRORCODE dxf_close_connection ( dxf_connection_t  connection)

Closes a connection.

Parameters
[in]connectionA handle of a previously created connection
Returns
DXF_SUCCESS on successful connection closure or DXF_FAILURE on error; dxf_get_last_error can be used to retrieve the error code and description in case of failure.

◆ dxf_create_connection()

DXFEED_API ERRORCODE dxf_create_connection ( const char *  address,
dxf_conn_termination_notifier_t  notifier,
dxf_conn_status_notifier_t  conn_status_notifier,
dxf_socket_thread_creation_notifier_t  stcn,
dxf_socket_thread_destruction_notifier_t  stdn,
void *  user_data,
OUT dxf_connection_t connection 
)

Creates connection with the specified parameters.

Parameters
[in]addressConnection string
  • the single address: host:port or just host
  • address with credentials: host:port[username=xxx,password=yyy]
  • multiple addresses: (host1:port1)(host2)(host3:port3[username=xxx,password=yyy])
  • the data from file: /path/to/file on *nix and drive:\path\to\file on Windows
[in]notifierThe callback to inform the client side that the connection has stumbled upon and error and will go reconnecting
[in]conn_status_notifierThe callback to inform the client side that the connection status has changed
[in]stcnThe callback for informing the client side about the socket thread creation; may be set to NULL if no specific action is required to perform on the client side on a new thread creation
[in]stdnThe callback for informing the client side about the socket thread destruction; may be set to NULL if no specific action is required to perform on the client side on a thread destruction
[in]user_dataThe user defined value passed to the termination notifier callback along with the connection handle; may be set to whatever value
[out]connectionThe handle of the created connection
Returns
DXF_SUCCESS on successful connection establishment or DXF_FAILURE on error. Created connection is returned via OUT parameter connection. dxf_get_last_error can be used to retrieve the error code and description in case of failure.

◆ dxf_create_connection_auth_basic()

DXFEED_API ERRORCODE dxf_create_connection_auth_basic ( const char *  address,
const char *  user,
const char *  password,
dxf_conn_termination_notifier_t  notifier,
dxf_conn_status_notifier_t  conn_status_notifier,
dxf_socket_thread_creation_notifier_t  stcn,
dxf_socket_thread_destruction_notifier_t  stdn,
void *  user_data,
OUT dxf_connection_t connection 
)

Creates connection with the specified parameters and basic authorization.

Parameters
[in]addressConnection string
  • the single address: host:port or just host
  • address with credentials: host:port[username=xxx,password=yyy]
  • multiple addresses: (host1:port1)(host2)(host3:port3[username=xxx,password=yyy])
  • the data from file: /path/to/file on *nix and drive:\path\to\file on Windows
[in]userThe user name;
[in]passwordThe user password;
[in]notifierThe callback to inform the client side that the connection has stumbled upon and error and will go reconnecting
[in]conn_status_notifierThe callback to inform the client side that the connection status has changed
[in]stcnThe callback for informing the client side about the socket thread creation; may be set to NULL if no specific action is required to perform on the client side on a new thread creation
[in]stdnThe callback for informing the client side about the socket thread destruction; may be set to NULL if no specific action is required to perform on the client side on a thread destruction;
[in]user_dataThe user defined value passed to the termination notifier callback along with the connection handle; may be set to whatever value;
[out]connectionThe handle of the created connection.
Returns
DXF_SUCCESS on successful connection establishment or DXF_FAILURE on error; created connection is returned via OUT parameter connection; dxf_get_last_error can be used to retrieve the error code and description in case of failure.
Warning
The user and password data from argument have a higher priority than address credentials.

◆ dxf_create_connection_auth_bearer()

DXFEED_API ERRORCODE dxf_create_connection_auth_bearer ( const char *  address,
const char *  token,
dxf_conn_termination_notifier_t  notifier,
dxf_conn_status_notifier_t  conn_status_notifier,
dxf_socket_thread_creation_notifier_t  stcn,
dxf_socket_thread_destruction_notifier_t  stdn,
void *  user_data,
OUT dxf_connection_t connection 
)

Creates connection with the specified parameters and token authorization.

Parameters
[in]addressConnection string
  • the single address: "host:port" or just "host"
  • address with credentials: "host:port[username=xxx,password=yyy]"
  • multiple addresses: "(host1:port1)(host2)(host3:port3[username=xxx,password=yyy])"
  • the data from file: "/path/to/file" on *nix and "drive:\path\to\file" on Windows
[in]tokenThe authorization token;
[in]notifierThe callback to inform the client side that the connection has stumbled upon and error and will go reconnecting
[in]conn_status_notifierThe callback to inform the client side that the connection status has changed
[in]stcnThe callback for informing the client side about the socket thread creation; may be set to NULL if no specific action is required to perform on the client side on a new thread creation
[in]stdnThe callback for informing the client side about the socket thread destruction; may be set to NULL if no specific action is required to perform on the client side on a thread destruction;
[in]user_dataThe user defined value passed to the termination notifier callback along with the connection handle; may be set to whatever value;
[out]connectionThe handle of the created connection.
Returns
DXF_SUCCESS on successful connection establishment or DXF_FAILURE on error; created connection is returned via OUT parameter connection; dxf_get_last_error can be used to retrieve the error code and description in case of failure.
Warning
The token data from argument have a higher priority than address credentials

◆ dxf_create_connection_auth_custom()

DXFEED_API ERRORCODE dxf_create_connection_auth_custom ( const char *  address,
const char *  authscheme,
const char *  authdata,
dxf_conn_termination_notifier_t  notifier,
dxf_conn_status_notifier_t  conn_status_notifier,
dxf_socket_thread_creation_notifier_t  stcn,
dxf_socket_thread_destruction_notifier_t  stdn,
void *  user_data,
OUT dxf_connection_t connection 
)

Creates connection with the specified parameters and custom described authorization.

Parameters
[in]addressConnection string
  • the single address: host:port or just host
  • address with credentials: host:port[username=xxx,password=yyy]
  • multiple addresses: (host1:port1)(host2)(host3:port3[username=xxx,password=yyy])
  • the data from file: /path/to/file on *nix and drive:\path\to\file on Windows
[in]authschemeThe authorization scheme
[in]authdataThe authorization data
[in]notifierThe callback to inform the client side that the connection has stumbled upon and error and will go reconnecting
[in]conn_status_notifierThe callback to inform the client side that the connection status has changed
[in]stcnThe callback for informing the client side about the socket thread creation; may be set to NULL if no specific action is required to perform on the client side on a new thread creation
[in]stdnThe callback for informing the client side about the socket thread destruction; may be set to NULL if no specific action is required to perform on the client side on a thread destruction;
[in]user_dataThe user defined value passed to the termination notifier callback along with the connection handle; may be set to whatever value;
[out]connectionThe handle of the created connection.
Returns
DXF_SUCCESS on successful connection establishment or DXF_FAILURE on error; created connection is returned via OUT parameter connection; dxf_get_last_error can be used to retrieve the error code and description in case of failure.
Warning
The authscheme and authdata from argument have a higher priority than address credentials.

◆ dxf_free_connection_properties_snapshot()

DXFEED_API ERRORCODE dxf_free_connection_properties_snapshot ( dxf_property_item_t properties,
int  count 
)

Frees memory allocated during dxf_get_connection_properties_snapshot function execution.

Parameters
[in]propertiesPointer to the key-value pairs array
[in]countLength of key-value pairs array
Returns
DXF_SUCCESS if memory has been successfully freed or DXF_FAILURE on error; dxf_get_last_error can be used to retrieve the error code and description in case of failure;

◆ dxf_get_connection_properties_snapshot()

DXFEED_API ERRORCODE dxf_get_connection_properties_snapshot ( dxf_connection_t  connection,
OUT dxf_property_item_t **  properties,
OUT int *  count 
)

Retrieves the array of key-value pairs (properties) for specified connection.

The memory for the resulting array is allocated during execution of the function and SHOULD be free by caller with dxf_free_connection_properties_snapshot function. So done because connection properties can be changed during reconnection. Returned array is a snapshot of properties at the moment of the call.

Parameters
[in]connectionA handle of a previously created connection
[out]propertiesAddress of pointer to store address of key-value pairs array
[out]countAddress of variable to store length of key-value pairs array
Returns
DXF_SUCCESS if connection properties have been successfully received or DXF_FAILURE on error; dxf_get_last_error can be used to retrieve the error code and description in case of failure; properties are returned via output parameter

◆ dxf_get_current_connected_address()

DXFEED_API ERRORCODE dxf_get_current_connected_address ( dxf_connection_t  connection,
OUT char **  address 
)

Retrieves the null-terminated string with current connected address in format <host>:<port>.

If (*address) points to NULL then connection is not connected (reconnection, no valid addresses, closed connection and others). The memory for the resulting string is allocated during execution of the function and SHOULD be free by caller with call of dxf_free function. So done because inner string with connected address can be free during reconnection.

Parameters
[in]connectionA handle of a previously created connection
[out]addressAddress of pointer to store address of the null-terminated string with current connected address
Returns
DXF_SUCCESS if address has been successfully received or DXF_FAILURE on error; dxf_get_last_error can be used to retrieve the error code and description in case of failure; address itself is returned via out parameter

◆ dxf_get_current_connection_status()

DXFEED_API ERRORCODE dxf_get_current_connection_status ( dxf_connection_t  connection,
OUT dxf_connection_status_t status 
)

Retrieves the current connection status.

Parameters
[in]connectionA handle of a previously created connection
[out]statusConnection status
Returns
DXF_SUCCESS if connection status has been successfully received or DXF_FAILURE on error; dxf_get_last_error can be used to retrieve the error code and description in case of failure; status itself is returned via out parameter