Skip to main content

dxf_create_connection_auth_basic

Function dxf_create_connection_auth_basic 

Source
pub unsafe extern "C" fn dxf_create_connection_auth_basic(
    address: *const c_char,
    user: *const c_char,
    password: *const c_char,
    notifier: dxf_conn_termination_notifier_t,
    conn_status_notifier: dxf_conn_status_notifier_t,
    stcn: dxf_socket_thread_creation_notifier_t,
    stdn: dxf_socket_thread_destruction_notifier_t,
    user_data: *mut c_void,
    connection: *mut dxf_connection_t,
) -> ERRORCODE
Expand description

@ingroup c-api-connection-functions

@brief Creates connection with the specified parameters and basic authorization.

@details

The address string may have connectOrder property with possible values: shuffle, random, ordered, priority

  • The shuffle strategy: Example: host1:port1,host2:port2,host3:port3[connectOrder=shuffle] It will shuffle the resolved IP addresses, and it will go through them to the end, and then it will resolve and shuffle and so on.
  • The random strategy: Example: host1:port1,host2:port2,host3:port3[connectOrder=random] It will shuffle IP addresses, if the connection is successful, it will reset the state and will shuffle on the next connection, and so on.
  • The ordered strategy: Example: host1:port1,host2:port2,host3:port3[connectOrder=ordered] It will NOT shuffle the resolved IP addresses, and it will go through them to the end, and then it will resolve and NOT shuffle and so on.
  • The priority strategy: Example: host1:port1,host2:port2,host3:port3[connectOrder=priority] It will NOT shuffle IP addresses, if the connection is successful, it will reset the state and will NOT shuffle on the next connection, and so on.
  • The default strategy is shuffle
  • If several strategies are specified in the address line, the last one will be selected.
  • Example #1: host1:port1,host2:port2,host3:port3[connectOrder=priority,connectOrder=ordered] will be equivalent to host1:port1,host2:port2,host3:port3[connectOrder=ordered]
  • Example #2: (host1:port1,host2:port2[connectOrder=random])(host3:port3[connectOrder=priority,connectOrder=ordered]) will be equivalent to host1:port1,host2:port2,host3:port3[connectOrder=ordered]

@param[in] address Connection string - the single address: host:port - address with credentials: host:port[username=xxx,password=yyy] - multiple addresses: host1:port1,host2,host3:port3[username=xxx,password=yyy] or (host1:port1,host2:port2)(host3:port3[username=xxx,password=yyy]) - addresses with connect order: host1:port1,host2,host3:port3[connectOrder=ordered] - the data from file: /path/to/file on *nix and drive:\path\to\file on Windows @param[in] user The user name; @param[in] password The user password; @param[in] notifier The callback to inform the client side that the connection has stumbled upon and error and will go reconnecting @param[in] conn_status_notifier The callback to inform the client side that the connection status has changed @param[in] stcn The 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 @param[in] stdn The 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; @param[in] user_data The user defined value passed to the termination notifier callback along with the connection handle; may be set to whatever value; @param[out] connection The handle of the created connection.

@return {@link DXF_SUCCESS} on successful connection establishment or {@link DXF_FAILURE} on error; created connection is returned via OUT parameter connection; {@link 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.