gnutls_alert_get - Linux
Overview
The gnutls_alert_get
function retrieves the current alert from the session. An alert is a simple message indicating the reason for closing a session.
Syntax
gnutls_alert_get(session)
| Argument | Description |
|—|—|
| session | A pointer to the session to query. |
Options/Flags
There are no options or flags available for this function.
Examples
/* Get the current alert from a session */
gnutls_alert_t alert = gnutls_alert_get(session);
printf("Current alert: %s\n", gnutls_alert_get_name(alert));
Common Issues
If the session is not established, gnutls_alert_get
will return GNUTLS_A_NO_ALERT
.
Integration
The gnutls_alert_get
function can be used in conjunction with other GnuTLS functions to handle alerts in a TLS/SSL session. For example, it can be used to determine the reason for a session closure or to send an alert to the peer.
Related Commands
gnutls_alert_send
– Send an alert to the peer.gnutls_alert_get_name
– Get the name of an alert.