srsue/rrctl: make codec::enc_hdr() return proto::msg_hdr

This commit is contained in:
Vadim Yanitskiy 2020-11-04 12:53:12 +07:00
parent 796a6df0df
commit 27344af7f0
2 changed files with 10 additions and 8 deletions

View File

@ -228,10 +228,10 @@ public:
explicit error(const std::string& msg) : std::runtime_error(msg) {};
};
void enc_hdr(srslte::byte_buffer_t& buf,
proto::msg_type type,
proto::msg_disc disc,
uint16_t len = 0);
struct proto::msg_hdr* enc_hdr(srslte::byte_buffer_t& buf,
proto::msg_type type,
proto::msg_disc disc,
uint16_t len = 0);
const uint8_t* dec_hdr(const srslte::byte_buffer_t& buf,
proto::msg_type& type,
proto::msg_disc& disc,

View File

@ -102,10 +102,10 @@ std::string msg_hdr_desc(proto::msg_type type, proto::msg_disc disc, uint16_t le
namespace codec {
void enc_hdr(srslte::byte_buffer_t& buf,
proto::msg_type type,
proto::msg_disc disc,
uint16_t len)
struct proto::msg_hdr* enc_hdr(srslte::byte_buffer_t& buf,
proto::msg_type type,
proto::msg_disc disc,
uint16_t len)
{
struct proto::msg_hdr hdr = {
#if defined(__LITTLE_ENDIAN_BITFIELD)
@ -121,6 +121,8 @@ void enc_hdr(srslte::byte_buffer_t& buf,
};
buf.append_bytes((const uint8_t*) &hdr, sizeof(hdr));
return reinterpret_cast<struct proto::msg_hdr*> (&buf.msg[0]);
}
const uint8_t* dec_hdr(const srslte::byte_buffer_t& buf,