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,72 @@
|
||||
#ifndef GBC_MEMORY_HPP_032N8PRJ
|
||||
#define GBC_MEMORY_HPP_032N8PRJ
|
||||
|
||||
#include <vanetza/geonet/cbf_packet_identifier.hpp>
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/sequenced_index.hpp>
|
||||
|
||||
namespace vanetza
|
||||
{
|
||||
namespace geonet
|
||||
{
|
||||
|
||||
/**
|
||||
* GbcMemory remembers previously seens GBC packets.
|
||||
*
|
||||
* GBC packets are identified by their (GN addr, sequence number) tuple.
|
||||
* The size of GbcMemory is bounded, i.e. it will forget old packets in favour of recent ones.
|
||||
*/
|
||||
class GbcMemory
|
||||
{
|
||||
public:
|
||||
using PacketIdentifier = CbfPacketIdentifier;
|
||||
|
||||
/**
|
||||
* Forget a packet if memory exceeds upper limit of stored identifiers
|
||||
* \param num upper limit of remembered packets
|
||||
*/
|
||||
void capacity(std::size_t num);
|
||||
|
||||
/**
|
||||
* Number of currently known packets
|
||||
* \return number of packets
|
||||
*/
|
||||
std::size_t size() const;
|
||||
|
||||
/**
|
||||
* Remember a particular packet
|
||||
* \param id packet identifier
|
||||
* \return true if packet is already known
|
||||
*/
|
||||
bool remember(const PacketIdentifier& id);
|
||||
|
||||
/**
|
||||
* Check if a particular packet is known
|
||||
* \param id packet identifier
|
||||
* \return true if packet is known
|
||||
*/
|
||||
bool knows(const PacketIdentifier& id) const;
|
||||
|
||||
private:
|
||||
std::size_t m_capacity = 1;
|
||||
|
||||
struct by_packet {};
|
||||
using packet_index = boost::multi_index::hashed_unique<
|
||||
boost::multi_index::tag<by_packet>,
|
||||
boost::multi_index::identity<PacketIdentifier>,
|
||||
std::hash<PacketIdentifier>
|
||||
>;
|
||||
struct by_queue {};
|
||||
using queue_index = boost::multi_index::sequenced<boost::multi_index::tag<by_queue>>;
|
||||
|
||||
using container_type = boost::multi_index_container<PacketIdentifier,
|
||||
boost::multi_index::indexed_by<queue_index, packet_index>>;
|
||||
container_type m_identifiers;
|
||||
};
|
||||
|
||||
} // namespace geonet
|
||||
} // namespace vanetza
|
||||
|
||||
#endif /* GBC_MEMORY_HPP_032N8PRJ */
|
||||
|
||||
Reference in New Issue
Block a user