From 27344af7f097ec7b3128f30cd595f5a640891ce6 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Wed, 4 Nov 2020 12:53:12 +0700 Subject: [PATCH] srsue/rrctl: make codec::enc_hdr() return proto::msg_hdr --- srsue/hdr/stack/upper/rrctl.h | 8 ++++---- srsue/src/stack/upper/rrctl.cc | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/srsue/hdr/stack/upper/rrctl.h b/srsue/hdr/stack/upper/rrctl.h index ca791d7fd..48cde2dfb 100644 --- a/srsue/hdr/stack/upper/rrctl.h +++ b/srsue/hdr/stack/upper/rrctl.h @@ -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, diff --git a/srsue/src/stack/upper/rrctl.cc b/srsue/src/stack/upper/rrctl.cc index 84570a5e1..280bf44cc 100644 --- a/srsue/src/stack/upper/rrctl.cc +++ b/srsue/src/stack/upper/rrctl.cc @@ -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 (&buf.msg[0]); } const uint8_t* dec_hdr(const srslte::byte_buffer_t& buf,