inline
static int call_hook_func(gnutls_session_t session, gnutls_handshake_description_t type,
- unsigned post, unsigned incoming)
+ unsigned incoming)
{
if (session->internals.h_hook == NULL)
return 0;
else
{
if (session->internals.h_type == type || session->internals.h_type == GNUTLS_HANDSHAKE_ANY)
- return session->internals.h_hook(session, type, post, incoming);
+ return session->internals.h_hook(session, type, incoming);
return 0;
}
return ret;
}
- ret = call_hook_func(session, type, 0, 0);
+ session->internals.last_handshake_out = type;
+
+ ret = call_hook_func(session, type, 0);
if (ret < 0)
{
gnutls_assert ();
- _mbuffer_xfree(&bufel);
return ret;
}
- session->internals.last_handshake_out = type;
-
ret = _gnutls_handshake_io_cache_int (session, type, bufel);
if (ret < 0)
{
break;
}
- ret = call_hook_func(session, type, 1, 0);
- if (ret < 0)
- {
- gnutls_assert ();
- return ret;
- }
-
return ret;
}
session->internals.last_handshake_in = hsk.htype;
- ret = call_hook_func(session, hsk.htype, 0, 1);
- if (ret < 0)
- {
- gnutls_assert ();
- goto cleanup;
- }
-
ret = _gnutls_handshake_hash_add_recvd (session, hsk.htype,
hsk.header, hsk.header_size,
hsk.data.data, hsk.data.length);
goto cleanup;
}
- ret = call_hook_func(session, hsk.htype, 1, 1);
+ ret = call_hook_func(session, hsk.htype, 1);
if (ret < 0)
{
gnutls_assert ();
* @htype: the %gnutls_handshake_description_t of the message to hook at.
* @func: is the function to be called
*
- * This function will set a callback to be called after or before the specified
+ * This function will set a callback to be called after the specified
* handshake message has been received or generated. This is a
* generalization of gnutls_handshake_set_post_client_hello_function().
*
* gnutls_handshake_hook_func:
* @session: the current session
* @htype: the type of the handshake message (%gnutls_handshake_description_t)
- * @post: non zero if this is an post-process/generation call and zero otherwise
* @incoming: non zero if this is an incoming message and zero if this is an outgoing message
*
* Function prototype for handshake hooks. It is set using
* Returns: Non zero on error.
*/
- typedef int (*gnutls_handshake_hook_func) (gnutls_session_t, unsigned int htype, unsigned int post, unsigned int incoming);
+ typedef int (*gnutls_handshake_hook_func) (gnutls_session_t, unsigned int htype, unsigned int incoming);
void gnutls_handshake_set_hook_function (gnutls_session_t session,
unsigned int htype,
gnutls_handshake_hook_func func);