Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 1 | =pod |
| 2 | |
| 3 | =head1 NAME |
| 4 | |
Richard Levitte | e1b78bc | 2000-09-14 21:23:28 +0000 | [diff] [blame] | 5 | ERR_error_string, ERR_error_string_n, ERR_lib_error_string, |
| 6 | ERR_func_error_string, ERR_reason_error_string - obtain human-readable |
| 7 | error message |
Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 8 | |
| 9 | =head1 SYNOPSIS |
| 10 | |
| 11 | #include <openssl/err.h> |
| 12 | |
| 13 | char *ERR_error_string(unsigned long e, char *buf); |
Dr. Stephen Henson | 4451c25 | 2004-11-14 15:11:37 +0000 | [diff] [blame] | 14 | void ERR_error_string_n(unsigned long e, char *buf, size_t len); |
Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 15 | |
| 16 | const char *ERR_lib_error_string(unsigned long e); |
| 17 | const char *ERR_func_error_string(unsigned long e); |
| 18 | const char *ERR_reason_error_string(unsigned long e); |
| 19 | |
| 20 | =head1 DESCRIPTION |
| 21 | |
| 22 | ERR_error_string() generates a human-readable string representing the |
Bodo Möller | e5c84d5 | 2000-04-14 23:36:15 +0000 | [diff] [blame] | 23 | error code I<e>, and places it at I<buf>. I<buf> must be at least 120 |
| 24 | bytes long. If I<buf> is B<NULL>, the error string is placed in a |
Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 25 | static buffer. |
Bodo Möller | e5c84d5 | 2000-04-14 23:36:15 +0000 | [diff] [blame] | 26 | ERR_error_string_n() is a variant of ERR_error_string() that writes |
| 27 | at most I<len> characters (including the terminating 0) |
Bodo Möller | 2c8c4ce | 2000-04-15 00:04:30 +0000 | [diff] [blame] | 28 | and truncates the string if necessary. |
Bodo Möller | e5c84d5 | 2000-04-14 23:36:15 +0000 | [diff] [blame] | 29 | For ERR_error_string_n(), I<buf> may not be B<NULL>. |
Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 30 | |
| 31 | The string will have the following format: |
| 32 | |
| 33 | error:[error code]:[library name]:[function name]:[reason string] |
| 34 | |
| 35 | I<error code> is an 8 digit hexadecimal number, I<library name>, |
| 36 | I<function name> and I<reason string> are ASCII text. |
| 37 | |
| 38 | ERR_lib_error_string(), ERR_func_error_string() and |
| 39 | ERR_reason_error_string() return the library name, function |
| 40 | name and reason string respectively. |
| 41 | |
| 42 | The OpenSSL error strings should be loaded by calling |
Rich Salz | 9b86974 | 2015-08-17 15:21:33 -0400 | [diff] [blame] | 43 | L<ERR_load_crypto_strings(3)> or, for SSL |
| 44 | applications, L<SSL_load_error_strings(3)> |
Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 45 | first. |
| 46 | If there is no text string registered for the given error code, |
| 47 | the error string will contain the numeric code. |
| 48 | |
Rich Salz | 9b86974 | 2015-08-17 15:21:33 -0400 | [diff] [blame] | 49 | L<ERR_print_errors(3)> can be used to print |
Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 50 | all error codes currently in the queue. |
| 51 | |
| 52 | =head1 RETURN VALUES |
| 53 | |
| 54 | ERR_error_string() returns a pointer to a static buffer containing the |
Bodo Möller | e5c84d5 | 2000-04-14 23:36:15 +0000 | [diff] [blame] | 55 | string if I<buf> B<== NULL>, I<buf> otherwise. |
Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 56 | |
| 57 | ERR_lib_error_string(), ERR_func_error_string() and |
| 58 | ERR_reason_error_string() return the strings, and B<NULL> if |
| 59 | none is registered for the error code. |
| 60 | |
| 61 | =head1 SEE ALSO |
| 62 | |
Rich Salz | 9b86974 | 2015-08-17 15:21:33 -0400 | [diff] [blame] | 63 | L<err(3)>, L<ERR_get_error(3)>, |
| 64 | L<ERR_load_crypto_strings(3)>, |
| 65 | L<SSL_load_error_strings(3)> |
| 66 | L<ERR_print_errors(3)> |
Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 67 | |
Ulf Möller | 388f2f5 | 2000-02-01 01:37:00 +0000 | [diff] [blame] | 68 | =cut |