Nexus HTTP/3
A QUIC and HTTP/3 library
client.hpp
1 #pragma once
2 
3 #include <nexus/udp.hpp>
4 #include <nexus/ssl.hpp>
5 #include <nexus/quic/detail/engine_impl.hpp>
6 #include <nexus/quic/detail/socket_impl.hpp>
7 
8 namespace nexus::quic {
9 
10 class connection;
11 class stream;
12 
15 class client {
16  friend class connection;
17  detail::engine_impl engine;
18  detail::socket_impl socket;
19  public:
21  using executor_type = detail::engine_impl::executor_type;
22 
24  client(udp::socket&& socket, ssl::context& ctx); // TODO: noexcept
25 
27  client(udp::socket&& socket, ssl::context& ctx, const settings& s); // TODO: noexcept
28 
30  client(const executor_type& ex, const udp::endpoint& endpoint,
31  ssl::context& ctx);
32 
34  client(const executor_type& ex, const udp::endpoint& endpoint,
35  ssl::context& ctx, const settings& s);
36 
39 
41  udp::endpoint local_endpoint() const;
42 
46  void connect(connection& conn,
47  const udp::endpoint& endpoint,
48  const char* hostname);
49 
51  void close(error_code& ec);
53  void close();
54 };
55 
56 } // namespace nexus::quic
a generic QUIC client that owns a UDP socket and uses it to service client connections
Definition: client.hpp:15
client(const executor_type &ex, const udp::endpoint &endpoint, ssl::context &ctx)
construct the client and bind a UDP socket to the given endpoint
client(udp::socket &&socket, ssl::context &ctx)
construct the client, taking ownership of a bound UDP socket
udp::endpoint local_endpoint() const
return the socket's locally-bound address/port
void connect(connection &conn, const udp::endpoint &endpoint, const char *hostname)
open a connection to the given remote endpoint and hostname. this initiates the TLS handshake,...
client(const executor_type &ex, const udp::endpoint &endpoint, ssl::context &ctx, const settings &s)
construct the client and bind a UDP socket to the given endpoint
void close(error_code &ec)
close the socket, along with any related connections
void close()
This is an overloaded member function, provided for convenience. It differs from the above function o...
client(udp::socket &&socket, ssl::context &ctx, const settings &s)
construct the client, taking ownership of a bound UDP socket
detail::engine_impl::executor_type executor_type
the polymorphic executor type, boost::asio::any_io_executor
Definition: client.hpp:21
executor_type get_executor() const
return the associated io executor
a generic QUIC connection that can initiate outgoing streams and accept incoming streams
Definition: connection.hpp:14
a generic bidirectional QUIC stream that meets the type requirements of asio's AsyncRead/WriteStream ...
Definition: stream.hpp:21
Generic QUIC library.
Definition: client.hpp:8
quic transport settings used to initialize a client or server
Definition: settings.hpp:16