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