| 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 | |
| 13 | This software is provided 'as-is', without any express or implied |
| 14 | warranty. In no event will the authors be held liable for any damages |
| 15 | arising from the use of this software. |
| 16 | |
| 17 | Permission is granted to anyone to use this software for any purpose, |
| 18 | including commercial applications, and to alter it and redistribute it |
| 19 | freely, subject to the following restrictions: |
| 20 | |
| 21 | 1. The origin of this software must not be misrepresented; you must not |
| 22 | claim that you wrote the original software. If you use this software |
| 23 | in a product, an acknowledgment in the product documentation would be |
| 24 | appreciated but is not required. |
| 25 | 2. Altered source versions must be plainly marked as such, and must not be |
| 26 | misrepresented as being the original software. |
| 27 | 3. This notice may not be removed or altered from any source distribution. |
| 28 | |
| 29 | Jean-loup Gailly Mark Adler |
| 30 | jloup@gzip.org madler@alumni.caltech.edu |
| 31 | |
| 32 | The data format used by the zlib library is described by RFCs (Request for |
| 33 | Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 |
| 34 | (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). |
| 35 | */ |
| 36 | |
| 37 | #ifndef BOOST_BEAST_ZLIB_ERROR_HPP |
| 38 | #define BOOST_BEAST_ZLIB_ERROR_HPP |
| 39 | |
| 40 | #include <boost/beast/core/detail/config.hpp> |
| 41 | #include <boost/beast/core/error.hpp> |
| 42 | |
| 43 | namespace boost { |
| 44 | namespace beast { |
| 45 | namespace zlib { |
| 46 | |
| 47 | /** Error codes returned by the deflate codecs. |
| 48 | */ |
| 49 | enum class error |
| 50 | { |
| 51 | /** Additional buffers are required. |
| 52 | |
| 53 | This error indicates that one or both of the buffers |
| 54 | provided buffers do not have sufficient available bytes |
| 55 | to make forward progress. |
| 56 | |
| 57 | This does not always indicate a failure condition. |
| 58 | |
| 59 | @note This is the same as `Z_BUF_ERROR` returned by ZLib. |
| 60 | */ |
| 61 | need_buffers = 1, |
| 62 | |
| 63 | /** End of stream reached. |
| 64 | |
| 65 | @note This is the same as `Z_STREAM_END` returned by ZLib. |
| 66 | */ |
| 67 | end_of_stream, |
| 68 | |
| 69 | /** Preset dictionary required |
| 70 | |
| 71 | This error indicates that a preset dictionary was not provided and is now |
| 72 | needed at this point. |
| 73 | |
| 74 | This does not always indicate a failure condition. |
| 75 | |
| 76 | @note This is the same as `Z_NEED_DICT` returned by ZLib. |
| 77 | */ |
| 78 | need_dict, |
| 79 | |
| 80 | /** Invalid stream or parameters. |
| 81 | |
| 82 | This error is returned when invalid parameters are passed, |
| 83 | or the operation being performed is not consistent with the |
| 84 | state of the stream. For example, attempting to write data |
| 85 | when the end of stream is already reached. |
| 86 | |
| 87 | @note This is the same as `Z_STREAM_ERROR` returned by ZLib. |
| 88 | */ |
| 89 | stream_error, |
| 90 | |
| 91 | // |
| 92 | // Errors generated by basic_deflate_stream |
| 93 | // |
| 94 | |
| 95 | // |
| 96 | // Errors generated by basic_inflate_stream |
| 97 | // |
| 98 | |
| 99 | /// Invalid block type |
| 100 | invalid_block_type, |
| 101 | |
| 102 | /// Invalid stored block length |
| 103 | invalid_stored_length, |
| 104 | |
| 105 | /// Too many length or distance symbols |
| 106 | too_many_symbols, |
| 107 | |
| 108 | /// Invalid code lengths |
| 109 | invalid_code_lengths, |
| 110 | |
| 111 | /// Invalid bit length repeat |
| 112 | invalid_bit_length_repeat, |
| 113 | |
| 114 | /// Missing end of block code |
| 115 | missing_eob, |
| 116 | |
| 117 | /// Invalid literal/length code |
| 118 | invalid_literal_length, |
| 119 | |
| 120 | /// Invalid distance code |
| 121 | invalid_distance_code, |
| 122 | |
| 123 | /// Invalid distance too far back |
| 124 | invalid_distance, |
| 125 | |
| 126 | // |
| 127 | // Errors generated by inflate_table |
| 128 | // |
| 129 | |
| 130 | /// Over-subscribed length code |
| 131 | over_subscribed_length, |
| 132 | |
| 133 | /// Incomplete length set |
| 134 | incomplete_length_set, |
| 135 | |
| 136 | |
| 137 | |
| 138 | /// general error |
| 139 | general |
| 140 | }; |
| 141 | |
| 142 | } // zlib |
| 143 | } // beast |
| 144 | } // boost |
| 145 | |
| 146 | #include <boost/beast/zlib/impl/error.hpp> |
| 147 | #ifdef BOOST_BEAST_HEADER_ONLY |
| 148 | #include <boost/beast/zlib/impl/error.ipp> |
| 149 | #endif |
| 150 | |
| 151 | #endif |
| 152 | |
| 153 | |