Keep the colleague's microbu-esp32c5 tree in this repository
obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
#ifndef PACKET_VARIANT_HPP_LILZ0UWN
|
||||
#define PACKET_VARIANT_HPP_LILZ0UWN
|
||||
|
||||
#include <vanetza/common/byte_view.hpp>
|
||||
#include <vanetza/common/serialization.hpp>
|
||||
#include <vanetza/net/chunk_packet.hpp>
|
||||
#include <vanetza/net/cohesive_packet.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
namespace vanetza
|
||||
{
|
||||
|
||||
using PacketVariant = boost::variant<ChunkPacket, CohesivePacket>;
|
||||
|
||||
inline std::size_t
|
||||
size(const CohesivePacket& packet, OsiLayer from, OsiLayer to)
|
||||
{
|
||||
return packet.size(from, to);
|
||||
}
|
||||
|
||||
inline std::size_t
|
||||
size(const CohesivePacket& packet, OsiLayer layer)
|
||||
{
|
||||
return packet.size(layer);
|
||||
}
|
||||
|
||||
inline std::size_t
|
||||
size(const ChunkPacket& packet, OsiLayer from, OsiLayer to)
|
||||
{
|
||||
return packet.size(from, to);
|
||||
}
|
||||
|
||||
inline std::size_t
|
||||
size(const ChunkPacket& packet, OsiLayer layer)
|
||||
{
|
||||
return packet[layer].size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a view of a packet's bytes assigned to a certain layer
|
||||
* \param packet
|
||||
* \param layer
|
||||
* \return a byte view, possibly empty
|
||||
*/
|
||||
byte_view_range create_byte_view(const ChunkPacket&, OsiLayer);
|
||||
byte_view_range create_byte_view(const CohesivePacket&, OsiLayer);
|
||||
|
||||
/**
|
||||
* Create a byte view for a sub-range of layers
|
||||
* \param packet
|
||||
* \param from first byte will be from this layer
|
||||
* \param to last byte will be from this layer
|
||||
* \return a byte view
|
||||
*/
|
||||
byte_view_range create_byte_view(const ChunkPacket& packet, OsiLayer from, OsiLayer to);
|
||||
byte_view_range create_byte_view(const CohesivePacket& packet, OsiLayer from, OsiLayer to);
|
||||
|
||||
/**
|
||||
* Serialize a whole packet from physical to application layer
|
||||
* \param archive destination archive
|
||||
* \param packet source packet
|
||||
*/
|
||||
void serialize(OutputArchive&, const ChunkPacket&);
|
||||
void serialize(OutputArchive&, const CohesivePacket&);
|
||||
|
||||
} // namespace vanetza
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// PacketVariant is only a type alias, so we need this quirk for proper name lookup
|
||||
std::size_t size(const vanetza::PacketVariant&, vanetza::OsiLayer from, vanetza::OsiLayer to);
|
||||
std::size_t size(const vanetza::PacketVariant&, vanetza::OsiLayer);
|
||||
std::size_t size(const vanetza::PacketVariant&);
|
||||
vanetza::byte_view_range create_byte_view(const vanetza::PacketVariant&, vanetza::OsiLayer);
|
||||
vanetza::byte_view_range create_byte_view(const vanetza::PacketVariant&, vanetza::OsiLayer from, vanetza::OsiLayer to);
|
||||
void serialize(vanetza::OutputArchive&, const vanetza::PacketVariant&);
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif /* PACKET_VARIANT_HPP_LILZ0UWN */
|
||||
|
||||
Reference in New Issue
Block a user