25#ifndef JOIN_CORE_PROTOCOL_HPP
26#define JOIN_CORE_PROTOCOL_HPP
32#include <linux/netlink.h>
33#include <net/ethernet.h>
37 template <
class Protocol>
39 template <
class Protocol>
40 class BasicDatagramSocket;
41 template <
class Protocol>
42 class BasicStreamSocket;
43 template <
class Protocol>
46 template <
class Protocol>
47 class BasicSocketStream;
48 template <
class Protocol>
51 template <
class Protocol>
53 template <
class Protocol>
56 template <
class Protocol>
58 template <
class Protocol>
61 template <
class Protocol>
63 template <
class Protocol>
66 template <
class Protocol>
68 template <
class Protocol>
71 template <
class Protocol>
73 template <
class Protocol>
75 template <
class Protocol>
78 template <
class Protocol>
80 template <
class Protocol>
110 constexpr int type () const noexcept
154 constexpr int type () const noexcept
182 constexpr Netlink (
int proto = NETLINK_ROUTE) noexcept
193 static Netlink route (NETLINK_ROUTE);
203 static Netlink netfilter (NETLINK_NETFILTER);
220 constexpr int type () const noexcept
247 return a.protocol () == b.protocol ();
273 constexpr Raw () noexcept = default;
288 constexpr int type () const noexcept
299 if (BYTE_ORDER == LITTLE_ENDIAN)
301 return (ETH_P_ALL >> 8) | (ETH_P_ALL << 8);
331 static Udp udpv4 (AF_INET);
341 static Udp udpv6 (AF_INET6);
358 constexpr int type () const noexcept
385 return a.family () == b.family ();
423 static Icmp icmpv4 (AF_INET);
433 static Icmp icmpv6 (AF_INET6);
450 constexpr int type () const noexcept
461 if (
family () == AF_INET6)
463 return int (IPPROTO_ICMPV6);
482 return a.family () == b.family ();
522 static Tcp tcpv4 (AF_INET);
532 static Tcp tcpv6 (AF_INET6);
549 constexpr int type () const noexcept
576 return a.family () == b.family ();
616 static Tls tlsv4 (AF_INET);
626 static Tls tlsv6 (AF_INET6);
643 constexpr int type () const noexcept
670 return a.family () == b.family ();
710 static Dns dnsv4 (AF_INET);
720 static Dns dnsv6 (AF_INET6);
737 constexpr int type () const noexcept
770 return a.family () == b.family ();
809 static Mdns mdnsv4 (AF_INET);
819 static Mdns mdnsv6 (AF_INET6);
836 constexpr int type () const noexcept
857 return (
family == AF_INET6) ?
"ff02::fb" :
"224.0.0.251";
879 return a.family () == b.family ();
918 static Dot dotv4 (AF_INET);
928 static Dot dotv6 (AF_INET6);
945 constexpr int type () const noexcept
978 return a.family () == b.family ();
1021 static Http httpv4 (AF_INET);
1031 static Http httpv6 (AF_INET6);
1048 constexpr int type () const noexcept
1075 return a.family () == b.family ();
1118 static Https httpsv4 (AF_INET);
1128 static Https httpsv6 (AF_INET6);
1145 constexpr int type () const noexcept
1172 return a.family () == b.family ();
1212 static Smtp smtpv4 (AF_INET);
1222 static Smtp smtpv6 (AF_INET6);
1239 constexpr int type () const noexcept
1266 return a.family () == b.family ();
1306 static Smtps smtpsv4 (AF_INET);
1316 static Smtps smtpsv6 (AF_INET6);
1333 constexpr int type () const noexcept
1360 return a.family () == b.family ();
basic DNS name server over datagram socket.
Definition nameserver.hpp:41
mDNS peer.
Definition nameserver.hpp:225
basic DNS resolver over datagram socket.
Definition resolver.hpp:52
basic datagram socket class.
Definition socket.hpp:644
basic HTTP client.
Definition httpclient.hpp:46
basic HTTPS client.
Definition httpclient.hpp:488
basic HTTPS server.
Definition httpserver.hpp:979
basic HTTP server.
Definition httpserver.hpp:644
basic HTTP worker.
Definition httpserver.hpp:81
basic internet endpoint class.
Definition endpoint.hpp:670
basic link layer endpoint class.
Definition endpoint.hpp:498
basic netlink endpoint class.
Definition endpoint.hpp:266
basic SMTP client.
Definition smtpclient.hpp:41
Basic SMTPS client.
Definition smtpclient.hpp:650
socket stream class.
Definition socketstream.hpp:329
basic socket class.
Definition socket.hpp:59
basic stream acceptor class.
Definition protocol.hpp:52
basic stream socket class.
Definition socket.hpp:1141
basic TLS acceptor class.
Definition protocol.hpp:54
basic DNS resolver over TLS socket (DNS over TLS).
Definition resolver.hpp:1040
basic TLS socket class.
Definition socket.hpp:1551
TLS stream class.
Definition socketstream.hpp:513
basic unix endpoint class.
Definition endpoint.hpp:98
DNS over UDP protocol class.
Definition protocol.hpp:688
static constexpr size_t maxMsgSize
maximum DNS message size.
Definition protocol.hpp:755
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:728
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:737
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:746
static Dns & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:718
constexpr Dns(int family=AF_INET) noexcept
construct the DNS protocol instance.
Definition protocol.hpp:699
static Dns & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:708
static constexpr uint16_t defaultPort
default DNS port.
Definition protocol.hpp:752
DNS over TLS protocol class.
Definition protocol.hpp:897
static constexpr uint16_t defaultPort
default DoT port.
Definition protocol.hpp:960
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:954
static constexpr size_t maxMsgSize
maximum DoT message size.
Definition protocol.hpp:963
static Dot & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:916
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:945
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:936
static Dot & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:926
constexpr Dot(int family=AF_INET) noexcept
construct the DoT protocol instance.
Definition protocol.hpp:907
HTTP protocol class.
Definition protocol.hpp:996
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:1057
constexpr Http(int family=AF_INET) noexcept
create the HTTP protocol instance.
Definition protocol.hpp:1010
static Http & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:1019
static Http & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:1029
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:1048
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:1039
HTTPS protocol class.
Definition protocol.hpp:1093
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:1154
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:1136
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:1145
static Https & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:1126
static Https & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:1116
constexpr Https(int family=AF_INET) noexcept
create the HTTPS protocol instance.
Definition protocol.hpp:1107
ICMP protocol class.
Definition protocol.hpp:403
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:441
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:459
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:450
static Icmp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:431
static Icmp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:421
constexpr Icmp(int family=AF_INET) noexcept
create the icmp protocol instance.
Definition protocol.hpp:412
IPv6, IPv4 address class.
Definition ipaddress.hpp:51
Multicast DNS protocol class.
Definition protocol.hpp:788
static constexpr size_t maxMsgSize
maximum DNS message size.
Definition protocol.hpp:864
static Mdns & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:817
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:845
static constexpr uint16_t defaultPort
default DNS port.
Definition protocol.hpp:861
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:827
static Mdns & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:807
constexpr Mdns(int family=AF_INET) noexcept
construct the mDNS protocol instance.
Definition protocol.hpp:798
static IpAddress multicastAddress(int family) noexcept
get multicast address for the given address family.
Definition protocol.hpp:855
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:836
netlink protocol class.
Definition protocol.hpp:173
static Netlink & rt() noexcept
get protocol suitable for netlink route.
Definition protocol.hpp:191
constexpr Netlink(int proto=NETLINK_ROUTE) noexcept
construct the netlink protocol instance by default.
Definition protocol.hpp:182
constexpr int family() const noexcept
get the protocol address family.
Definition protocol.hpp:211
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:220
static Netlink & nf() noexcept
get protocol suitable for netlink netfilter.
Definition protocol.hpp:201
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:229
RAW protocol class.
Definition protocol.hpp:265
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:288
constexpr Raw() noexcept=default
default constructor.
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:279
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:297
SMTP protocol class.
Definition protocol.hpp:1190
static Smtp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:1210
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:1248
static Smtp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:1220
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:1230
constexpr Smtp(int family=AF_INET) noexcept
create the SMTP protocol instance.
Definition protocol.hpp:1201
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:1239
SMTPS protocol class.
Definition protocol.hpp:1284
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:1342
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:1333
constexpr Smtps(int family=AF_INET) noexcept
create the SMTPS protocol instance.
Definition protocol.hpp:1295
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:1324
static Smtps & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:1314
static Smtps & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:1304
TCP protocol class.
Definition protocol.hpp:500
static Tcp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:530
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:549
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:540
constexpr Tcp(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:511
static Tcp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:520
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:558
SSL/TLS protocol class.
Definition protocol.hpp:594
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:652
static Tls & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:624
static Tls & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:614
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:634
constexpr Tls(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:605
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:643
UDP protocol class.
Definition protocol.hpp:311
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:358
static Udp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:339
static Udp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:329
constexpr Udp(int family=AF_INET) noexcept
construct the udp protocol instance.
Definition protocol.hpp:320
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:349
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:367
unix datagram protocol class.
Definition protocol.hpp:87
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:110
constexpr UnixDgram() noexcept=default
construct the unix datagram protocol instance by default.
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:119
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:101
unix stream protocol class.
Definition protocol.hpp:129
constexpr UnixStream() noexcept=default
construct the unix stream protocol instance by default.
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:154
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:145
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:163
Definition acceptor.hpp:32
bool operator!=(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoints are not equal.
Definition endpoint.hpp:195
bool operator==(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:183