25#ifndef JOIN_CORE_PROTOCOL_HPP
26#define JOIN_CORE_PROTOCOL_HPP
35#include <net/ethernet.h>
37#include <linux/if_xdp.h>
43 template <
class Protocol>
46 template <
class Protocol>
49 template <
class Protocol>
52 template <
class Protocol>
55 template <
class Protocol>
58 template <
class Protocol>
61#ifdef JOIN_HAS_IO_URING
64 template <
typename IoPolicy>
67 template <
class Protocol,
class ProactorType = BasicProactor<IoDefaultPolicy>,
size_t OpCount = 16>
70 template <
class Protocol,
class ProactorType = BasicProactor<IoDefaultPolicy>,
size_t OpCount = 16>
73 template <
class Protocol,
class ProactorType = BasicProactor<IoDefaultPolicy>,
size_t OpCount = 16>
76 template <
class Protocol,
class ProactorType = BasicProactor<IoDefaultPolicy>,
size_t OpCount = 16>
79 template <
class Protocol,
class ProactorType = BasicProactor<IoDefaultPolicy>>
84 template <
class Protocol,
class ProactorType = BasicProactor,
size_t OpCount = 16>
87 template <
class Protocol,
class ProactorType = BasicProactor,
size_t OpCount = 16>
90 template <
class Protocol,
class ProactorType = BasicProactor,
size_t OpCount = 16>
93 template <
class Protocol,
class ProactorType = BasicProactor,
size_t OpCount = 16>
96 template <
class Protocol,
class ProactorType = BasicProactor>
113 constexpr Raw () noexcept = default;
128 constexpr int type () const noexcept
139 if constexpr (std::endian::native == std::endian::little)
141 return (ETH_P_ALL >> 8) | (ETH_P_ALL << 8);
154 using Endpoint = BasicXdpEndpoint<Xdp>;
159 constexpr Xdp () noexcept = default;
165 constexpr
int family () const noexcept
174 constexpr int type () const noexcept
183 constexpr int protocol () const noexcept
218 constexpr int type () const noexcept
264 constexpr int type () const noexcept
304 static Udp udpv4 (AF_INET);
314 static Udp udpv6 (AF_INET6);
331 constexpr int type () const noexcept
358 return a.family () == b.family ();
386 static Icmp icmpv4 (AF_INET);
396 static Icmp icmpv6 (AF_INET6);
413 constexpr int type () const noexcept
424 if (
family () == AF_INET6)
426 return int (IPPROTO_ICMPV6);
445 return a.family () == b.family ();
476 static Tcp tcpv4 (AF_INET);
486 static Tcp tcpv6 (AF_INET6);
503 constexpr int type () const noexcept
530 return a.family () == b.family ();
asynchronous datagram socket class.
Definition protocol.hpp:91
asynchronous raw socket class.
Definition protocol.hpp:88
basic asynchronous socket class.
Definition protocol.hpp:85
asynchronous stream acceptor class.
Definition protocol.hpp:97
asynchronous stream socket class.
Definition protocol.hpp:94
basic datagram socket class.
Definition protocol.hpp:50
basic internet endpoint class.
Definition endpoint.hpp:517
basic link layer endpoint class.
Definition endpoint.hpp:98
basic proactor class.
Definition proactor.hpp:158
socket stream class.
Definition socket_stream.hpp:350
basic stream acceptor class.
Definition protocol.hpp:56
basic stream socket class.
Definition stream_socket.hpp:44
basic unix endpoint class.
Definition endpoint.hpp:392
ICMP protocol class.
Definition protocol.hpp:365
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:404
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:422
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:413
static Icmp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:394
static Icmp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:384
constexpr Icmp(int family=AF_INET) noexcept
create the icmp protocol instance.
Definition protocol.hpp:375
RAW protocol class.
Definition protocol.hpp:104
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:128
constexpr Raw() noexcept=default
default constructor.
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:119
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:137
TCP protocol class.
Definition protocol.hpp:452
static Tcp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:484
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:503
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:494
constexpr Tcp(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:465
static Tcp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:474
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:512
UDP protocol class.
Definition protocol.hpp:283
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:331
static Udp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:312
static Udp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:302
constexpr Udp(int family=AF_INET) noexcept
construct the udp protocol instance.
Definition protocol.hpp:293
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:322
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:340
unix datagram protocol class.
Definition protocol.hpp:194
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:218
constexpr UnixDgram() noexcept=default
construct the unix datagram protocol instance by default.
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:227
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:209
unix stream protocol class.
Definition protocol.hpp:237
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:264
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:255
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:273
Definition acceptor.hpp:32
bool operator==(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:196
Definition io_policy.hpp:35