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