25#ifndef __JOIN_PROTOCOL_HPP__
26#define __JOIN_PROTOCOL_HPP__
32#include <linux/netlink.h>
33#include <net/ethernet.h>
37 template <
class Protocol>
class BasicSocket;
38 template <
class Protocol>
class BasicDatagramSocket;
39 template <
class Protocol>
class BasicStreamSocket;
40 template <
class Protocol>
class BasicTlsSocket;
42 template <
class Protocol>
class BasicSocketStream;
43 template <
class Protocol>
class BasicTlsStream;
64 using Endpoint = BasicUnixEndpoint <UnixDgram>;
65 using Socket = BasicDatagramSocket <UnixDgram>;
76 constexpr
int family () const noexcept
85 constexpr int type () const noexcept
107 using Socket = BasicStreamSocket <UnixStream>;
108 using Stream = BasicSocketStream <UnixStream>;
129 constexpr int type () const noexcept
151 using Socket = BasicDatagramSocket <Netlink>;
157 constexpr Netlink (
int proto = NETLINK_ROUTE) noexcept
168 static Netlink route (NETLINK_ROUTE);
178 static Netlink netfilter (NETLINK_NETFILTER);
195 constexpr int type () const noexcept
222 return a.protocol () == b.protocol ();
248 constexpr Raw () noexcept = default;
263 constexpr int type () const noexcept
274 if (BYTE_ORDER == LITTLE_ENDIAN)
276 return (ETH_P_ALL >> 8) | (ETH_P_ALL << 8);
289 using Socket = BasicDatagramSocket <Udp>;
306 static Udp udpv4 (AF_INET);
316 static Udp udpv6 (AF_INET6);
333 constexpr int type () const noexcept
360 return a.family () == b.family ();
381 using Socket = BasicDatagramSocket <Icmp>;
398 static Icmp icmpv4 (AF_INET);
408 static Icmp icmpv6 (AF_INET6);
425 constexpr int type () const noexcept
436 if (
family () == AF_INET6)
438 return int (IPPROTO_ICMPV6);
457 return a.family () == b.family ();
497 static Tcp tcpv4 (AF_INET);
507 static Tcp tcpv6 (AF_INET6);
524 constexpr int type () const noexcept
551 return a.family () == b.family ();
591 static Tls tlsv4 (AF_INET);
601 static Tls tlsv6 (AF_INET6);
618 constexpr int type () const noexcept
645 return a.family () == b.family ();
688 static Http httpv4 (AF_INET);
698 static Http httpv6 (AF_INET6);
715 constexpr int type () const noexcept
742 return a.family () == b.family ();
766 using Client = BasicHttpSecureClient <Https>;
768 using Server = BasicHttpSecureServer <Https>;
785 static Https httpsv4 (AF_INET);
795 static Https httpsv6 (AF_INET6);
812 constexpr int type () const noexcept
839 return a.family () == b.family ();
879 static Smtp smtpv4 (AF_INET);
889 static Smtp smtpv6 (AF_INET6);
906 constexpr int type () const noexcept
933 return a.family () == b.family ();
956 using Client = BasicSmtpSecureClient <Smtps>;
973 static Smtps smtpsv4 (AF_INET);
983 static Smtps smtpsv6 (AF_INET6);
1000 constexpr int type () const noexcept
1027 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:486
basic HTTPS server.
Definition httpserver.hpp:971
basic HTTP server.
Definition httpserver.hpp:639
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:648
socket stream class.
Definition socketstream.hpp:329
basic socket class.
Definition socket.hpp:60
basic stream acceptor class.
Definition protocol.hpp:45
basic stream socket class.
Definition socket.hpp:1139
basic TLS acceptor class.
Definition protocol.hpp:46
basic TLS socket class.
Definition socket.hpp:1547
TLS stream class.
Definition socketstream.hpp:513
basic unix endpoint class.
Definition endpoint.hpp:98
HTTP protocol class.
Definition protocol.hpp:663
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:724
constexpr Http(int family=AF_INET) noexcept
create the HTTP protocol instance.
Definition protocol.hpp:677
static Http & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:686
static Http & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:696
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:715
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:706
HTTPS protocol class.
Definition protocol.hpp:760
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:821
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:803
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:812
static Https & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:793
static Https & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:783
constexpr Https(int family=AF_INET) noexcept
create the HTTPS protocol instance.
Definition protocol.hpp:774
ICMP protocol class.
Definition protocol.hpp:378
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:416
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:434
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:425
static Icmp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:406
static Icmp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:396
constexpr Icmp(int family=AF_INET) noexcept
create the icmp protocol instance.
Definition protocol.hpp:387
netlink protocol class.
Definition protocol.hpp:148
static Netlink & rt() noexcept
get protocol suitable for netlink route.
Definition protocol.hpp:166
constexpr Netlink(int proto=NETLINK_ROUTE) noexcept
construct the netlink protocol instance by default.
Definition protocol.hpp:157
constexpr int family() const noexcept
get the protocol address family.
Definition protocol.hpp:186
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:195
static Netlink & nf() noexcept
get protocol suitable for netlink netfilter.
Definition protocol.hpp:176
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:204
RAW protocol class.
Definition protocol.hpp:240
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:263
constexpr Raw() noexcept=default
default constructor.
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:254
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:272
SMTP protocol class.
Definition protocol.hpp:857
static Smtp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:877
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:915
static Smtp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:887
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:897
constexpr Smtp(int family=AF_INET) noexcept
create the SMTP protocol instance.
Definition protocol.hpp:868
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:906
SMTPS protocol class.
Definition protocol.hpp:951
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:1009
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:1000
constexpr Smtps(int family=AF_INET) noexcept
create the SMTPS protocol instance.
Definition protocol.hpp:962
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:991
static Smtps & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:981
static Smtps & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:971
TCP protocol class.
Definition protocol.hpp:475
static Tcp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:505
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:524
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:515
constexpr Tcp(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:486
static Tcp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:495
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:533
SSL/TLS protocol class.
Definition protocol.hpp:569
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:627
static Tls & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:599
static Tls & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:589
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:609
constexpr Tls(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:580
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:618
UDP protocol class.
Definition protocol.hpp:286
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:333
static Udp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:314
static Udp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:304
constexpr Udp(int family=AF_INET) noexcept
construct the udp protocol instance.
Definition protocol.hpp:295
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:324
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:342
unix datagram protocol class.
Definition protocol.hpp:62
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:85
constexpr UnixDgram() noexcept=default
construct the unix datagram protocol instance by default.
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:94
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:76
unix stream protocol class.
Definition protocol.hpp:104
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:129
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:120
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:138
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