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