The mi_get_connection_user_data() function

The mi_get_connection_user_data() function obtains the address of user data associated with an open connection.

Syntax

mi_integer mi_get_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().

This 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
The address of the user-data pointer that is associated with the specified connection.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_get_connection_user_data() function obtains the address of the user-data pointer, which user_data_ptr references, from 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 retrieve it from the connection descriptor. Cast the user_data_ptr pointer from void ** to the address of the user-data pointer for the data structure before you use it as the user-data pointer in a DataBlade® API module.

You can set the user-data pointer with the mi_set_connection_user_data() function.

Return values

MI_OK
The function was successful.
MI_ERROR
The function was not successful.