The mi_set_connection_user_data() function
The mi_set_connection_user_data() function associates the address of user data with an open connection.
Syntax
mi_integer mi_set_connection_user_data(conn, user_data_ptr)
MI_CONNECTION *conn;
void *user_data_ptr;
- conn
- A pointer to a connection descriptor established by a previous
call to mi_open(), mi_server_connect(),
or mi_server_reconnect().
The value can be a pointer to a session-duration connection descriptor established by a previous call to mi_get_session_connection(). Use of a session-duration connection descriptor is an advanced feature of the DataBlade® API.
- user_data_ptr
- A pointer to user data to associate with the specified connection.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
The mi_set_connection_user_data() function assigns the user-data pointer that user_data_ptr references to the connection descriptor that conn references. The user-data pointer is the address to a user-defined buffer or structure that contains private information you want to keep with the specified connection.
The DataBlade® API does not interpret or touch the associated user-data pointer, other than to store it in the connection descriptor. Cast the user_data_ptr pointer to void * before you store it as user data in a connection descriptor.
Return values
- MI_OK
- The function was successful.
- MI_ERROR
- The function was not successful.