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.
93 lines
2.5 KiB
C++
93 lines
2.5 KiB
C++
#ifndef CHUNK_PACKET_HPP_AT4GYSLD
|
|
#define CHUNK_PACKET_HPP_AT4GYSLD
|
|
|
|
#include <vanetza/common/byte_buffer_convertible.hpp>
|
|
#include <vanetza/net/osi_layer.hpp>
|
|
#include <cstddef>
|
|
#include <map>
|
|
|
|
namespace vanetza
|
|
{
|
|
|
|
/**
|
|
* \brief ChunckPacket is a packet consisting of several memory chunks
|
|
*
|
|
* ChunkPacket is the preferred packet type when it is getting assembled step by step.
|
|
* Each layer can easily add further bytes without caring about other layers at all.
|
|
*/
|
|
class ChunkPacket
|
|
{
|
|
public:
|
|
ChunkPacket();
|
|
|
|
// copy semantics
|
|
ChunkPacket(const ChunkPacket&);
|
|
ChunkPacket& operator=(const ChunkPacket&);
|
|
|
|
// move semantics
|
|
ChunkPacket(ChunkPacket&&) = default;
|
|
ChunkPacket& operator=(ChunkPacket&&) = default;
|
|
|
|
/**
|
|
* Access ByteBufferConvertible of specific layer
|
|
* \param layer ol Access this layer's data
|
|
* \return ByteBufferConvertible, might be empty
|
|
*/
|
|
ByteBufferConvertible& layer(OsiLayer ol);
|
|
/** \copydoc ChunkPacket::layer */
|
|
const ByteBufferConvertible& layer(OsiLayer ol) const;
|
|
|
|
/** \copydoc ChunkPacket::layer */
|
|
inline ByteBufferConvertible& operator[](OsiLayer ol)
|
|
{
|
|
return layer(ol);
|
|
}
|
|
|
|
/** \copydoc ChunkPacket::layer */
|
|
inline const ByteBufferConvertible& operator[](OsiLayer ol) const
|
|
{
|
|
return layer(ol);
|
|
}
|
|
|
|
/**
|
|
* Get size of whole payload
|
|
* \return payload size in bytes
|
|
*/
|
|
std::size_t size() const;
|
|
|
|
/**
|
|
* Get size of payload from specified layer range
|
|
* \param from start counting including this layer
|
|
* \param to stop counting including this layer
|
|
* \return payload size in bytes
|
|
*/
|
|
std::size_t size(OsiLayer from, OsiLayer to) const;
|
|
|
|
/**
|
|
* Extract a range of layers from this packet to a new one.
|
|
* The respective layers of this ChunkPacket are empty afterwards.
|
|
* \param from start at this layer (inclusive)
|
|
* \param to stop at this layer (inclusive)
|
|
* \return new packet containing layers of specified range
|
|
*/
|
|
ChunkPacket extract(OsiLayer from, OsiLayer to);
|
|
|
|
/**
|
|
* Merge layers from another packet
|
|
* \param packet source packet (layers will be moved from there)
|
|
* \param from start at this layer (inclusive)
|
|
* \param to stop at this layer (inclusive)
|
|
* \return reference to this packet
|
|
*/
|
|
ChunkPacket& merge(ChunkPacket& packet, OsiLayer from, OsiLayer to);
|
|
|
|
private:
|
|
typedef std::map<OsiLayer, ByteBufferConvertible> map_type;
|
|
map_type m_layers;
|
|
};
|
|
|
|
} // namespace vanetza
|
|
|
|
#endif /* CHUNK_PACKET_HPP_AT4GYSLD */
|
|
|