error.hpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/beast
  8. //
  9. // This is a derivative work based on Zlib, copyright below:
  10. /*
  11. Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
  12. This software is provided 'as-is', without any express or implied
  13. warranty. In no event will the authors be held liable for any damages
  14. arising from the use of this software.
  15. Permission is granted to anyone to use this software for any purpose,
  16. including commercial applications, and to alter it and redistribute it
  17. freely, subject to the following restrictions:
  18. 1. The origin of this software must not be misrepresented; you must not
  19. claim that you wrote the original software. If you use this software
  20. in a product, an acknowledgment in the product documentation would be
  21. appreciated but is not required.
  22. 2. Altered source versions must be plainly marked as such, and must not be
  23. misrepresented as being the original software.
  24. 3. This notice may not be removed or altered from any source distribution.
  25. Jean-loup Gailly Mark Adler
  26. jloup@gzip.org madler@alumni.caltech.edu
  27. The data format used by the zlib library is described by RFCs (Request for
  28. Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
  29. (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
  30. */
  31. #ifndef BOOST_BEAST_ZLIB_ERROR_HPP
  32. #define BOOST_BEAST_ZLIB_ERROR_HPP
  33. #include <boost/beast/core/detail/config.hpp>
  34. #include <boost/beast/core/error.hpp>
  35. namespace boost {
  36. namespace beast {
  37. namespace zlib {
  38. /** Error codes returned by the deflate codecs.
  39. */
  40. enum class error
  41. {
  42. /** Additional buffers are required.
  43. This error indicates that one or both of the buffers
  44. provided buffers do not have sufficient available bytes
  45. to make forward progress.
  46. This does not always indicate a failure condition.
  47. @note This is the same as `Z_BUF_ERROR` returned by ZLib.
  48. */
  49. need_buffers = 1,
  50. /** End of stream reached.
  51. @note This is the same as `Z_STREAM_END` returned by ZLib.
  52. */
  53. end_of_stream,
  54. /** Preset dictionary required
  55. This error indicates that a preset dictionary was not provided and is now
  56. needed at this point.
  57. This does not always indicate a failure condition.
  58. @note This is the same as `Z_NEED_DICT` returned by ZLib.
  59. */
  60. need_dict,
  61. /** Invalid stream or parameters.
  62. This error is returned when invalid parameters are passed,
  63. or the operation being performed is not consistent with the
  64. state of the stream. For example, attempting to write data
  65. when the end of stream is already reached.
  66. @note This is the same as `Z_STREAM_ERROR` returned by ZLib.
  67. */
  68. stream_error,
  69. //
  70. // Errors generated by basic_deflate_stream
  71. //
  72. //
  73. // Errors generated by basic_inflate_stream
  74. //
  75. /// Invalid block type
  76. invalid_block_type,
  77. /// Invalid stored block length
  78. invalid_stored_length,
  79. /// Too many length or distance symbols
  80. too_many_symbols,
  81. /// Invalid code lengths
  82. invalid_code_lengths,
  83. /// Invalid bit length repeat
  84. invalid_bit_length_repeat,
  85. /// Missing end of block code
  86. missing_eob,
  87. /// Invalid literal/length code
  88. invalid_literal_length,
  89. /// Invalid distance code
  90. invalid_distance_code,
  91. /// Invalid distance too far back
  92. invalid_distance,
  93. //
  94. // Errors generated by inflate_table
  95. //
  96. /// Over-subscribed length code
  97. over_subscribed_length,
  98. /// Incomplete length set
  99. incomplete_length_set,
  100. /// general error
  101. general
  102. };
  103. } // zlib
  104. } // beast
  105. } // boost
  106. #include <boost/beast/zlib/impl/error.hpp>
  107. #ifdef BOOST_BEAST_HEADER_ONLY
  108. #include <boost/beast/zlib/impl/error.ipp>
  109. #endif
  110. #endif