1#ifndef IPV4_ENDPOINT_OPTION_H
2#define IPV4_ENDPOINT_OPTION_H
7#include "../helper/ipv4_address.h"
20 static const uint16_t cDefaultSdPort = 30490;
31 uint16_t port) noexcept :
Option(type, discardable),
32 mIpAddress{ipAddress},
40 virtual uint16_t
Length()
const noexcept override;
52 uint16_t
Port()
const noexcept;
54 virtual std::vector<uint8_t>
Payload()
const override;
66 uint16_t port)
noexcept;
88 uint16_t port = cDefaultSdPort)
noexcept;
97 static std::unique_ptr<Ipv4EndpointOption>
Deserialize(
98 const std::vector<uint8_t> &payload,
IPv4 endpoint option for both generic and service discovery purposes.
Definition: ipv4_endpoint_option.h:17
virtual std::vector< uint8_t > Payload() const override
Get option payload.
Definition: ipv4_endpoint_option.cpp:30
helper::Ipv4Address IpAddress() const noexcept
Get IP address.
Definition: ipv4_endpoint_option.cpp:15
uint16_t Port() const noexcept
Get port.
Definition: ipv4_endpoint_option.cpp:25
Layer4ProtocolType L4Proto() const noexcept
Get protocol.
Definition: ipv4_endpoint_option.cpp:20
static std::unique_ptr< Ipv4EndpointOption > CreateSdEndpoint(bool discardable, helper::Ipv4Address ipAddress, Layer4ProtocolType protocol=cDefaultSdProtocol, uint16_t port=cDefaultSdPort) noexcept
Service discovery factroy.
Definition: ipv4_endpoint_option.cpp:90
static std::unique_ptr< Ipv4EndpointOption > Deserialize(const std::vector< uint8_t > &payload, std::size_t &offset, OptionType type, bool discardable)
Deserialize an option payload.
Definition: ipv4_endpoint_option.cpp:106
static std::unique_ptr< Ipv4EndpointOption > CreateUnitcastEndpoint(bool discardable, helper::Ipv4Address ipAddress, Layer4ProtocolType protocol, uint16_t port) noexcept
Unitcast endpoint factory.
Definition: ipv4_endpoint_option.cpp:47
virtual uint16_t Length() const noexcept override
Get option length.
Definition: ipv4_endpoint_option.cpp:9
static std::unique_ptr< Ipv4EndpointOption > CreateMulticastEndpoint(bool discardable, helper::Ipv4Address ipAddress, uint16_t port)
Multicast endpoint factory.
Definition: ipv4_endpoint_option.cpp:64
Communication message entry abstract option.
Definition: option.h:37
constexpr Option(OptionType type, bool discardable) noexcept
Constructor.
Definition: option.h:46
OptionType
Entry option type.
Definition: option.h:17
Layer4ProtocolType
OSI layer-4 protocol type.
Definition: option.h:30
@ Udp
User datagram protocol.
IPv4 address wrapper helper.
Definition: ipv4_address.h:16