aboutsummaryrefslogtreecommitdiff
path: root/src/msg.cpp
blob: d525cd58f3515dd0ab38bfd199235da64d6c1c46 (plain) (blame)
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
#include "salticidae/config.h"
#ifdef SALTICIDAE_CBINDINGS
#include "salticidae/msg.h"

extern "C" {

msg_t *msg_new_moved_from_bytearray(_opcode_t opcode, bytearray_t *_moved_payload) {
    auto res = new msg_t(opcode, std::move(*_moved_payload));
    bytearray_free(_moved_payload);
    return res;
}

void msg_free(msg_t *msg) { delete msg; }

datastream_t *msg_consume_payload(const msg_t *msg) {
    return new datastream_t(msg->get_payload());
}

_opcode_t msg_get_opcode(const msg_t *msg) {
    return msg->get_opcode();
}

}

#endif