5#include "./payload_type.h"
6#include "./generic_nack_type.h"
14 uint8_t mProtocolVersion;
15 const PayloadType mPayloadType;
23 explicit Message(PayloadType payloadType)
noexcept;
28 Message(uint8_t protocolVersion, PayloadType payloadType)
noexcept;
32 virtual void GetPayload(std::vector<uint8_t> &payload)
const = 0;
39 const std::vector<uint8_t> &payload,
40 uint32_t payloadLength) = 0;
45 void Serialize(std::vector<uint8_t> &serializedMessage)
const;
52 const std::vector<uint8_t> &serializedMessage,
53 GenericNackType &nackCode);
60 const std::vector<uint8_t> &serializedMessage,
61 PayloadType &payloadType);
63 virtual ~Message() noexcept = default;
DoIP generic message.
Definition: message.h:12
Message(PayloadType payloadType) noexcept
Constructor.
void Serialize(std::vector< uint8_t > &serializedMessage) const
Serialize DoIP message.
Message(uint8_t protocolVersion, PayloadType payloadType) noexcept
Constructor.
virtual void GetPayload(std::vector< uint8_t > &payload) const =0
Get message payload.
bool TryDeserialize(const std::vector< uint8_t > &serializedMessage, GenericNackType &nackCode)
Try to deserialize DoIP message.
static const std::size_t cHeaderSize
DoIP message header size.
Definition: message.h:19
static bool TryExtractPayloadType(const std::vector< uint8_t > &serializedMessage, PayloadType &payloadType)
Try to extract the payload type from the given serialized message.
virtual bool TrySetPayload(const std::vector< uint8_t > &payload, uint32_t payloadLength)=0
Try to set message payload.