#include <gnutls_int.h>
#include <gnutls_errors.h>
#include <gnutls_record.h>
#include <debug.h>
Go to the source code of this file.
Defines | |
#define | GNUTLS_ALERT_LOOP(b) |
#define | GNUTLS_ALERT_ID_LOOP(a) GNUTLS_ALERT_LOOP( if(p->alert == alert) { a; break; }) |
Functions | |
const char * | MHD__gnutls_alert_get_name (MHD_gnutls_alert_description_t alert) |
int | MHD__gnutls_alert_send (MHD_gtls_session_t session, MHD_gnutls_alert_level_t level, MHD_gnutls_alert_description_t desc) |
int | MHD_gtls_error_to_alert (int err, int *level) |
int | MHD__gnutls_alert_send_appropriate (MHD_gtls_session_t session, int err) |
MHD_gnutls_alert_description_t | MHD_gnutls_alert_get (MHD_gtls_session_t session) |
Variables | |
static const MHD_gnutls_alert_entry | MHD_gtls_sup_alerts [] |
#define GNUTLS_ALERT_ID_LOOP | ( | a | ) | GNUTLS_ALERT_LOOP( if(p->alert == alert) { a; break; }) |
#define GNUTLS_ALERT_LOOP | ( | b | ) |
Value:
const MHD_gnutls_alert_entry *p; \ for(p = MHD_gtls_sup_alerts; p->desc != NULL; p++) { b ; }
Definition at line 69 of file gnutls_alert.c.
const char* MHD__gnutls_alert_get_name | ( | MHD_gnutls_alert_description_t | alert | ) |
MHD__gnutls_alert_get_name - Returns a string describing the alert number given : is an alert number MHD_gtls_session_t structure.
This function will return a string that describes the given alert number or NULL. See MHD_gnutls_alert_get().
Definition at line 86 of file gnutls_alert.c.
References GNUTLS_ALERT_ID_LOOP.
Referenced by MHD__gnutls_alert_send(), MHD_tls_connection_handle_read(), and record_check_type().
int MHD__gnutls_alert_send | ( | MHD_gtls_session_t | session, | |
MHD_gnutls_alert_level_t | level, | |||
MHD_gnutls_alert_description_t | desc | |||
) |
MHD__gnutls_alert_send - This function sends an alert message to the peer : is a MHD_gtls_session_t structure. : is the level of the alert : is the alert description
This function will send an alert to the peer in order to inform him of something important (eg. his Certificate could not be verified). If the alert level is Fatal then the peer is expected to close the connection, otherwise he may ignore the alert and continue.
The error code of the underlying record send function will be returned, so you may also receive GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN as well.
Returns 0 on success.
Definition at line 113 of file gnutls_alert.c.
References GNUTLS_ALERT, MHD__gnutls_alert_get_name(), MHD__gnutls_record_log, and MHD_gtls_send_int().
Referenced by MHD__gnutls_alert_send_appropriate(), MHD__gnutls_bye(), and MHD_gtls_send_client_certificate().
int MHD__gnutls_alert_send_appropriate | ( | MHD_gtls_session_t | session, | |
int | err | |||
) |
MHD__gnutls_alert_send_appropriate - This function sends an alert to the peer depending on the error code : is a MHD_gtls_session_t structure. : is an integer
Sends an alert to the peer depending on the error code returned by a gnutls function. This function will call MHD_gtls_error_to_alert() to determine the appropriate alert to send.
This function may also return GNUTLS_E_AGAIN, or GNUTLS_E_INTERRUPTED.
If the return value is GNUTLS_E_INVALID_REQUEST, then no alert has been sent to the peer.
Returns zero on success.
Definition at line 265 of file gnutls_alert.c.
References MHD__gnutls_alert_send(), and MHD_gtls_error_to_alert().
MHD_gnutls_alert_description_t MHD_gnutls_alert_get | ( | MHD_gtls_session_t | session | ) |
MHD_gnutls_alert_get - Returns the last alert number received. : is a MHD_gtls_session_t structure.
This function will return the last alert number received. This function should be called if GNUTLS_E_WARNING_ALERT_RECEIVED or GNUTLS_E_FATAL_ALERT_RECEIVED has been returned by a gnutls function. The peer may send alerts if he thinks some things were not right. Check gnutls.h for the available alert descriptions.
If no alert has been received the returned value is undefined.
Definition at line 293 of file gnutls_alert.c.
References MHD_gtls_session_int::internals, and MHD_gtls_internals_st::last_alert.
Referenced by MHD__gnutls_abort_handshake(), and MHD_gtls_recv_client_certificate().
int MHD_gtls_error_to_alert | ( | int | err, | |
int * | level | |||
) |
MHD_gtls_error_to_alert - This function returns an alert code based on the given error code : is a negative integer : the alert level will be stored there
Returns an alert depending on the error code returned by a gnutls function. All alerts sent by this function should be considered fatal. The only exception is when err == GNUTLS_E_REHANDSHAKE, where a warning alert should be sent to the peer indicating that no renegotiation will be performed.
If there is no mapping to a valid alert the alert to indicate internal error is returned.
Definition at line 152 of file gnutls_alert.c.
References GNUTLS_A_BAD_CERTIFICATE, GNUTLS_A_BAD_RECORD_MAC, GNUTLS_A_DECOMPRESSION_FAILURE, GNUTLS_A_HANDSHAKE_FAILURE, GNUTLS_A_ILLEGAL_PARAMETER, GNUTLS_A_INSUFFICIENT_SECURITY, GNUTLS_A_INTERNAL_ERROR, GNUTLS_A_NO_RENEGOTIATION, GNUTLS_A_PROTOCOL_VERSION, GNUTLS_A_RECORD_OVERFLOW, GNUTLS_A_UNEXPECTED_MESSAGE, GNUTLS_A_UNSUPPORTED_CERTIFICATE, GNUTLS_A_UNSUPPORTED_EXTENSION, GNUTLS_AL_FATAL, GNUTLS_AL_WARNING, GNUTLS_E_ASN1_DER_ERROR, GNUTLS_E_ASN1_DER_OVERFLOW, GNUTLS_E_ASN1_ELEMENT_NOT_FOUND, GNUTLS_E_ASN1_GENERIC_ERROR, GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND, GNUTLS_E_ASN1_SYNTAX_ERROR, GNUTLS_E_ASN1_TAG_ERROR, GNUTLS_E_ASN1_TAG_IMPLICIT, GNUTLS_E_ASN1_TYPE_ANY_ERROR, GNUTLS_E_ASN1_VALUE_NOT_FOUND, GNUTLS_E_ASN1_VALUE_NOT_VALID, GNUTLS_E_DECOMPRESSION_FAILED, GNUTLS_E_DECRYPTION_FAILED, GNUTLS_E_DH_PRIME_UNACCEPTABLE, GNUTLS_E_ILLEGAL_SRP_USERNAME, GNUTLS_E_INSUFFICIENT_CREDENTIALS, GNUTLS_E_INTERNAL_ERROR, GNUTLS_E_NO_CERTIFICATE_FOUND, GNUTLS_E_NO_CIPHER_SUITES, GNUTLS_E_NO_COMPRESSION_ALGORITHMS, GNUTLS_E_NO_TEMPORARY_DH_PARAMS, GNUTLS_E_NO_TEMPORARY_RSA_PARAMS, GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION, GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER, GNUTLS_E_REHANDSHAKE, GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET, GNUTLS_E_UNEXPECTED_PACKET, GNUTLS_E_UNEXPECTED_PACKET_LENGTH, GNUTLS_E_UNKNOWN_CIPHER_SUITE, GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM, GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE, and GNUTLS_E_UNSUPPORTED_VERSION_PACKET.
Referenced by MHD__gnutls_alert_send_appropriate().
const MHD_gnutls_alert_entry MHD_gtls_sup_alerts[] [static] |
Definition at line 36 of file gnutls_alert.c.