]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/ERR_put_error.pod
Add ERR_put_func_error, and use it.
[thirdparty/openssl.git] / doc / man3 / ERR_put_error.pod
CommitLineData
388f2f56
UM
1=pod
2
3=head1 NAME
4
56c3a135
RS
5ERR_put_error, ERR_put_func_error,
6ERR_add_error_data, ERR_add_error_vdata - record an error
388f2f56
UM
7
8=head1 SYNOPSIS
9
10 #include <openssl/err.h>
11
e9b77246 12 void ERR_put_error(int lib, int func, int reason, const char *file, int line);
56c3a135
RS
13 void ERR_put_func_error(int lib, const char *func, int reason,
14 const char *file, int line);
388f2f56
UM
15
16 void ERR_add_error_data(int num, ...);
61ced34f 17 void ERR_add_error_vdata(int num, va_list arg);
388f2f56
UM
18
19=head1 DESCRIPTION
20
21ERR_put_error() adds an error code to the thread's error queue. It
22signals that the error of reason code B<reason> occurred in function
23B<func> of library B<lib>, in line number B<line> of B<file>.
24This function is usually called by a macro.
25
56c3a135
RS
26ERR_put_func_err() is similar except that the B<func> is a string naming
27a function external to OpenSSL, usually provided by the platform on which
28OpenSSL and the application is running.
29
388f2f56
UM
30ERR_add_error_data() associates the concatenation of its B<num> string
31arguments with the error code added last.
c952780c 32ERR_add_error_vdata() is similar except the argument is a B<va_list>.
8908d18c 33Multiple calls to these functions append to the current top of the error queue.
388f2f56 34
9b86974e 35L<ERR_load_strings(3)> can be used to register
388f2f56
UM
36error strings so that the application can a generate human-readable
37error messages for the error code.
38
53934822
RS
39=head2 Reporting errors
40
41Each sub-library has a specific macro XXXerr() that is used to report
42errors. Its first argument is a function code B<XXX_F_...>, the second
43argument is a reason code B<XXX_R_...>. Function codes are derived
44from the function names; reason codes consist of textual error
45descriptions. For example, the function ssl3_read_bytes() reports a
46"handshake failure" as follows:
47
48 SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE);
49
50Function and reason codes should consist of upper case characters,
51numbers and underscores only. The error file generation script translates
52function codes into function names by looking in the header files
53for an appropriate function name, if none is found it just uses
54the capitalized form such as "SSL3_READ_BYTES" in the above example.
55
56The trailing section of a reason code (after the "_R_") is translated
57into lower case and underscores changed to spaces.
58
53934822
RS
59Although a library will normally report errors using its own specific
60XXXerr macro, another library's macro can be used. This is normally
61only done when a library wants to include ASN1 code which must use
62the ASN1err() macro.
63
64
388f2f56
UM
65=head1 RETURN VALUES
66
67ERR_put_error() and ERR_add_error_data() return
68no values.
69
70=head1 SEE ALSO
71
73fb82b7 72L<ERR_load_strings(3)>
388f2f56 73
e2f92610
RS
74=head1 COPYRIGHT
75
73fb82b7 76Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 77
4746f25a 78Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
79this file except in compliance with the License. You can obtain a copy
80in the file LICENSE in the source distribution or at
81L<https://www.openssl.org/source/license.html>.
82
83=cut