]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // |
92f5a8d4 | 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) |
7c673cae FG |
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 | // | |
b32b8144 FG |
7 | // Official repository: https://github.com/boostorg/beast |
8 | // | |
7c673cae | 9 | |
b32b8144 FG |
10 | #ifndef BOOST_BEAST_WEBSOCKET_DETAIL_MASK_HPP |
11 | #define BOOST_BEAST_WEBSOCKET_DETAIL_MASK_HPP | |
7c673cae | 12 | |
b32b8144 | 13 | #include <boost/beast/core/detail/config.hpp> |
92f5a8d4 | 14 | #include <boost/beast/core/buffers_range.hpp> |
7c673cae FG |
15 | #include <boost/asio/buffer.hpp> |
16 | #include <array> | |
17 | #include <climits> | |
18 | #include <cstdint> | |
19 | #include <random> | |
20 | #include <type_traits> | |
21 | ||
b32b8144 | 22 | namespace boost { |
7c673cae FG |
23 | namespace beast { |
24 | namespace websocket { | |
25 | namespace detail { | |
26 | ||
11fdf7f2 | 27 | using prepared_key = std::array<unsigned char, 4>; |
7c673cae | 28 | |
92f5a8d4 | 29 | BOOST_BEAST_DECL |
7c673cae | 30 | void |
92f5a8d4 | 31 | prepare_key(prepared_key& prepared, std::uint32_t key); |
7c673cae | 32 | |
11fdf7f2 | 33 | // Apply mask in place |
7c673cae | 34 | // |
92f5a8d4 | 35 | BOOST_BEAST_DECL |
7c673cae | 36 | void |
92f5a8d4 | 37 | mask_inplace(net::mutable_buffer const& b, prepared_key& key); |
7c673cae FG |
38 | |
39 | // Apply mask in place | |
40 | // | |
92f5a8d4 | 41 | template<class MutableBufferSequence> |
7c673cae | 42 | void |
92f5a8d4 TL |
43 | mask_inplace( |
44 | MutableBufferSequence const& buffers, | |
45 | prepared_key& key) | |
7c673cae | 46 | { |
92f5a8d4 TL |
47 | for(net::mutable_buffer b : |
48 | beast::buffers_range_ref(buffers)) | |
49 | detail::mask_inplace(b, key); | |
7c673cae FG |
50 | } |
51 | ||
52 | } // detail | |
53 | } // websocket | |
54 | } // beast | |
b32b8144 | 55 | } // boost |
7c673cae | 56 | |
92f5a8d4 TL |
57 | |
58 | #if BOOST_BEAST_HEADER_ONLY | |
59 | #include <boost/beast/websocket/detail/mask.ipp> | |
60 | #endif | |
61 | ||
62 | ||
7c673cae | 63 | #endif |