Blame doc/man3/ERR_put_error.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
ERR_put_error, ERR_add_error_data, ERR_add_error_vdata - record an error
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/err.h>
Packit c4476c
Packit c4476c
 void ERR_put_error(int lib, int func, int reason, const char *file, int line);
Packit c4476c
Packit c4476c
 void ERR_add_error_data(int num, ...);
Packit c4476c
 void ERR_add_error_vdata(int num, va_list arg);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
ERR_put_error() adds an error code to the thread's error queue. It
Packit c4476c
signals that the error of reason code B<reason> occurred in function
Packit c4476c
B<func> of library B<lib>, in line number B<line> of B<file>.
Packit c4476c
This function is usually called by a macro.
Packit c4476c
Packit c4476c
ERR_add_error_data() associates the concatenation of its B<num> string
Packit c4476c
arguments with the error code added last.
Packit c4476c
ERR_add_error_vdata() is similar except the argument is a B<va_list>.
Packit c4476c
Packit c4476c
L<ERR_load_strings(3)> can be used to register
Packit c4476c
error strings so that the application can a generate human-readable
Packit c4476c
error messages for the error code.
Packit c4476c
Packit c4476c
=head2 Reporting errors
Packit c4476c
Packit c4476c
Each sub-library has a specific macro XXXerr() that is used to report
Packit c4476c
errors. Its first argument is a function code B<XXX_F_...>, the second
Packit c4476c
argument is a reason code B<XXX_R_...>. Function codes are derived
Packit c4476c
from the function names; reason codes consist of textual error
Packit c4476c
descriptions. For example, the function ssl3_read_bytes() reports a
Packit c4476c
"handshake failure" as follows:
Packit c4476c
Packit c4476c
 SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE);
Packit c4476c
Packit c4476c
Function and reason codes should consist of upper case characters,
Packit c4476c
numbers and underscores only. The error file generation script translates
Packit c4476c
function codes into function names by looking in the header files
Packit c4476c
for an appropriate function name, if none is found it just uses
Packit c4476c
the capitalized form such as "SSL3_READ_BYTES" in the above example.
Packit c4476c
Packit c4476c
The trailing section of a reason code (after the "_R_") is translated
Packit c4476c
into lower case and underscores changed to spaces.
Packit c4476c
Packit c4476c
Although a library will normally report errors using its own specific
Packit c4476c
XXXerr macro, another library's macro can be used. This is normally
Packit c4476c
only done when a library wants to include ASN1 code which must use
Packit c4476c
the ASN1err() macro.
Packit c4476c
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
ERR_put_error() and ERR_add_error_data() return
Packit c4476c
no values.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<ERR_load_strings(3)>
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut