Vanetza
Loading...
Searching...
No Matches
int_x.hpp
1#ifndef INT_X_HPP_RW3TJBBI
2#define INT_X_HPP_RW3TJBBI
3
4#include <vanetza/common/byte_buffer.hpp>
5#include <vanetza/security/v2/serialization.hpp>
6#include <boost/operators.hpp>
7#include <boost/optional.hpp>
8#include <cstdint>
9
10namespace vanetza
11{
12namespace security
13{
14namespace v2
15{
16
17/// IntX specified in TS 103 097 v1.2.1, section 4.2.1
18class IntX :
21{
22public:
23 using integer_type = std::uintmax_t;
24 constexpr IntX() : m_value(0) {}
25 constexpr explicit IntX(integer_type x) : m_value(x) {}
26
27 void set(integer_type x);
28 constexpr integer_type get() const { return m_value; }
29
30 constexpr bool operator==(const IntX& other) const
31 {
32 return m_value == other.m_value;
33 }
34
35 constexpr bool operator==(integer_type other) const
36 {
37 return m_value == other;
38 }
39
40 ByteBuffer encode() const;
41 static boost::optional<IntX> decode(const ByteBuffer&);
42
43private:
44 integer_type m_value;
45};
46
47/**
48 * \brief Serializes an IntX into a binary archive
49 * \param ar to serialize in
50 * \param intx to serialize
51 */
52void serialize(OutputArchive&, const IntX&);
53
54/**
55 * \brief Deserializes an IntX from a binary archive
56 * \param ar with a serialized IntX at the beginning
57 * \param intx to deserialize
58 * \return size of the deserialized IntX
59 */
60size_t deserialize(InputArchive&, IntX&);
61
62/**
63 * \brief Calculates size of an IntX
64 * \param intx
65 * \return number of octets needed to serialize the IntX
66 */
67size_t get_size(IntX);
68
69} // namespace v2
70} // namespace security
71} // namespace vanetza
72
73#endif /* INT_X_HPP_RW3TJBBI */
ChunckPacket is a packet consisting of several memory chunks.
ByteBufferConvertible & operator[](OsiLayer ol)
ChunkPacket & merge(ChunkPacket &packet, OsiLayer from, OsiLayer to)
std::size_t size() const
const ByteBufferConvertible & layer(OsiLayer ol) const
const ByteBufferConvertible & operator[](OsiLayer ol) const
ByteBufferConvertible & layer(OsiLayer ol)
std::size_t size(OsiLayer from, OsiLayer to) const
ChunkPacket extract(OsiLayer from, OsiLayer to)
std::size_t size(OsiLayer from, OsiLayer to) const
buffer_const_range operator[](OsiLayer layer) const
std::size_t size() const
void set_boundary(OsiLayer, unsigned bytes)
const ByteBuffer & buffer() const
CohesivePacket(const ByteBuffer &buffer, OsiLayer layer)
void trim(OsiLayer from, unsigned bytes)
std::size_t size(OsiLayer single_layer) const
Result create(Args... args) const
Definition factory.hpp:45
value_type operator[](size_type) const
Definition byte_view.cpp:48
byte_view_range(ByteBuffer &&)
Definition byte_view.cpp:37
byte_view_range(const ByteBuffer::const_iterator &, const ByteBuffer::const_iterator &)
Definition byte_view.cpp:27
ByteBuffer::const_pointer data() const
Definition byte_view.cpp:42
void encode(units::Duration)
Definition lifetime.cpp:45
units::Duration decode() const
Definition lifetime.cpp:59
bool after(const Timestamp &other) const
Definition timestamp.cpp:76
bool before(const Timestamp &other) const
Definition timestamp.cpp:71
virtual boost::optional< Uncompressed > decompress_point(const EccPoint &ecc_point)=0
decompress a possibly compressed elliptic curve point
static CertificateValidity valid()
Create CertificateValidity signalling a valid certificate This method is equivalent to default constr...
CertificateValidity(CertificateInvalidReason reason)
CertificateInvalidReason reason() const
Get reason for certificate invalidity This call is only safe if reason is available,...
IntX specified in TS 103 097 v1.2.1, section 4.2.1.
Definition int_x.hpp:21
Compressed_Lsb_Y_0 specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition ecc_point.hpp:24
Compressed_Lsb_Y_1 specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition ecc_point.hpp:30
static DecapConfirm from(VerifyConfirm &&verify_confirm, const SecuredMessageView &msg_view)
Input data for decapsulating a secured message.
EcdsaSignature specified in TS 103 097 v1.2.1, section 4.2.9.
Definition signature.hpp:17
Uncompressed specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition ecc_point.hpp:36
X_Coordinate_Only specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition ecc_point.hpp:18
described in TS 103 097 v1.2.1, section 4.2.10
described in TS 103 097 v1.2.1 (2015-06), section 6.1
void add_permission(ItsAid aid, const ByteBuffer &ssp)
const ValidityRestriction * get_restriction(ValidityRestrictionType type) const
const SubjectAttribute * get_attribute(SubjectAttributeType type) const
void remove_attribute(SubjectAttributeType type)
const validity_restriction_type< T > * get_restriction() const
const subject_attribute_type< T > * get_attribute() const
void remove_restriction(ValidityRestrictionType type)
EncryptionKey specified in TS 103 097 v1.2.1, section 6.4.
ItsAidSsp specified in TS 103 097 v1.2.1, section 6.9.
Payload specified in TS 103 097 v1.2.1, section 5.2.
Definition payload.hpp:28
SecuredMessage as specified in TS 103 097 v1.2.1, section 5.1.
HeaderField * header_field(HeaderFieldType)
const TrailerField * trailer_field(TrailerFieldType type) const
const HeaderField * header_field(HeaderFieldType type) const
TrailerField * trailer_field(TrailerFieldType)
SubjectAssurance specified in TS 103 097 v1.2.1 in section 6.6 and 7.4.1.
described in TS 103 097 v1.2.1, section 6.2
ThreeDLocation specified in TS 103 097 v1.2.1, section 4.2.19.
Definition region.hpp:21
Time64WithStandardDeviation specified in TS 103 097 v1.2.1, section 4.2.16.
VerificationKey specified in TS 103 097 v1.2.1, section 6.4.
ecdsa_nistp256_with_sha256 specified in TS 103 097 v1.2.1, section 4.2.4
ecies_nistp256 specified in TS 103 097 v1.2.1, section 4.2.4
resolve type for matching HeaderFieldType
resolve type for matching TrailerFieldType