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>
65 template <
class Protocol>
68 template <
class Protocol>
70 template <
class Protocol>
91 constexpr
int family () const noexcept
100 constexpr int type () const noexcept
144 constexpr int type () const noexcept
172 constexpr Netlink (
int proto = NETLINK_ROUTE) noexcept
183 static Netlink route (NETLINK_ROUTE);
193 static Netlink netfilter (NETLINK_NETFILTER);
210 constexpr int type () const noexcept
237 return a.protocol () == b.protocol ();
263 constexpr Raw () noexcept = default;
278 constexpr int type () const noexcept
289 if (BYTE_ORDER == LITTLE_ENDIAN)
291 return (ETH_P_ALL >> 8) | (ETH_P_ALL << 8);
321 static Udp udpv4 (AF_INET);
331 static Udp udpv6 (AF_INET6);
348 constexpr int type () const noexcept
375 return a.family () == b.family ();
413 static Icmp icmpv4 (AF_INET);
423 static Icmp icmpv6 (AF_INET6);
440 constexpr int type () const noexcept
451 if (
family () == AF_INET6)
453 return int (IPPROTO_ICMPV6);
472 return a.family () == b.family ();
512 static Tcp tcpv4 (AF_INET);
522 static Tcp tcpv6 (AF_INET6);
539 constexpr int type () const noexcept
566 return a.family () == b.family ();
606 static Tls tlsv4 (AF_INET);
616 static Tls tlsv6 (AF_INET6);
633 constexpr int type () const noexcept
660 return a.family () == b.family ();
703 static Http httpv4 (AF_INET);
713 static Http httpv6 (AF_INET6);
730 constexpr int type () const noexcept
757 return a.family () == b.family ();
800 static Https httpsv4 (AF_INET);
810 static Https httpsv6 (AF_INET6);
827 constexpr int type () const noexcept
854 return a.family () == b.family ();
894 static Smtp smtpv4 (AF_INET);
904 static Smtp smtpv6 (AF_INET6);
921 constexpr int type () const noexcept
948 return a.family () == b.family ();
988 static Smtps smtpsv4 (AF_INET);
998 static Smtps smtpsv6 (AF_INET6);
1015 constexpr int type () const noexcept
1042 return a.family () == b.family ();
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:978
basic HTTP server.
Definition httpserver.hpp:643
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 TLS socket class.
Definition socket.hpp:1552
TLS stream class.
Definition socketstream.hpp:513
basic unix endpoint class.
Definition endpoint.hpp:98
HTTP protocol class.
Definition protocol.hpp:678
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:739
constexpr Http(int family=AF_INET) noexcept
create the HTTP protocol instance.
Definition protocol.hpp:692
static Http & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:701
static Http & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:711
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:730
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:721
HTTPS protocol class.
Definition protocol.hpp:775
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:836
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:818
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:827
static Https & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:808
static Https & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:798
constexpr Https(int family=AF_INET) noexcept
create the HTTPS protocol instance.
Definition protocol.hpp:789
ICMP protocol class.
Definition protocol.hpp:393
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:431
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:449
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:440
static Icmp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:421
static Icmp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:411
constexpr Icmp(int family=AF_INET) noexcept
create the icmp protocol instance.
Definition protocol.hpp:402
netlink protocol class.
Definition protocol.hpp:163
static Netlink & rt() noexcept
get protocol suitable for netlink route.
Definition protocol.hpp:181
constexpr Netlink(int proto=NETLINK_ROUTE) noexcept
construct the netlink protocol instance by default.
Definition protocol.hpp:172
constexpr int family() const noexcept
get the protocol address family.
Definition protocol.hpp:201
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:210
static Netlink & nf() noexcept
get protocol suitable for netlink netfilter.
Definition protocol.hpp:191
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:219
RAW protocol class.
Definition protocol.hpp:255
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:278
constexpr Raw() noexcept=default
default constructor.
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:269
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:287
SMTP protocol class.
Definition protocol.hpp:872
static Smtp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:892
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:930
static Smtp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:902
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:912
constexpr Smtp(int family=AF_INET) noexcept
create the SMTP protocol instance.
Definition protocol.hpp:883
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:921
SMTPS protocol class.
Definition protocol.hpp:966
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:1024
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:1015
constexpr Smtps(int family=AF_INET) noexcept
create the SMTPS protocol instance.
Definition protocol.hpp:977
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:1006
static Smtps & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:996
static Smtps & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:986
TCP protocol class.
Definition protocol.hpp:490
static Tcp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:520
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:539
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:530
constexpr Tcp(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:501
static Tcp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:510
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:548
SSL/TLS protocol class.
Definition protocol.hpp:584
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:642
static Tls & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:614
static Tls & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:604
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:624
constexpr Tls(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:595
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:633
UDP protocol class.
Definition protocol.hpp:301
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:348
static Udp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:329
static Udp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:319
constexpr Udp(int family=AF_INET) noexcept
construct the udp protocol instance.
Definition protocol.hpp:310
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:339
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:357
unix datagram protocol class.
Definition protocol.hpp:77
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:100
constexpr UnixDgram() noexcept=default
construct the unix datagram protocol instance by default.
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:109
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:91
unix stream protocol class.
Definition protocol.hpp:119
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:144
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:135
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:153
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