BIO_seed() and BIO_tell() were documented in two other documents,
[openssl.git] / doc / crypto / ERR_error_string.pod
1 =pod
2
3 =head1 NAME
4
5 ERR_error_string - obtain human-readable error message
6
7 =head1 SYNOPSIS
8
9  #include <openssl/err.h>
10
11  char *ERR_error_string(unsigned long e, char *buf);
12  char *ERR_error_string_n(unsigned long e, char *buf, size_t len);
13
14  const char *ERR_lib_error_string(unsigned long e);
15  const char *ERR_func_error_string(unsigned long e);
16  const char *ERR_reason_error_string(unsigned long e);
17
18 =head1 DESCRIPTION
19
20 ERR_error_string() generates a human-readable string representing the
21 error code I<e>, and places it at I<buf>. I<buf> must be at least 120
22 bytes long. If I<buf> is B<NULL>, the error string is placed in a
23 static buffer.
24 ERR_error_string_n() is a variant of ERR_error_string() that writes
25 at most I<len> characters (including the terminating 0)
26 and truncates the string if necessary.
27 For ERR_error_string_n(), I<buf> may not be B<NULL>.
28
29 The string will have the following format:
30
31  error:[error code]:[library name]:[function name]:[reason string]
32
33 I<error code> is an 8 digit hexadecimal number, I<library name>,
34 I<function name> and I<reason string> are ASCII text.
35
36 ERR_lib_error_string(), ERR_func_error_string() and
37 ERR_reason_error_string() return the library name, function
38 name and reason string respectively.
39
40 The OpenSSL error strings should be loaded by calling
41 L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)> or, for SSL
42 applications, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>
43 first.
44 If there is no text string registered for the given error code,
45 the error string will contain the numeric code.
46
47 L<ERR_print_errors(3)|ERR_print_errors(3)> can be used to print
48 all error codes currently in the queue.
49
50 =head1 RETURN VALUES
51
52 ERR_error_string() returns a pointer to a static buffer containing the
53 string if I<buf> B<== NULL>, I<buf> otherwise.
54
55 ERR_lib_error_string(), ERR_func_error_string() and
56 ERR_reason_error_string() return the strings, and B<NULL> if
57 none is registered for the error code.
58
59 =head1 SEE ALSO
60
61 L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>,
62 L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>,
63 L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>
64 L<ERR_print_errors(3)|ERR_print_errors(3)>
65
66 =head1 HISTORY
67
68 ERR_error_string() is available in all versions of SSLeay and OpenSSL.
69 ERR_error_string_n() was added in OpenSSL 0.9.6.
70
71 =cut