2023-06-05 00:16:05 +01:00
|
|
|
/* SPDX-License-Identifier: MPL-2.0 */
|
2019-07-14 13:45:07 +03:00
|
|
|
|
|
|
|
#ifndef __ZMQ_WS_ENCODER_HPP_INCLUDED__
|
|
|
|
#define __ZMQ_WS_ENCODER_HPP_INCLUDED__
|
|
|
|
|
|
|
|
#include "encoder.hpp"
|
|
|
|
|
|
|
|
namespace zmq
|
|
|
|
{
|
|
|
|
// Encoder for web socket framing protocol. Converts messages into data stream.
|
|
|
|
|
2019-12-24 10:39:26 +01:00
|
|
|
class ws_encoder_t ZMQ_FINAL : public encoder_base_t<ws_encoder_t>
|
2019-07-14 13:45:07 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ws_encoder_t (size_t bufsize_, bool must_mask_);
|
2020-02-04 11:57:58 +01:00
|
|
|
~ws_encoder_t ();
|
2019-07-14 13:45:07 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
void size_ready ();
|
|
|
|
void message_ready ();
|
|
|
|
|
|
|
|
unsigned char _tmp_buf[16];
|
|
|
|
bool _must_mask;
|
|
|
|
unsigned char _mask[4];
|
|
|
|
msg_t _masked_msg;
|
2020-02-06 08:50:01 +02:00
|
|
|
bool _is_binary;
|
2019-07-14 13:45:07 +03:00
|
|
|
|
2019-12-08 19:22:04 +01:00
|
|
|
ZMQ_NON_COPYABLE_NOR_MOVABLE (ws_encoder_t)
|
2019-07-14 13:45:07 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|