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>
70 template <
class Protocol>
73 template <
class Protocol>
75 template <
class Protocol>
96 constexpr
int family () const noexcept
105 constexpr int type () const noexcept
149 constexpr int type () const noexcept
177 constexpr Netlink (
int proto = NETLINK_ROUTE) noexcept
188 static Netlink route (NETLINK_ROUTE);
198 static Netlink netfilter (NETLINK_NETFILTER);
215 constexpr int type () const noexcept
242 return a.protocol () == b.protocol ();
268 constexpr Raw () noexcept = default;
283 constexpr int type () const noexcept
294 if (BYTE_ORDER == LITTLE_ENDIAN)
296 return (ETH_P_ALL >> 8) | (ETH_P_ALL << 8);
326 static Udp udpv4 (AF_INET);
336 static Udp udpv6 (AF_INET6);
353 constexpr int type () const noexcept
380 return a.family () == b.family ();
418 static Icmp icmpv4 (AF_INET);
428 static Icmp icmpv6 (AF_INET6);
445 constexpr int type () const noexcept
456 if (
family () == AF_INET6)
458 return int (IPPROTO_ICMPV6);
477 return a.family () == b.family ();
517 static Tcp tcpv4 (AF_INET);
527 static Tcp tcpv6 (AF_INET6);
544 constexpr int type () const noexcept
571 return a.family () == b.family ();
611 static Tls tlsv4 (AF_INET);
621 static Tls tlsv6 (AF_INET6);
638 constexpr int type () const noexcept
665 return a.family () == b.family ();
704 static Dns dnsv4 (AF_INET);
714 static Dns dnsv6 (AF_INET6);
731 constexpr int type () const noexcept
764 return a.family () == b.family ();
803 static Dot dotv4 (AF_INET);
813 static Dot dotv6 (AF_INET6);
830 constexpr int type () const noexcept
863 return a.family () == b.family ();
906 static Http httpv4 (AF_INET);
916 static Http httpv6 (AF_INET6);
933 constexpr int type () const noexcept
960 return a.family () == b.family ();
1003 static Https httpsv4 (AF_INET);
1013 static Https httpsv6 (AF_INET6);
1030 constexpr int type () const noexcept
1057 return a.family () == b.family ();
1097 static Smtp smtpv4 (AF_INET);
1107 static Smtp smtpv6 (AF_INET6);
1124 constexpr int type () const noexcept
1151 return a.family () == b.family ();
1191 static Smtps smtpsv4 (AF_INET);
1201 static Smtps smtpsv6 (AF_INET6);
1218 constexpr int type () const noexcept
1245 return a.family () == b.family ();
basic DNS resolver over datagram socket.
Definition resolver.hpp:51
basic datagram socket class.
Definition socket.hpp:645
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:60
basic stream acceptor class.
Definition protocol.hpp:52
basic stream socket class.
Definition socket.hpp:1142
basic TLS acceptor class.
Definition protocol.hpp:54
basic DNS resolver over TLS socket (DNS over TLS).
Definition resolver.hpp:1033
basic TLS socket class.
Definition socket.hpp:1552
TLS stream class.
Definition socketstream.hpp:513
basic unix endpoint class.
Definition endpoint.hpp:98
DNS over UDP protocol class.
Definition protocol.hpp:683
static constexpr size_t maxMsgSize
maximum DNS message size.
Definition protocol.hpp:749
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:722
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:731
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:740
static Dns & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:712
constexpr Dns(int family=AF_INET) noexcept
construct the DNS protocol instance.
Definition protocol.hpp:693
static Dns & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:702
static constexpr uint16_t defaultPort
default DNS port.
Definition protocol.hpp:746
DNS over TLS protocol class.
Definition protocol.hpp:782
static constexpr uint16_t defaultPort
default DoT port.
Definition protocol.hpp:845
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:839
static constexpr size_t maxMsgSize
maximum DoT message size.
Definition protocol.hpp:848
static Dot & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:801
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:830
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:821
static Dot & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:811
constexpr Dot(int family=AF_INET) noexcept
construct the DoT protocol instance.
Definition protocol.hpp:792
HTTP protocol class.
Definition protocol.hpp:881
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:942
constexpr Http(int family=AF_INET) noexcept
create the HTTP protocol instance.
Definition protocol.hpp:895
static Http & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:904
static Http & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:914
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:933
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:924
HTTPS protocol class.
Definition protocol.hpp:978
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:1039
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:1021
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:1030
static Https & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:1011
static Https & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:1001
constexpr Https(int family=AF_INET) noexcept
create the HTTPS protocol instance.
Definition protocol.hpp:992
ICMP protocol class.
Definition protocol.hpp:398
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:436
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:454
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:445
static Icmp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:426
static Icmp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:416
constexpr Icmp(int family=AF_INET) noexcept
create the icmp protocol instance.
Definition protocol.hpp:407
netlink protocol class.
Definition protocol.hpp:168
static Netlink & rt() noexcept
get protocol suitable for netlink route.
Definition protocol.hpp:186
constexpr Netlink(int proto=NETLINK_ROUTE) noexcept
construct the netlink protocol instance by default.
Definition protocol.hpp:177
constexpr int family() const noexcept
get the protocol address family.
Definition protocol.hpp:206
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:215
static Netlink & nf() noexcept
get protocol suitable for netlink netfilter.
Definition protocol.hpp:196
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:224
RAW protocol class.
Definition protocol.hpp:260
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:283
constexpr Raw() noexcept=default
default constructor.
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:274
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:292
SMTP protocol class.
Definition protocol.hpp:1075
static Smtp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:1095
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:1133
static Smtp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:1105
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:1115
constexpr Smtp(int family=AF_INET) noexcept
create the SMTP protocol instance.
Definition protocol.hpp:1086
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:1124
SMTPS protocol class.
Definition protocol.hpp:1169
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:1227
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:1218
constexpr Smtps(int family=AF_INET) noexcept
create the SMTPS protocol instance.
Definition protocol.hpp:1180
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:1209
static Smtps & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:1199
static Smtps & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:1189
TCP protocol class.
Definition protocol.hpp:495
static Tcp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:525
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:544
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:535
constexpr Tcp(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:506
static Tcp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:515
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:553
SSL/TLS protocol class.
Definition protocol.hpp:589
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:647
static Tls & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:619
static Tls & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:609
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:629
constexpr Tls(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:600
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:638
UDP protocol class.
Definition protocol.hpp:306
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:353
static Udp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:334
static Udp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:324
constexpr Udp(int family=AF_INET) noexcept
construct the udp protocol instance.
Definition protocol.hpp:315
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:344
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:362
unix datagram protocol class.
Definition protocol.hpp:82
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:105
constexpr UnixDgram() noexcept=default
construct the unix datagram protocol instance by default.
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:114
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:96
unix stream protocol class.
Definition protocol.hpp:124
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:149
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:140
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:158
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