summaryrefslogtreecommitdiff
path: root/lib/gnutls_state.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-07-11 23:03:35 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-07-11 23:20:54 +0200
commitdc7ef147e0ac7dbd63158269a5c6426306678dd6 (patch)
treeac93b164ef9be0e6991673d2b7f2226c60f6c367 /lib/gnutls_state.c
parent9710537aec5de17d07ae6d2b07c956db8e8257bf (diff)
downloadgnutls-dc7ef147e0ac7dbd63158269a5c6426306678dd6.tar.gz
Allow hooks to be called before or after generation/receiving.
Diffstat (limited to 'lib/gnutls_state.c')
-rw-r--r--lib/gnutls_state.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index a5b8ec8c99..a7e8a6b81c 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -1410,14 +1410,19 @@ gnutls_handshake_set_random (gnutls_session_t session, const gnutls_datum_t* ran
/**
* gnutls_handshake_set_hook_function:
- * @session: is a #gnutls_session_t structure.
- * @htype: the %gnutls_handshake_description_t of the message to hook at.
+ * @session: is a #gnutls_session_t structure
+ * @htype: the %gnutls_handshake_description_t of the message to hook at
+ * @post: %GNUTLS_HOOK_* depending on when the hook function should be called
* @func: is the function to be called
*
* This function will set a callback to be called after or before the specified
* handshake message has been received or generated. This is a
* generalization of gnutls_handshake_set_post_client_hello_function().
*
+ * To call the hook function prior to the message being sent/generation use
+ * %GNUTLS_HOOK_PRE as @post parameter, %GNUTLS_HOOK_POST to call
+ * after, and %GNUTLS_HOOK_BOTH for both cases.
+ *
* This callback must return 0 on success or a gnutls error code to
* terminate the handshake.
*
@@ -1433,9 +1438,11 @@ gnutls_handshake_set_random (gnutls_session_t session, const gnutls_datum_t* ran
void
gnutls_handshake_set_hook_function (gnutls_session_t session,
unsigned int htype,
+ int post,
gnutls_handshake_hook_func func)
{
session->internals.h_hook = func;
session->internals.h_type = htype;
+ session->internals.h_post = post;
}