Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
socket_concepts.h File Reference

C++20 concepts for unified socket abstraction. More...

#include <concepts>
#include <cstdint>
#include <functional>
#include <span>
#include <system_error>
#include <type_traits>
#include <vector>
Include dependency graph for socket_concepts.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  kcenon::network::concepts::socket_read_guard< S >
 RAII guard for socket read loop. More...
 
class  kcenon::network::concepts::datagram_receive_guard< S >
 RAII guard for datagram socket receive loop. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::network
 Main namespace for all Network System components.
 
namespace  kcenon::network::concepts
 C++20 concepts for compile-time type validation in network_system.
 

Concepts

concept  kcenon::network::concepts::AsyncCompletionHandler
 Standard completion handler signature for async operations.
 
concept  kcenon::network::concepts::ErrorCompletionHandler
 Error-only completion handler signature.
 
concept  kcenon::network::concepts::Socket
 Base concept for all socket types.
 
concept  kcenon::network::concepts::StreamSocket
 Concept for connected stream sockets (TCP, TLS).
 
concept  kcenon::network::concepts::DatagramSocket
 Concept for connectionless datagram sockets (UDP).
 
concept  kcenon::network::concepts::DatagramSocketWithEndpoint
 Datagram socket with specific endpoint type.
 
concept  kcenon::network::concepts::MessageSocket
 Concept for message-oriented sockets (WebSocket).
 
concept  kcenon::network::concepts::BackpressureAwareSocket
 Concept for sockets with backpressure control.
 
concept  kcenon::network::concepts::MetricsAwareSocket
 Concept for sockets with runtime metrics.
 
concept  kcenon::network::concepts::SecureSocket
 Concept for TLS/SSL-enabled sockets.
 

Detailed Description

C++20 concepts for unified socket abstraction.

This header provides concepts for compile-time validation of socket types, enabling generic algorithms to work with different socket implementations (tcp_socket, secure_tcp_socket, udp_socket, websocket_socket).

Concept hierarchy:

  • Socket: Base concept for all socket types (close, is_closed)
  • StreamSocket: Connected sockets with async send/receive (tcp, secure_tcp)
  • DatagramSocket: Connectionless sockets with send_to (udp)
  • MessageSocket: Message-oriented sockets (websocket)

Requirements:

  • C++20 compiler with concepts support
  • GCC 10+, Clang 10+, MSVC 2022+
See also
tcp_socket, secure_tcp_socket, udp_socket, websocket_socket

Definition in file socket_concepts.h.