25#ifndef JOIN_CORE_PROTOCOL_HPP
26#define JOIN_CORE_PROTOCOL_HPP
32#include <net/ethernet.h>
34#include <linux/if_xdp.h>
40 template <
class Protocol>
43 template <
class Protocol>
46 template <
class Protocol>
49 template <
class Protocol>
52 template <
class Protocol>
55 template <
class Protocol>
58#ifdef JOIN_HAS_IO_URING
61 template <
typename Policy>
64 template <
class Protocol,
class Proactor = BasicProactor<IoDefaultPolicy>,
size_t OpCount = 16>
67 template <
class Protocol,
class Proactor = BasicProactor<IoDefaultPolicy>,
size_t OpCount = 16>
70 template <
class Protocol,
class Proactor = BasicProactor<IoDefaultPolicy>,
size_t OpCount = 16>
73 template <
class Protocol,
class Proactor = BasicProactor<IoDefaultPolicy>,
size_t OpCount = 16>
76 template <
class Protocol,
class Proactor = BasicProactor<IoDefaultPolicy>>
81 template <
class Protocol,
class Proactor = BasicProactor,
size_t OpCount = 16>
84 template <
class Protocol,
class Proactor = BasicProactor,
size_t OpCount = 16>
87 template <
class Protocol,
class Proactor = BasicProactor,
size_t OpCount = 16>
90 template <
class Protocol,
class Proactor = BasicProactor,
size_t OpCount = 16>
93 template <
class Protocol,
class Proactor = BasicProactor>
110 constexpr Raw () noexcept = default;
125 constexpr int type () const noexcept
136 if (BYTE_ORDER == LITTLE_ENDIAN)
138 return (ETH_P_ALL >> 8) | (ETH_P_ALL << 8);
151 using Endpoint = BasicXdpEndpoint<Xdp>;
156 constexpr Xdp () noexcept = default;
162 constexpr
int family () const noexcept
171 constexpr int type () const noexcept
180 constexpr int protocol () const noexcept
215 constexpr int type () const noexcept
261 constexpr int type () const noexcept
301 static Udp udpv4 (AF_INET);
311 static Udp udpv6 (AF_INET6);
328 constexpr int type () const noexcept
355 return a.family () == b.family ();
394 static Icmp icmpv4 (AF_INET);
404 static Icmp icmpv6 (AF_INET6);
421 constexpr int type () const noexcept
432 if (
family () == AF_INET6)
434 return int (IPPROTO_ICMPV6);
453 return a.family () == b.family ();
495 static Tcp tcpv4 (AF_INET);
505 static Tcp tcpv6 (AF_INET6);
522 constexpr int type () const noexcept
549 return a.family () == b.family ();
asynchronous datagram socket class.
Definition protocol.hpp:88
asynchronous raw socket class.
Definition protocol.hpp:85
basic asynchronous socket class.
Definition protocol.hpp:82
asynchronous stream acceptor class.
Definition protocol.hpp:94
asynchronous stream socket class.
Definition protocol.hpp:91
basic datagram socket class.
Definition protocol.hpp:47
basic internet endpoint class.
Definition endpoint.hpp:632
basic link layer endpoint class.
Definition endpoint.hpp:97
basic proactor class.
Definition proactor.hpp:156
socket stream class.
Definition socket_stream.hpp:350
basic stream acceptor class.
Definition protocol.hpp:53
basic stream socket class.
Definition stream_socket.hpp:44
basic unix endpoint class.
Definition endpoint.hpp:464
ICMP protocol class.
Definition protocol.hpp:373
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:412
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:430
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:421
static Icmp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:402
static Icmp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:392
constexpr Icmp(int family=AF_INET) noexcept
create the icmp protocol instance.
Definition protocol.hpp:383
RAW protocol class.
Definition protocol.hpp:101
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:125
constexpr Raw() noexcept=default
default constructor.
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:116
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:134
TCP protocol class.
Definition protocol.hpp:471
static Tcp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:503
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:522
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:513
constexpr Tcp(int family=AF_INET) noexcept
create the tcp protocol instance.
Definition protocol.hpp:484
static Tcp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:493
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:531
UDP protocol class.
Definition protocol.hpp:280
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:328
static Udp & v6() noexcept
get protocol suitable for IPv6 address family.
Definition protocol.hpp:309
static Udp & v4() noexcept
get protocol suitable for IPv4 address family.
Definition protocol.hpp:299
constexpr Udp(int family=AF_INET) noexcept
construct the udp protocol instance.
Definition protocol.hpp:290
constexpr int family() const noexcept
get the protocol IP address family.
Definition protocol.hpp:319
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:337
unix datagram protocol class.
Definition protocol.hpp:191
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:215
constexpr UnixDgram() noexcept=default
construct the unix datagram protocol instance by default.
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:224
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:206
unix stream protocol class.
Definition protocol.hpp:234
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:261
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:252
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:270
Definition acceptor.hpp:32
bool operator==(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:186
bool operator!=(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are not equal.
Definition endpoint.hpp:198
Definition io_policy.hpp:35