libzmq/src/i_decoder.hpp
Luca Boccassi da31917f4f Relicense from LGPL3 + exceptions to Mozilla Public License version 2.0
Relicense permission collected from all relevant authors as tallied at:
https://github.com/rlenferink/libzmq-relicense/blob/master/checklist.md
The relicense grants are collected under RELICENSE/ and will be moved
to the above repository in a later commit.

Fixes https://github.com/zeromq/libzmq/issues/2376
2023-06-05 20:31:47 +01:00

35 lines
785 B
C++

/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_I_DECODER_HPP_INCLUDED__
#define __ZMQ_I_DECODER_HPP_INCLUDED__
#include "macros.hpp"
#include "stdint.hpp"
namespace zmq
{
class msg_t;
// Interface to be implemented by message decoder.
class i_decoder
{
public:
virtual ~i_decoder () ZMQ_DEFAULT;
virtual void get_buffer (unsigned char **data_, size_t *size_) = 0;
virtual void resize_buffer (size_t) = 0;
// Decodes data pointed to by data_.
// When a message is decoded, 1 is returned.
// When the decoder needs more data, 0 is returned.
// On error, -1 is returned and errno is set accordingly.
virtual int
decode (const unsigned char *data_, size_t size_, size_t &processed_) = 0;
virtual msg_t *msg () = 0;
};
}
#endif