<elf-symbol name='gnutls_alert_get_strname' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_alert_send' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_alert_send_appropriate' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ <elf-symbol name='gnutls_alert_set_read_function' version='GNUTLS_3_7_0' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_alpn_get_selected_protocol' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_alpn_set_protocols' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_anon_allocate_client_credentials' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
gnutls_alert_get_strname@GNUTLS_3_4
gnutls_alert_send@GNUTLS_3_4
gnutls_alert_send_appropriate@GNUTLS_3_4
+gnutls_alert_set_read_function@GNUTLS_3_7_0
gnutls_alpn_get_selected_protocol@GNUTLS_3_4
gnutls_alpn_set_protocols@GNUTLS_3_4
gnutls_anon_allocate_client_credentials@GNUTLS_3_4
FUNCS += functions/gnutls_alert_send.short
FUNCS += functions/gnutls_alert_send_appropriate
FUNCS += functions/gnutls_alert_send_appropriate.short
+FUNCS += functions/gnutls_alert_set_read_function
+FUNCS += functions/gnutls_alert_set_read_function.short
FUNCS += functions/gnutls_alpn_get_selected_protocol
FUNCS += functions/gnutls_alpn_get_selected_protocol.short
FUNCS += functions/gnutls_alpn_set_protocols
APIMANS += gnutls_alert_get_strname.3
APIMANS += gnutls_alert_send.3
APIMANS += gnutls_alert_send_appropriate.3
+APIMANS += gnutls_alert_set_read_function.3
APIMANS += gnutls_alpn_get_selected_protocol.3
APIMANS += gnutls_alpn_set_protocols.3
APIMANS += gnutls_anon_allocate_client_credentials.3
_gnutls_record_log("REC: Sending Alert[%d|%d] - %s\n", data[0],
data[1], name);
+ if (session->internals.alert_read_func) {
+ record_parameters_st *params;
+
+ ret = _gnutls_epoch_get(session, EPOCH_WRITE_CURRENT, ¶ms);
+ if (ret < 0)
+ return gnutls_assert_val(ret);
+ ret = session->internals.alert_read_func(session,
+ params->write.level,
+ level,
+ desc);
+ if (ret < 0)
+ return gnutls_assert_val(ret);
+
+ return ret;
+ }
+
if ((ret =
_gnutls_send_int(session, GNUTLS_ALERT, -1,
EPOCH_WRITE_CURRENT, data, 2,
int16_t h_post; /* whether post-generation/receive */
gnutls_handshake_read_func h_read_func;
gnutls_handshake_secret_func h_secret_func;
+ gnutls_alert_read_func alert_read_func;
gnutls_keylog_func keylog_func;
gnutls_handshake_set_secret_function(gnutls_session_t session,
gnutls_handshake_secret_func func);
+ /**
+ * gnutls_alert_read_func:
+ * @session: the current session
+ * @level: #gnutls_record_encryption_level_t
+ * @alert_level: the level of the alert
+ * @alert_desc: the alert description
+ *
+ * Function prototype for alert intercepting hooks. It is set using
+ * gnutls_alert_set_read_function().
+ *
+ * Returns: Non zero on error.
+ * Since: 3.7.0
+ */
+typedef int (*gnutls_alert_read_func) (gnutls_session_t session,
+ gnutls_record_encryption_level_t level,
+ gnutls_alert_level_t alert_level,
+ gnutls_alert_description_t alert_desc);
+
+void
+gnutls_alert_set_read_function(gnutls_session_t session,
+ gnutls_alert_read_func func);
+
/* FIPS140-2 related functions */
unsigned gnutls_fips140_mode_enabled(void);
GNUTLS_3_7_0
{
global:
+ gnutls_alert_set_read_function;
gnutls_handshake_set_read_function;
gnutls_handshake_set_secret_function;
gnutls_handshake_write;
session->internals.h_read_func = func;
}
+/**
+ * gnutls_alert_set_read_function:
+ * @session: is #gnutls_session_t type
+ * @func: is the function to be called
+ *
+ * This function will set a callback to be called when an alert
+ * message is being sent.
+ *
+ * Since: 3.7.0
+ */
+void
+gnutls_alert_set_read_function(gnutls_session_t session,
+ gnutls_alert_read_func func)
+{
+ session->internals.alert_read_func = func;
+}
+
/**
* gnutls_record_get_state:
* @session: is a #gnutls_session_t type