ERR_put_error.pod 2.5 KB

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