8#include "../option/option.h"
31 std::vector<std::unique_ptr<option::Option>> mFirstOptions;
32 std::vector<std::unique_ptr<option::Option>> mSecondOptions;
35 uint8_t mMajorVersion;
64 virtual std::vector<uint8_t>
BasePayload(uint8_t &optionIndex)
const;
75 virtual ~Entry() noexcept = default;
97 uint32_t
TTL() const noexcept;
101 const std::vector<std::unique_ptr<option::Option>> &
FirstOptions() const noexcept;
109 const std::vector<std::unique_ptr<option::Option>> &
SecondOptions() const noexcept;
118 virtual std::vector<uint8_t>
Payload(uint8_t &optionIndex) const = 0;
Communication message abstract entry.
Definition: entry.h:28
EntryType Type() const noexcept
Get entry type.
Definition: entry.cpp:111
uint32_t TTL() const noexcept
Get TTL.
Definition: entry.cpp:131
void AddSecondOption(std::unique_ptr< option::Option > secondOption)
Add a second (specific) option.
Definition: entry.cpp:160
void AddFirstOption(std::unique_ptr< option::Option > firstOption)
Add a first (general) option.
Definition: entry.cpp:141
uint16_t InstanceId() const noexcept
Get instance ID.
Definition: entry.cpp:121
uint16_t ServiceId() const noexcept
Get service ID.
Definition: entry.cpp:116
static const uint16_t cAnyInstanceId
Any service instance ID.
Definition: entry.h:68
uint8_t MajorVersion() const noexcept
Get major version.
Definition: entry.cpp:126
static const uint8_t cOptionSizeBitLength
Option number field bit size.
Definition: entry.h:72
const std::vector< std::unique_ptr< option::Option > > & SecondOptions() const noexcept
Get second (specific) options.
Definition: entry.cpp:155
static const uint8_t cAnyMajorVersion
Any service major version.
Definition: entry.h:70
Entry(EntryType type, uint16_t serviceId, uint16_t instanceId, uint32_t ttl, uint8_t majorVersion=cAnyMajorVersion) noexcept
Constructor.
Definition: entry.cpp:9
virtual bool ValidateOption(const option::Option *option) const noexcept
Validate an option for adding.
Definition: entry.cpp:44
virtual std::vector< uint8_t > BasePayload(uint8_t &optionIndex) const
Get baseentity payload.
Definition: entry.cpp:174
bool ContainsOption(option::OptionType optionType) const noexcept
Indicate whether the entry contains a specific option type or not.
Definition: entry.cpp:90
const std::vector< std::unique_ptr< option::Option > > & FirstOptions() const noexcept
Get first (general) options.
Definition: entry.cpp:136
virtual std::vector< uint8_t > Payload(uint8_t &optionIndex) const =0
Get entity payload.
Communication message entry abstract option.
Definition: option.h:37
EntryType
Message entry type.
Definition: entry.h:19
@ Subscribing
Event start/stop subscribing.
@ Finding
Service finding.
@ Offering
Service start/stop offering.
@ Acknowledging
Event subscribe positive/negative acknowledging.
OptionType
Entry option type.
Definition: option.h:17