join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
dot_protocol.hpp
Go to the documentation of this file.
1
25#ifndef JOIN_FABRIC_DOT_PROTOCOL_HPP
26#define JOIN_FABRIC_DOT_PROTOCOL_HPP
27
28// libjoin.
29#include <join/tls_protocol.hpp>
30
31namespace join
32{
33 template <class Protocol>
34 class BasicTlsResolver;
35
39 class Dot
40 {
41 public:
42 using Transport = Tcp;
43 using Endpoint = typename Transport::Endpoint;
46
51 constexpr explicit Dot (int family = AF_INET) noexcept
52 : _transport (family)
53 {
54 }
55
60 static inline Dot& v4 () noexcept
61 {
62 static Dot dotv4 (AF_INET);
63 return dotv4;
64 }
65
70 static inline Dot& v6 () noexcept
71 {
72 static Dot dotv6 (AF_INET6);
73 return dotv6;
74 }
75
80 constexpr int family () const noexcept
81 {
82 return _transport.family ();
83 }
84
86 static constexpr uint16_t defaultPort = 853;
87
89 static constexpr size_t maxMsgSize = 16384;
90
91 private:
93 Transport _transport;
94 };
95
102 constexpr bool operator== (const Dot& a, const Dot& b) noexcept
103 {
104 return a.family () == b.family ();
105 }
106
113 constexpr bool operator!= (const Dot& a, const Dot& b) noexcept
114 {
115 return !(a == b);
116 }
117}
118
119#endif
basic DNS resolver over TLS socket (DNS over TLS).
Definition resolver.hpp:1073
TLS decorator for stream sockets.
Definition tls_wrapper.hpp:38
DNS over TLS protocol class.
Definition dot_protocol.hpp:40
static constexpr uint16_t defaultPort
default DoT port.
Definition dot_protocol.hpp:86
static constexpr size_t maxMsgSize
maximum DoT message size.
Definition dot_protocol.hpp:89
static Dot & v4() noexcept
get protocol suitable for IPv4 address family.
Definition dot_protocol.hpp:60
constexpr int family() const noexcept
get the protocol IP address family.
Definition dot_protocol.hpp:80
static Dot & v6() noexcept
get protocol suitable for IPv6 address family.
Definition dot_protocol.hpp:70
constexpr Dot(int family=AF_INET) noexcept
construct the DoT protocol instance.
Definition dot_protocol.hpp:51
typename Transport::Endpoint Endpoint
Definition dot_protocol.hpp:43
TCP protocol class.
Definition protocol.hpp:471
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:513
BasicInternetEndpoint< Tcp > Endpoint
Definition protocol.hpp:473
Definition acceptor.hpp:32
bool operator==(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:186
bool operator!=(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are not equal.
Definition endpoint.hpp:198