z/OS Cryptographic Services System SSL Programming
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Use of user data

z/OS Cryptographic Services System SSL Programming
SC14-7495-00

Some complex applications require application-specific data to be available in the SSL callbacks. SSL enables this with the gsk_attribute_set_buffer() and gsk_attribute_get_buffer() function calls. In addition, the I/O callbacks pass a pointer to the user data.

These are the steps that need to be taken to effectively use the user data functions:

  • Issue the gsk_secure_socket_open() function. This returns a soc_handle.
  • To set the user data for a connection issue:
    • gsk_attribute_set_buffer(soc_handle, GSK_USER_DATA, user_data, sizeof(user_data));
    • This function call copies the user_data into an area of storage owned by SSL.
  • The address of the SSL copy of the user data is passed as a parameter to the user-specified read, write, getpeername, and set_socket_options callbacks.
  • Other callbacks pass the soc_handle as a parameter to the callback. To find the address of the copy of user data associated with a particular connection, issue:
    • gsk_attribute_get_buffer(soc_handle, GSK_USER_DATA, &user_data_ptr, &user_data_size);
    • You can modify the contents of the SSL copy of the user data, but you may not free or re-allocate the SSL user data. The SSL user data is freed when the connection is closed with the gsk_secure_socket_close() function call.

You can point to other application data from the SSL user data area. However, it is up to the application to free this other application data before the connection is closed.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014