obu-firmware builds against the vanetza-idf C-ITS library, which until now came from the colleague's microbu-esp32c5 tree beside the repository and was not tracked here, so a clone of this repository could not build the firmware it ships. The library alone is now part of obu-firmware, as obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from there by default; -DVANETZA_IDF_DIR still points the build elsewhere. The rest of the colleague's tree (their own VAM firmware, PKI tooling, station-link Python tools, the V2X2MAP bridge) stays out of this repository and gitignored; nothing is pushed to their repository. NOTES.md, docs/06, TODO.md and the pcap verifier's usage line point at the new location.
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#include "pdu_conversion.hpp"
|
|
#include "serialization_buffer.hpp"
|
|
#include <cassert>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace convertible
|
|
{
|
|
|
|
typedef std::unique_ptr<vanetza::geonet::Pdu> PduPtr;
|
|
|
|
void byte_buffer_impl<PduPtr>::convert(ByteBuffer& dest) const
|
|
{
|
|
assert(m_pdu);
|
|
dest.clear();
|
|
geonet::serialize_into_buffer(*m_pdu, dest);
|
|
}
|
|
|
|
std::size_t byte_buffer_impl<PduPtr>::size() const
|
|
{
|
|
assert(m_pdu);
|
|
return get_length(*m_pdu);
|
|
}
|
|
|
|
std::unique_ptr<byte_buffer> byte_buffer_impl<PduPtr>::duplicate() const
|
|
{
|
|
assert(m_pdu);
|
|
PduPtr duplicate { m_pdu->clone() };
|
|
std::unique_ptr<byte_buffer> result {
|
|
new byte_buffer_impl<PduPtr>(std::move(duplicate))
|
|
};
|
|
return result;
|
|
}
|
|
|
|
} // namespace convertible
|
|
|
|
namespace geonet
|
|
{
|
|
|
|
Pdu* pdu_cast(ByteBufferConvertible& convertible)
|
|
{
|
|
using convertible_pdu_t = convertible::byte_buffer_impl<std::unique_ptr<Pdu>>;
|
|
auto convertible_pdu = dynamic_cast<convertible_pdu_t*>(convertible.ptr());
|
|
return convertible_pdu ? convertible_pdu->m_pdu.get() : nullptr;
|
|
}
|
|
|
|
} // namespace geonet
|
|
} // namespace vanetza
|
|
|