Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
option.h
1#ifndef OPTION_H
2#define OPTION_H
3
4#include <stdint.h>
5#include <vector>
6#include "../helper/payload_helper.h"
7
8namespace ara
9{
10 namespace com
11 {
13 namespace option
14 {
16 enum class OptionType : uint8_t
17 {
18 Configuration = 0x01,
19 LoadBalancing = 0x02,
20 IPv4Endpoint = 0x04,
21 IPv6Endpoint = 0x06,
22 IPv4Multicast = 0x14,
23 IPv6Multicast = 0x16,
24 IPv4SdEndpoint = 0x24,
25 IPv6SdEndpoint = 0x26
26 };
27
29 enum class Layer4ProtocolType : uint8_t
30 {
31 Tcp = 0x06,
32 Udp = 0x11
33 };
34
36 class Option
37 {
38 private:
39 OptionType mType;
40 bool mDiscardable;
41
42 protected:
46 constexpr Option(OptionType type, bool discardable) noexcept : mType{type},
47 mDiscardable{discardable}
48 {
49 }
50
53 std::vector<uint8_t> BasePayload() const;
54
55 public:
56 virtual ~Option() noexcept = default;
57
60 virtual uint16_t Length() const noexcept = 0;
61
64 OptionType Type() const noexcept;
65
68 bool Discardable() const noexcept;
69
72 virtual std::vector<uint8_t> Payload() const = 0;
73 };
74 }
75 }
76}
77
78#endif
Communication message entry abstract option.
Definition: option.h:37
constexpr Option(OptionType type, bool discardable) noexcept
Constructor.
Definition: option.h:46
std::vector< uint8_t > BasePayload() const
Get base option payload.
Definition: option.cpp:19
virtual std::vector< uint8_t > Payload() const =0
Get option payload.
OptionType Type() const noexcept
Get option type.
Definition: option.cpp:9
virtual uint16_t Length() const noexcept=0
Get option length.
bool Discardable() const noexcept
Get discardable flag.
Definition: option.cpp:14
OptionType
Entry option type.
Definition: option.h:17
@ IPv6Endpoint
Generic IPv6 unicast endpoint.
@ IPv4Endpoint
Generic IPv4 unicast endpoint.
@ Configuration
DNS configuration.
@ IPv6Multicast
Genetic IPv6 multicast endpoint.
@ LoadBalancing
Service instnace load balancing.
@ IPv4Multicast
Generic IPv4 multicast endpoint.
@ IPv4SdEndpoint
Service discovery IPv4 endpoint.
@ IPv6SdEndpoint
Service discovery IPv6 endpoint.
Layer4ProtocolType
OSI layer-4 protocol type.
Definition: option.h:30
@ Tcp
Transmission control protocol.
@ Udp
User datagram protocol.