Nexus HTTP/3
A QUIC and HTTP/3 library
stream.hpp
1 #pragma once
2 
3 #include <nexus/quic/stream.hpp>
4 #include <nexus/h3/fields.hpp>
5 
6 namespace nexus::h3 {
7 
8 class client_connection;
9 class server_connection;
10 
14 class stream : public quic::stream {
15  friend class client_connection;
16  friend class server_connection;
17  using quic::stream::stream;
18  public:
20  explicit stream(client_connection& conn);
21 
23  explicit stream(server_connection& conn);
24 
26  template <typename CompletionToken> // void(error_code)
27  decltype(auto) async_read_headers(fields& f, CompletionToken&& token) {
28  return impl.async_read_headers(f, std::forward<CompletionToken>(token));
29  }
30 
32  void read_headers(fields& f, error_code& ec);
34  void read_headers(fields& f);
35 
37  template <typename CompletionToken> // void(error_code)
38  decltype(auto) async_write_headers(const fields& f, CompletionToken&& token) {
39  return impl.async_write_headers(f, std::forward<CompletionToken>(token));
40  }
41 
43  void write_headers(const fields& f, error_code& ec);
45  void write_headers(const fields& f);
46 };
47 
48 } // namespace nexus::h3
an HTTP/3 connection that can initiate outgoing streams and accept server-pushed streams
Definition: client.hpp:57
an ordered list of headers for an http request or response. all field name comparisons are case-insen...
Definition: fields.hpp:130
an HTTP/3 connection that can accept incoming streams and push associated outgoing streams
Definition: server.hpp:83
a bidirectional HTTP/3 stream that can send and receive HTTP headers, and meets the type requirements...
Definition: stream.hpp:14
void read_headers(fields &f)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void read_headers(fields &f, error_code &ec)
read headers from the stream
void write_headers(const fields &f)
This is an overloaded member function, provided for convenience. It differs from the above function o...
stream(server_connection &conn)
construct a stream associated with the given server connection
stream(client_connection &conn)
construct a stream associated with the given client connection
decltype(auto) async_write_headers(const fields &f, CompletionToken &&token)
write headers to the stream
Definition: stream.hpp:38
decltype(auto) async_read_headers(fields &f, CompletionToken &&token)
read headers from the stream
Definition: stream.hpp:27
void write_headers(const fields &f, error_code &ec)
write headers to the stream
a generic bidirectional QUIC stream that meets the type requirements of asio's AsyncRead/WriteStream ...
Definition: stream.hpp:21
HTTP/3 library.
Definition: client.hpp:6