/src/libzmq/src/raw_decoder.hpp
Line | Count | Source |
1 | | /* SPDX-License-Identifier: MPL-2.0 */ |
2 | | |
3 | | #ifndef __ZMQ_RAW_DECODER_HPP_INCLUDED__ |
4 | | #define __ZMQ_RAW_DECODER_HPP_INCLUDED__ |
5 | | |
6 | | #include "msg.hpp" |
7 | | #include "i_decoder.hpp" |
8 | | #include "stdint.hpp" |
9 | | #include "decoder_allocators.hpp" |
10 | | |
11 | | namespace zmq |
12 | | { |
13 | | // Decoder for 0MQ v1 framing protocol. Converts data stream into messages. |
14 | | |
15 | | class raw_decoder_t ZMQ_FINAL : public i_decoder |
16 | | { |
17 | | public: |
18 | | raw_decoder_t (size_t bufsize_); |
19 | | ~raw_decoder_t (); |
20 | | |
21 | | // i_decoder interface. |
22 | | |
23 | | void get_buffer (unsigned char **data_, size_t *size_); |
24 | | |
25 | | int decode (const unsigned char *data_, size_t size_, size_t &bytes_used_); |
26 | | |
27 | 0 | msg_t *msg () { return &_in_progress; } |
28 | | |
29 | 0 | void resize_buffer (size_t) {} |
30 | | |
31 | | private: |
32 | | msg_t _in_progress; |
33 | | |
34 | | shared_message_memory_allocator _allocator; |
35 | | |
36 | | ZMQ_NON_COPYABLE_NOR_MOVABLE (raw_decoder_t) |
37 | | }; |
38 | | } |
39 | | |
40 | | #endif |