blob: 60df430667b1fdb522141a874ecdb425dd7d7e03 [file] [log] [blame]
Ulf Möller388f2f52000-02-01 01:37:00 +00001=pod
2
3=head1 NAME
4
Richard Levittee1b78bc2000-09-14 21:23:28 +00005ERR_error_string, ERR_error_string_n, ERR_lib_error_string,
6ERR_func_error_string, ERR_reason_error_string - obtain human-readable
7error message
Ulf Möller388f2f52000-02-01 01:37:00 +00008
9=head1 SYNOPSIS
10
11 #include <openssl/err.h>
12
13 char *ERR_error_string(unsigned long e, char *buf);
Dr. Stephen Henson4451c252004-11-14 15:11:37 +000014 void ERR_error_string_n(unsigned long e, char *buf, size_t len);
Ulf Möller388f2f52000-02-01 01:37:00 +000015
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
22ERR_error_string() generates a human-readable string representing the
Bodo Möllere5c84d52000-04-14 23:36:15 +000023error code I<e>, and places it at I<buf>. I<buf> must be at least 120
24bytes long. If I<buf> is B<NULL>, the error string is placed in a
Ulf Möller388f2f52000-02-01 01:37:00 +000025static buffer.
Bodo Möllere5c84d52000-04-14 23:36:15 +000026ERR_error_string_n() is a variant of ERR_error_string() that writes
27at most I<len> characters (including the terminating 0)
Bodo Möller2c8c4ce2000-04-15 00:04:30 +000028and truncates the string if necessary.
Bodo Möllere5c84d52000-04-14 23:36:15 +000029For ERR_error_string_n(), I<buf> may not be B<NULL>.
Ulf Möller388f2f52000-02-01 01:37:00 +000030
31The string will have the following format:
32
33 error:[error code]:[library name]:[function name]:[reason string]
34
35I<error code> is an 8 digit hexadecimal number, I<library name>,
36I<function name> and I<reason string> are ASCII text.
37
38ERR_lib_error_string(), ERR_func_error_string() and
39ERR_reason_error_string() return the library name, function
40name and reason string respectively.
41
42The OpenSSL error strings should be loaded by calling
Rich Salz9b869742015-08-17 15:21:33 -040043L<ERR_load_crypto_strings(3)> or, for SSL
44applications, L<SSL_load_error_strings(3)>
Ulf Möller388f2f52000-02-01 01:37:00 +000045first.
46If there is no text string registered for the given error code,
47the error string will contain the numeric code.
48
Rich Salz9b869742015-08-17 15:21:33 -040049L<ERR_print_errors(3)> can be used to print
Ulf Möller388f2f52000-02-01 01:37:00 +000050all error codes currently in the queue.
51
52=head1 RETURN VALUES
53
54ERR_error_string() returns a pointer to a static buffer containing the
Bodo Möllere5c84d52000-04-14 23:36:15 +000055string if I<buf> B<== NULL>, I<buf> otherwise.
Ulf Möller388f2f52000-02-01 01:37:00 +000056
57ERR_lib_error_string(), ERR_func_error_string() and
58ERR_reason_error_string() return the strings, and B<NULL> if
59none is registered for the error code.
60
61=head1 SEE ALSO
62
Rich Salz9b869742015-08-17 15:21:33 -040063L<err(3)>, L<ERR_get_error(3)>,
64L<ERR_load_crypto_strings(3)>,
65L<SSL_load_error_strings(3)>
66L<ERR_print_errors(3)>
Ulf Möller388f2f52000-02-01 01:37:00 +000067
Ulf Möller388f2f52000-02-01 01:37:00 +000068=cut