diff options
author | Samuel O'Brien <sam.obrien@ni.com> | 2020-06-26 08:26:25 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-07-13 15:21:52 -0500 |
commit | b0cb065111dc3f40b89bdda76e9bd98f3e70b72e (patch) | |
tree | 4d08118999692767bc018d0a21758562abe1a300 /host | |
parent | 14d9452a15a6e65b01e19e0d5ce0c67afc060cc2 (diff) | |
download | uhd-b0cb065111dc3f40b89bdda76e9bd98f3e70b72e.tar.gz uhd-b0cb065111dc3f40b89bdda76e9bd98f3e70b72e.tar.bz2 uhd-b0cb065111dc3f40b89bdda76e9bd98f3e70b72e.zip |
rfnoc: Rename chdr_packet to chdr_packet_writer
It would be confusing to have two classes named chdr_packet. As it makes
more sense to name the new public chdr parser class chdr_packet, the
internal uhd::rfnoc::chdr::chdr_packet class is being renamed to
chdr_packet_writer to better represent its functionality.
Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
Diffstat (limited to 'host')
18 files changed, 76 insertions, 74 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp index 6f56fd956..61358fa2f 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp @@ -7,7 +7,7 @@ #pragma once #include <uhdlib/rfnoc/chdr_ctrl_xport.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/ctrlport_endpoint.hpp> #include <functional> #include <memory> diff --git a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp index bf3e03a6b..471a7bc11 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp @@ -6,7 +6,7 @@ #pragma once -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/chdr_types.hpp> #include <uhdlib/transport/io_service.hpp> #include <mutex> @@ -145,7 +145,7 @@ private: sep_id_t _my_epid; // Packet for received data - chdr::chdr_packet::uptr _recv_packet; + chdr::chdr_packet_writer::uptr _recv_packet; send_io_if::sptr _send_if; recv_io_if::sptr _ctrl_recv_if; diff --git a/host/lib/include/uhdlib/rfnoc/chdr_packet.hpp b/host/lib/include/uhdlib/rfnoc/chdr_packet_writer.hpp index d56f94d0f..6f1c264dd 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_packet.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_packet_writer.hpp @@ -21,15 +21,16 @@ namespace uhd { namespace rfnoc { namespace chdr { // container provides a high level API to read and write the header, metadata and payload // of the packet. The payload can be accessed as a generic buffer using this interface. // -class chdr_packet +class chdr_packet_writer { public: - //! A unique pointer to a const chdr_packet. Useful as a read-only interface. - typedef std::unique_ptr<const chdr_packet> cuptr; - //! A unique pointer to a non-const chdr_packet. Useful as a read-write interface. - typedef std::unique_ptr<chdr_packet> uptr; + //! A unique pointer to a const chdr_packet_writer. Useful as a read-only interface. + typedef std::unique_ptr<const chdr_packet_writer> cuptr; + //! A unique pointer to a non-const chdr_packet_writer. Useful as a read-write + //! interface. + typedef std::unique_ptr<chdr_packet_writer> uptr; - virtual ~chdr_packet() = 0; + virtual ~chdr_packet_writer() = 0; /*! Updates the underlying storage of this packet. This is a const method and is * only useful for read-only (RX) access. @@ -177,16 +178,20 @@ public: // and deserialized appropriately. // template <typename payload_t> -class chdr_packet_specific +class chdr_packet_writer_specific { public: - //! A unique pointer to a const chdr_packet. Useful as a read-only interface. - typedef std::unique_ptr<const chdr_packet_specific<payload_t>> cuptr; - //! A unique pointer to a non-const chdr_packet. Useful as a read-write interface. - typedef std::unique_ptr<chdr_packet_specific<payload_t>> uptr; - - chdr_packet_specific(chdr_packet::uptr chdr_pkt) : _chdr_pkt(std::move(chdr_pkt)) {} - ~chdr_packet_specific() = default; + //! A unique pointer to a const chdr_packet_writer. Useful as a read-only interface. + typedef std::unique_ptr<const chdr_packet_writer_specific<payload_t>> cuptr; + //! A unique pointer to a non-const chdr_packet_writer. Useful as a read-write + //! interface. + typedef std::unique_ptr<chdr_packet_writer_specific<payload_t>> uptr; + + chdr_packet_writer_specific(chdr_packet_writer::uptr chdr_pkt) + : _chdr_pkt(std::move(chdr_pkt)) + { + } + ~chdr_packet_writer_specific() = default; //! Updates the underlying storage of this packet. This is a const method and is // only useful for read-only access. @@ -233,7 +238,7 @@ public: } private: - chdr_packet::uptr _chdr_pkt; + chdr_packet_writer::uptr _chdr_pkt; }; //---------------------------------------------------- @@ -241,16 +246,16 @@ private: //---------------------------------------------------- //! CHDR control packet -typedef chdr_packet_specific<ctrl_payload> chdr_ctrl_packet; +typedef chdr_packet_writer_specific<ctrl_payload> chdr_ctrl_packet; //! CHDR stream status packet -typedef chdr_packet_specific<strs_payload> chdr_strs_packet; +typedef chdr_packet_writer_specific<strs_payload> chdr_strs_packet; //! CHDR stream command packet -typedef chdr_packet_specific<strc_payload> chdr_strc_packet; +typedef chdr_packet_writer_specific<strc_payload> chdr_strc_packet; //! CHDR management packet -typedef chdr_packet_specific<mgmt_payload> chdr_mgmt_packet; +typedef chdr_packet_writer_specific<mgmt_payload> chdr_mgmt_packet; //---------------------------------------------------- // CHDR packet factory @@ -275,7 +280,7 @@ public: chdr_packet_factory(chdr_packet_factory&& rhs) = default; //! Makes a generic CHDR packet and transfers ownership to the client - chdr_packet::uptr make_generic( + chdr_packet_writer::uptr make_generic( size_t mtu_bytes = std::numeric_limits<size_t>::max()) const; //! Makes a CHDR control packet and transfers ownership to the client diff --git a/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp index caa94bde3..d041f37c6 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp @@ -8,7 +8,7 @@ #include <uhd/config.hpp> #include <uhd/exception.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/chdr_types.hpp> #include <uhdlib/rfnoc/rfnoc_common.hpp> #include <uhdlib/rfnoc/rx_flow_ctrl_state.hpp> @@ -391,10 +391,10 @@ private: uint16_t _data_seq_num = 0; // Packet for received data - chdr::chdr_packet::uptr _recv_packet; + chdr::chdr_packet_writer::uptr _recv_packet; // Packet for received data used in callbacks - chdr::chdr_packet::uptr _recv_packet_cb; + chdr::chdr_packet_writer::uptr _recv_packet_cb; // Handles sending of strs flow control response packets detail::rx_flow_ctrl_sender _fc_sender; diff --git a/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp index 777066c0a..4394adaea 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp @@ -9,7 +9,7 @@ #include <uhd/exception.hpp> #include <uhd/types/metadata.hpp> #include <uhd/utils/log.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/chdr_types.hpp> #include <uhdlib/rfnoc/rfnoc_common.hpp> #include <uhdlib/rfnoc/tx_flow_ctrl_state.hpp> @@ -378,10 +378,10 @@ private: chdr::chdr_header _send_header; // Packet for send data - chdr::chdr_packet::uptr _send_packet; + chdr::chdr_packet_writer::uptr _send_packet; // Packet to receive strs messages - chdr::chdr_packet::uptr _recv_packet; + chdr::chdr_packet_writer::uptr _recv_packet; // Handles sending of strc flow control ack packets detail::tx_flow_ctrl_sender _fc_sender; diff --git a/host/lib/include/uhdlib/rfnoc/graph_stream_manager.hpp b/host/lib/include/uhdlib/rfnoc/graph_stream_manager.hpp index 3e1cdeee5..6cf224feb 100644 --- a/host/lib/include/uhdlib/rfnoc/graph_stream_manager.hpp +++ b/host/lib/include/uhdlib/rfnoc/graph_stream_manager.hpp @@ -8,7 +8,7 @@ #include <uhd/stream.hpp> #include <uhd/transport/adapter_id.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/chdr_rx_data_xport.hpp> #include <uhdlib/rfnoc/chdr_tx_data_xport.hpp> #include <uhdlib/rfnoc/client_zero.hpp> diff --git a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp index 806c9d1ea..223783170 100644 --- a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp +++ b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp @@ -7,7 +7,7 @@ #pragma once #include <uhdlib/rfnoc/chdr_ctrl_xport.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/chdr_types.hpp> #include <memory> #include <set> diff --git a/host/lib/rfnoc/CMakeLists.txt b/host/lib/rfnoc/CMakeLists.txt index 7c54a71f6..7d1334e04 100644 --- a/host/lib/rfnoc/CMakeLists.txt +++ b/host/lib/rfnoc/CMakeLists.txt @@ -16,7 +16,7 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/block_container.cpp ${CMAKE_CURRENT_SOURCE_DIR}/block_id.cpp ${CMAKE_CURRENT_SOURCE_DIR}/chdr_types.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/chdr_packet.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/chdr_packet_writer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/chdr_ctrl_xport.cpp ${CMAKE_CURRENT_SOURCE_DIR}/chdr_rx_data_xport.cpp ${CMAKE_CURRENT_SOURCE_DIR}/chdr_tx_data_xport.cpp diff --git a/host/lib/rfnoc/chdr_ctrl_endpoint.cpp b/host/lib/rfnoc/chdr_ctrl_endpoint.cpp index bba972186..3b2865c73 100644 --- a/host/lib/rfnoc/chdr_ctrl_endpoint.cpp +++ b/host/lib/rfnoc/chdr_ctrl_endpoint.cpp @@ -9,7 +9,7 @@ #include <uhd/utils/safe_call.hpp> #include <uhd/utils/thread.hpp> #include <uhdlib/rfnoc/chdr_ctrl_endpoint.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/chdr_types.hpp> #include <boost/format.hpp> #include <atomic> diff --git a/host/lib/rfnoc/chdr_packet.cpp b/host/lib/rfnoc/chdr_packet_writer.cpp index fc6c24838..c58ffd932 100644 --- a/host/lib/rfnoc/chdr_packet.cpp +++ b/host/lib/rfnoc/chdr_packet_writer.cpp @@ -4,7 +4,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later // -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <cassert> #include <functional> #include <memory> @@ -13,14 +13,14 @@ using namespace uhd; using namespace uhd::rfnoc; using namespace uhd::rfnoc::chdr; -chdr_packet::~chdr_packet() = default; +chdr_packet_writer::~chdr_packet_writer() = default; //------------------------------------------------------------ // chdr_packet //------------------------------------------------------------ // endianness is the link endianness, not the host endianness template <size_t chdr_w, endianness_t endianness> -class chdr_packet_impl : public chdr_packet +class chdr_packet_impl : public chdr_packet_writer { public: chdr_packet_impl() = delete; @@ -165,7 +165,7 @@ chdr_packet_factory::chdr_packet_factory(chdr_w_t chdr_w, endianness_t endiannes { } -chdr_packet::uptr chdr_packet_factory::make_generic(size_t mtu_bytes) const +chdr_packet_writer::uptr chdr_packet_factory::make_generic(size_t mtu_bytes) const { if (_endianness == ENDIANNESS_BIG) { switch (_chdr_w) { @@ -198,7 +198,7 @@ chdr_packet::uptr chdr_packet_factory::make_generic(size_t mtu_bytes) const assert(0); } } - return chdr_packet::uptr(); + return chdr_packet_writer::uptr(); } chdr_ctrl_packet::uptr chdr_packet_factory::make_ctrl(size_t mtu_bytes) const diff --git a/host/lib/rfnoc/chdr_rx_data_xport.cpp b/host/lib/rfnoc/chdr_rx_data_xport.cpp index df7162a73..ebfcda2b8 100644 --- a/host/lib/rfnoc/chdr_rx_data_xport.cpp +++ b/host/lib/rfnoc/chdr_rx_data_xport.cpp @@ -106,7 +106,7 @@ chdr_rx_data_xport::fc_params_t chdr_rx_data_xport::configure_sep(io_service::sp const sep_id_t local_epid = epids.second; rx_flow_ctrl_sender fc_sender(pkt_factory, epids); - chdr::chdr_packet::uptr pkt = pkt_factory.make_generic(); + chdr::chdr_packet_writer::uptr pkt = pkt_factory.make_generic(); fc_sender.set_capacity(recv_capacity); chdr::strc_payload strc; diff --git a/host/lib/rfnoc/chdr_tx_data_xport.cpp b/host/lib/rfnoc/chdr_tx_data_xport.cpp index 321b6ea85..a51835a07 100644 --- a/host/lib/rfnoc/chdr_tx_data_xport.cpp +++ b/host/lib/rfnoc/chdr_tx_data_xport.cpp @@ -96,8 +96,8 @@ static chdr_tx_data_xport::fc_params_t configure_flow_ctrl(io_service::sptr io_s const double fc_freq_ratio, const double fc_headroom_ratio) { - chdr::chdr_strc_packet::uptr strc_packet = pkt_factory.make_strc(); - chdr::chdr_packet::uptr recv_packet = pkt_factory.make_generic(); + chdr::chdr_strc_packet::uptr strc_packet = pkt_factory.make_strc(); + chdr::chdr_packet_writer::uptr recv_packet = pkt_factory.make_generic(); // No flow control at initialization, just release all send buffs auto send_cb = [](frame_buff::uptr buff, send_link_if* send_link) { diff --git a/host/lib/rfnoc/ctrlport_endpoint.cpp b/host/lib/rfnoc/ctrlport_endpoint.cpp index 5cff24443..5afb3919e 100644 --- a/host/lib/rfnoc/ctrlport_endpoint.cpp +++ b/host/lib/rfnoc/ctrlport_endpoint.cpp @@ -6,7 +6,7 @@ #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/chdr_types.hpp> #include <uhdlib/rfnoc/ctrlport_endpoint.hpp> #include <condition_variable> @@ -121,9 +121,8 @@ public: { // Compute transaction expiration time, use MASSIVE_TIMEOUT if a timed // command is in the queue - auto timeout_time = start_timeout( - check_timed_in_queue() ? MASSIVE_TIMEOUT : _policy.timeout - ); + auto timeout_time = + start_timeout(check_timed_in_queue() ? MASSIVE_TIMEOUT : _policy.timeout); // Send request auto request = @@ -174,9 +173,8 @@ public: // Compute transaction expiration time, use MASSIVE_TIMEOUT if a timed // command is in the queue - auto timeout_time = start_timeout( - check_timed_in_queue() ? MASSIVE_TIMEOUT : _policy.timeout - ); + auto timeout_time = + start_timeout(check_timed_in_queue() ? MASSIVE_TIMEOUT : _policy.timeout); // Send request auto request = send_request_packet(OP_POLL, @@ -192,12 +190,10 @@ public: virtual void sleep(uhd::time_spec_t duration, bool ack = false) { - // Compute transaction expiration time, use MASSIVE_TIMEOUT if a timed // command is in the queue - auto timeout_time = start_timeout( - check_timed_in_queue() ? MASSIVE_TIMEOUT : _policy.timeout - ); + auto timeout_time = + start_timeout(check_timed_in_queue() ? MASSIVE_TIMEOUT : _policy.timeout); // Send request auto request = send_request_packet(OP_SLEEP, @@ -421,7 +417,7 @@ private: // If we can fit the current request in the queue then we can proceed return (_buff_occupied + pyld_size) <= (_buff_capacity - - (ASYNC_MESSAGE_SIZE * _max_outstanding_async_msgs)); + - (ASYNC_MESSAGE_SIZE * _max_outstanding_async_msgs)); }; if (!buff_not_full()) { // If we're sending a timed command or if we have a timed command in the diff --git a/host/lib/rfnoc/mgmt_portal.cpp b/host/lib/rfnoc/mgmt_portal.cpp index 971c9837a..a54efaaf7 100644 --- a/host/lib/rfnoc/mgmt_portal.cpp +++ b/host/lib/rfnoc/mgmt_portal.cpp @@ -8,7 +8,7 @@ #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> #include <uhdlib/rfnoc/chdr_ctrl_xport.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/mgmt_portal.hpp> #include <unordered_set> #include <boost/format.hpp> diff --git a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_base.hpp b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_base.hpp index a9cb456e5..fd1ef8818 100644 --- a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_base.hpp +++ b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_base.hpp @@ -10,7 +10,7 @@ #include "mpmd_link_if_mgr.hpp" #include <uhd/types/device_addr.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/transport/links.hpp> #include <memory> diff --git a/host/lib/usrp/mpmd/mpmd_link_if_mgr.hpp b/host/lib/usrp/mpmd/mpmd_link_if_mgr.hpp index b8e7454cb..4bf893dd4 100644 --- a/host/lib/usrp/mpmd/mpmd_link_if_mgr.hpp +++ b/host/lib/usrp/mpmd/mpmd_link_if_mgr.hpp @@ -10,7 +10,7 @@ #include <uhd/types/device_addr.hpp> #include <uhd/types/dict.hpp> #include <uhd/types/direction.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/rfnoc_common.hpp> #include <uhdlib/transport/links.hpp> #include <map> diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt index 819eb2b46..78e4d3539 100644 --- a/host/tests/CMakeLists.txt +++ b/host/tests/CMakeLists.txt @@ -202,7 +202,7 @@ UHD_ADD_NONAPI_TEST( UHD_ADD_NONAPI_TEST( TARGET "streamer_benchmark.cpp" EXTRA_SOURCES - ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_packet.cpp + ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_packet_writer.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_types.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_ctrl_xport.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_rx_data_xport.cpp @@ -260,7 +260,7 @@ UHD_ADD_NONAPI_TEST( TARGET rfnoc_chdr_test.cpp EXTRA_SOURCES ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_types.cpp - ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_packet.cpp + ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_packet_writer.cpp INCLUDE_DIRS ${CMAKE_BINARY_DIR}/lib/rfnoc/ ${CMAKE_SOURCE_DIR}/lib/rfnoc/ diff --git a/host/tests/rfnoc_chdr_test.cpp b/host/tests/rfnoc_chdr_test.cpp index 27b883543..31640325c 100644 --- a/host/tests/rfnoc_chdr_test.cpp +++ b/host/tests/rfnoc_chdr_test.cpp @@ -6,7 +6,7 @@ #include <uhd/types/endianness.hpp> #include <uhd/utils/byteswap.hpp> -#include <uhdlib/rfnoc/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet_writer.hpp> #include <uhdlib/rfnoc/chdr_types.hpp> #include <boost/format.hpp> #include <boost/test/unit_test.hpp> @@ -237,27 +237,28 @@ BOOST_AUTO_TEST_CASE(chdr_strc_packet_no_swap_64) BOOST_AUTO_TEST_CASE(chdr_generic_packet_calculate_pyld_offset_64) { // Check calculation without timestamp - auto test_pyld_offset = - [](chdr_packet::uptr& pkt, const packet_type_t pkt_type, const size_t num_mdata) { - uint64_t buff[MAX_BUF_SIZE_WORDS]; - chdr_header header; - header.set_pkt_type(pkt_type); - header.set_num_mdata(num_mdata); + auto test_pyld_offset = [](chdr_packet_writer::uptr& pkt, + const packet_type_t pkt_type, + const size_t num_mdata) { + uint64_t buff[MAX_BUF_SIZE_WORDS]; + chdr_header header; + header.set_pkt_type(pkt_type); + header.set_num_mdata(num_mdata); - pkt->refresh(reinterpret_cast<void*>(buff), header, 0); + pkt->refresh(reinterpret_cast<void*>(buff), header, 0); - const size_t pyld_offset = pkt->calculate_payload_offset(pkt_type, num_mdata); + const size_t pyld_offset = pkt->calculate_payload_offset(pkt_type, num_mdata); - void* pyld_ptr = pkt->get_payload_ptr(); + void* pyld_ptr = pkt->get_payload_ptr(); - const size_t non_pyld_bytes = static_cast<size_t>( - reinterpret_cast<uint8_t*>(pyld_ptr) - reinterpret_cast<uint8_t*>(buff)); + const size_t non_pyld_bytes = static_cast<size_t>( + reinterpret_cast<uint8_t*>(pyld_ptr) - reinterpret_cast<uint8_t*>(buff)); - BOOST_CHECK(pyld_offset == non_pyld_bytes); - }; + BOOST_CHECK(pyld_offset == non_pyld_bytes); + }; { - chdr_packet::uptr pkt = chdr64_be_factory.make_generic(); + chdr_packet_writer::uptr pkt = chdr64_be_factory.make_generic(); test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 0); test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 1); test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 2); @@ -266,7 +267,7 @@ BOOST_AUTO_TEST_CASE(chdr_generic_packet_calculate_pyld_offset_64) test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 2); } { - chdr_packet::uptr pkt = chdr256_be_factory.make_generic(); + chdr_packet_writer::uptr pkt = chdr256_be_factory.make_generic(); test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 0); test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 1); test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 2); |