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).
74 lines
1.6 KiB
C++
74 lines
1.6 KiB
C++
#ifndef INT_X_HPP_RW3TJBBI
|
|
#define INT_X_HPP_RW3TJBBI
|
|
|
|
#include <vanetza/common/byte_buffer.hpp>
|
|
#include <vanetza/security/v2/serialization.hpp>
|
|
#include <boost/operators.hpp>
|
|
#include <boost/optional.hpp>
|
|
#include <cstdint>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace security
|
|
{
|
|
namespace v2
|
|
{
|
|
|
|
/// IntX specified in TS 103 097 v1.2.1, section 4.2.1
|
|
class IntX :
|
|
public boost::equality_comparable<IntX>,
|
|
public boost::equality_comparable<IntX, std::uintmax_t>
|
|
{
|
|
public:
|
|
using integer_type = std::uintmax_t;
|
|
constexpr IntX() : m_value(0) {}
|
|
constexpr explicit IntX(integer_type x) : m_value(x) {}
|
|
|
|
void set(integer_type x);
|
|
constexpr integer_type get() const { return m_value; }
|
|
|
|
constexpr bool operator==(const IntX& other) const
|
|
{
|
|
return m_value == other.m_value;
|
|
}
|
|
|
|
constexpr bool operator==(integer_type other) const
|
|
{
|
|
return m_value == other;
|
|
}
|
|
|
|
ByteBuffer encode() const;
|
|
static boost::optional<IntX> decode(const ByteBuffer&);
|
|
|
|
private:
|
|
integer_type m_value;
|
|
};
|
|
|
|
/**
|
|
* \brief Serializes an IntX into a binary archive
|
|
* \param ar to serialize in
|
|
* \param intx to serialize
|
|
*/
|
|
void serialize(OutputArchive&, const IntX&);
|
|
|
|
/**
|
|
* \brief Deserializes an IntX from a binary archive
|
|
* \param ar with a serialized IntX at the beginning
|
|
* \param intx to deserialize
|
|
* \return size of the deserialized IntX
|
|
*/
|
|
size_t deserialize(InputArchive&, IntX&);
|
|
|
|
/**
|
|
* \brief Calculates size of an IntX
|
|
* \param intx
|
|
* \return number of octets needed to serialize the IntX
|
|
*/
|
|
size_t get_size(IntX);
|
|
|
|
} // namespace v2
|
|
} // namespace security
|
|
} // namespace vanetza
|
|
|
|
#endif /* INT_X_HPP_RW3TJBBI */
|