Files
MicrOBU/obu-firmware/external/vanetza-idf/vanetza/security/v2/int_x.hpp
T
Ashin Walpola d107534eb2 Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
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.
2026-09-24 10:56:05 +02:00

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 */