Previous: Thread safety, Up: Introduction to the library   [Contents][Index]


6.1.6 Callback functions

There are several cases where GnuTLS may need out of band input from your program. This is now implemented using some callback functions, which your program is expected to register.

An example of this type of functions are the push and pull callbacks which are used to specify the functions that will retrieve and send data to the transport layer.

void gnutls_transport_set_push_function (gnutls_session_t session, gnutls_push_func push_func)
void gnutls_transport_set_pull_function (gnutls_session_t session, gnutls_pull_func pull_func)

Other callback functions may require more complicated input and data to be allocated. Such an example is gnutls_srp_set_server_credentials_function. All callbacks should allocate and free memory using gnutls_malloc and gnutls_free.