RESTinio
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
restinio::impl Namespace Reference

Namespaces

 acceptor_details
 
 connection_settings_details
 

Classes

class  acceptor_t
 Context for accepting http connections. More...
 
class  buf_iface_t
 Internal interface for a trivial buffer-like entity. More...
 
class  connection_base_t
 HTTP connection base. More...
 
class  connection_factory_t
 Factory for connections. More...
 
struct  connection_input_t
 Data associated with connection read routine. More...
 
struct  connection_settings_t
 Parameters shared between connections. More...
 
class  connection_t
 Context for handling http connections. More...
 
class  const_buf_t
 Buffer entity for const buffer. More...
 
class  datasizeable_buf_t
 User defined datasizable object. More...
 
class  empty_buf_t
 Empty buffer entity. More...
 
class  executor_wrapper_t
 Wrapper for an executor (strand) used by connections. More...
 
class  external_io_context_for_thread_pool_t
 A class for holding a reference to external Asio's io_context. More...
 
class  fixed_buffer_t
 Helper class for reading bytes and feeding them to parser. More...
 
struct  http_parser_ctx_t
 Parsing result context for using in parser callbacks. More...
 
class  ioctx_on_thread_pool_t
 
class  own_io_context_for_thread_pool_t
 A class for holding actual instance of Asio's io_context. More...
 
class  response_context_t
 A context for a single response. More...
 
class  response_context_table_t
 Helper storage for responses' contexts. More...
 
class  response_coordinator_t
 Coordinator for process of sending responses with respect to http pipeline technique and chunk transfer. More...
 
class  restinio_err_category_t
 Error category for asio compatible error codes. More...
 
class  sendfile_operation_base_t
 Base class for storing sendfile operation context. More...
 
class  sendfile_operation_runner_base_t
 A base runner of sendfile operation (keeps all the data). More...
 
class  sendfile_operation_runner_t
 A runner of sendfile operation. More...
 
class  sendfile_operation_runner_t< asio_ns::ip::tcp::socket >
 A specialization for plain tcp-socket using linux sendfile() (http://man7.org/linux/man-pages/man2/sendfile.2.html). More...
 
struct  sendfile_write_operation_t
 Send file operation wrapper. More...
 
class  shared_datasizeable_buf_t
 Buffer based on shared_ptr of data-sizeable entity. More...
 
class  socket_supplier_t
 
class  socket_supplier_t< tls_socket_t >
 A custom socket storage for tls_socket_t. More...
 
class  tls_socket_t
 Socket adapter for asio::ssl::stream< asio::ip::tcp::socket >. More...
 
class  writable_base_t
 A base class for writable items. More...
 
class  write_group_output_ctx_t
 Helper class for writting response data. More...
 

Typedefs

using string_buf_t = datasizeable_buf_t< std::string >
 An alias for a std::string instantiation of datasizeable_buf_t<D> template. More...
 
using connection_handle_t = std::shared_ptr< connection_base_t >
 Alias for http connection handle. More...
 
template<typename Traits >
using connection_settings_handle_t = std::shared_ptr< connection_settings_t< Traits > >
 
using write_groups_container_t = std::vector< write_group_t >
 
using sendfile_operation_shared_ptr_t = std::shared_ptr< sendfile_operation_base_t >
 
using after_sendfile_cb_t = std::function< void(const asio_ns::error_code &, file_size_t) >
 Callback type for invokation when sendfile operation completes. More...
 
using asio_bufs_container_t = std::vector< asio_ns::const_buffer >
 

Enumerations

enum  connection_upgrade_stage_t : std::uint8_t { connection_upgrade_stage_t::none, connection_upgrade_stage_t::pending_upgrade_handling, connection_upgrade_stage_t::wait_for_upgrade_handling_result_or_nothing }
 Enum for a flag specifying that connection is going to upgrade or not. More...
 
enum  content_length_field_presence_t : std::uint8_t { content_length_field_presence_t::add_content_length, content_length_field_presence_t::skip_content_length }
 

Functions

template<typename C >
const C * to_lower_lut ()
 
constexpr auto uchar_at (const char *const from, const std::size_t at) noexcept
 
void append_last_field_accessor (http_header_fields_t &, string_view_t)
 
template<typename Io_Context_Holder , typename Traits >
void run (ioctx_on_thread_pool_t< Io_Context_Holder > &pool, run_on_thread_pool_settings_t< Traits > &&settings)
 An implementation of run-function for thread pool case. More...
 
template<typename Io_Context_Holder , typename Traits >
void run_with_break_signal_handling (ioctx_on_thread_pool_t< Io_Context_Holder > &pool, http_server_t< Traits > &server)
 An implementation of run-function for thread pool case with existing http_server instance. More...
 
template<typename Io_Context_Holder , typename Traits >
void run_without_break_signal_handling (ioctx_on_thread_pool_t< Io_Context_Holder > &pool, http_server_t< Traits > &server)
 An implementation of run-function for thread pool case with existing http_server instance. More...
 
int restinio_url_cb (http_parser *parser, const char *at, size_t length)
 Include parser callbacks. More...
 
int restinio_header_field_cb (http_parser *parser, const char *at, size_t length)
 
int restinio_header_value_cb (http_parser *parser, const char *at, size_t length)
 
int restinio_headers_complete_cb (http_parser *parser)
 
int restinio_body_cb (http_parser *parser, const char *at, size_t length)
 
template<typename Http_Methods >
int restinio_message_complete_cb (http_parser *parser)
 
template<typename Http_Methods >
http_parser_settings create_parser_settings () noexcept
 Helper for setting parser settings. More...
 
template<typename Connection , typename Start_Read_CB , typename Failed_CB >
void prepare_connection_and_start_read (asio_ns::ip::tcp::socket &, Connection &, Start_Read_CB start_read_cb, Failed_CB)
 
template<std::size_t N>
constexpr std::size_t ct_string_len (const char(&)[N]) noexcept
 Compile time c-string length. More...
 
std::size_t calculate_approx_buffer_size_for_header (const http_response_header_t &h) noexcept
 Calculate buffer size that is enough for serializing the buffer. More...
 
std::string create_header_string (const http_response_header_t &h, content_length_field_presence_t content_length_field_presence=content_length_field_presence_t::add_content_length, std::size_t buffer_size=0)
 Creates a string for http response header. More...
 
auto create_not_implemented_resp ()
 
auto create_timeout_resp ()
 
template<typename Error_Type >
auto make_error_code (const Error_Type &e)
 
connection_handle_taccess_req_connection (request_t &) noexcept
 
const char * modified_memchr (int chr, const char *from, const char *to)
 

Variables

constexpr std::size_t buffer_storage_align
 
constexpr std::size_t needed_storage_max_size
 An of memory that is to be enough to hold any possible buffer entity. More...
 

Typedef Documentation

◆ after_sendfile_cb_t

using restinio::impl::after_sendfile_cb_t = typedef std::function< void ( const asio_ns::error_code & , file_size_t ) >

Callback type for invokation when sendfile operation completes.

Definition at line 40 of file sendfile_operation.hpp.

◆ asio_bufs_container_t

using restinio::impl::asio_bufs_container_t = typedef std::vector< asio_ns::const_buffer >

Definition at line 26 of file write_group_output_ctx.hpp.

◆ connection_handle_t

using restinio::impl::connection_handle_t = typedef std::shared_ptr< connection_base_t >

Alias for http connection handle.

Definition at line 47 of file connection_base.hpp.

◆ connection_settings_handle_t

template<typename Traits >
using restinio::impl::connection_settings_handle_t = typedef std::shared_ptr< connection_settings_t< Traits > >

Definition at line 172 of file connection_settings.hpp.

◆ sendfile_operation_shared_ptr_t

Definition at line 36 of file sendfile_operation.hpp.

◆ string_buf_t

using restinio::impl::string_buf_t = typedef datasizeable_buf_t< std::string >

An alias for a std::string instantiation of datasizeable_buf_t<D> template.

Used to figure out buffer_storage_align and needed_storage_max_size constants.

Definition at line 239 of file buffers.hpp.

◆ write_groups_container_t

Definition at line 28 of file response_coordinator.hpp.

Enumeration Type Documentation

◆ connection_upgrade_stage_t

enum restinio::impl::connection_upgrade_stage_t : std::uint8_t
strong

Enum for a flag specifying that connection is going to upgrade or not.

Enumerator
none 

No connection request in progress.

pending_upgrade_handling 

Request with connection-upgrade header came and waits for request handler to be called in non pipelined fashion (it must be the only request that is handled at the moment).

wait_for_upgrade_handling_result_or_nothing 

Handler for request with connection-upgrade header was called so any response data comming is for that request. If connection transforms to websocket connection then no further operations are expected.

Definition at line 131 of file connection.hpp.

◆ content_length_field_presence_t

Enumerator
add_content_length 
skip_content_length 

Definition at line 33 of file header_helpers.hpp.

Function Documentation

◆ access_req_connection()

connection_handle_t & restinio::impl::access_req_connection ( request_t req)
inlinenoexcept

Definition at line 144 of file request_handler.hpp.

◆ append_last_field_accessor()

void restinio::impl::append_last_field_accessor ( http_header_fields_t fields,
string_view_t  value 
)
inline

Definition at line 57 of file connection.hpp.

◆ calculate_approx_buffer_size_for_header()

std::size_t restinio::impl::calculate_approx_buffer_size_for_header ( const http_response_header_t h)
inlinenoexcept

Calculate buffer size that is enough for serializing the buffer.

Definition at line 45 of file header_helpers.hpp.

◆ create_header_string()

std::string restinio::impl::create_header_string ( const http_response_header_t h,
content_length_field_presence_t  content_length_field_presence = content_length_field_presence_t::add_content_length,
std::size_t  buffer_size = 0 
)
inline

Creates a string for http response header.

Definition at line 68 of file header_helpers.hpp.

◆ create_not_implemented_resp()

auto restinio::impl::create_not_implemented_resp ( )
inline

Definition at line 156 of file header_helpers.hpp.

◆ create_parser_settings()

template<typename Http_Methods >
http_parser_settings restinio::impl::create_parser_settings ( )
inlinenoexcept

Helper for setting parser settings.

Is used to initialize const value in connection_settings_t ctor.

Definition at line 88 of file connection.hpp.

◆ create_timeout_resp()

auto restinio::impl::create_timeout_resp ( )
inline

Definition at line 170 of file header_helpers.hpp.

◆ ct_string_len()

template<std::size_t N>
constexpr std::size_t restinio::impl::ct_string_len ( const   char(&)[N])
inlinenoexcept

Compile time c-string length.

Definition at line 28 of file header_helpers.hpp.

◆ make_error_code()

template<typename Error_Type >
auto restinio::impl::make_error_code ( const Error_Type &  e)

Definition at line 88 of file sendfile_operation.hpp.

◆ modified_memchr()

const char* restinio::impl::modified_memchr ( int  chr,
const char *  from,
const char *  to 
)
inline

Definition at line 28 of file uri_helpers.hpp.

◆ prepare_connection_and_start_read()

template<typename Connection , typename Start_Read_CB , typename Failed_CB >
void restinio::impl::prepare_connection_and_start_read ( asio_ns::ip::tcp::socket &  ,
Connection &  ,
Start_Read_CB  start_read_cb,
Failed_CB   
)

Definition at line 188 of file connection.hpp.

◆ restinio_body_cb()

int restinio::impl::restinio_body_cb ( http_parser *  parser,
const char *  at,
size_t  length 
)
inline

Definition at line 118 of file connection.hpp.

◆ restinio_header_field_cb()

int restinio::impl::restinio_header_field_cb ( http_parser *  parser,
const char *  at,
size_t  length 
)
inline

Definition at line 30 of file connection.hpp.

◆ restinio_header_value_cb()

int restinio::impl::restinio_header_value_cb ( http_parser *  parser,
const char *  at,
size_t  length 
)
inline

Definition at line 63 of file connection.hpp.

◆ restinio_headers_complete_cb()

int restinio::impl::restinio_headers_complete_cb ( http_parser *  parser)
inline

Definition at line 92 of file connection.hpp.

◆ restinio_message_complete_cb()

template<typename Http_Methods >
int restinio::impl::restinio_message_complete_cb ( http_parser *  parser)

Definition at line 138 of file connection.hpp.

◆ restinio_url_cb()

int restinio::impl::restinio_url_cb ( http_parser *  parser,
const char *  at,
size_t  length 
)
inline

Include parser callbacks.

Callbacks used with http parser.

Definition at line 11 of file connection.hpp.

◆ run()

template<typename Io_Context_Holder , typename Traits >
void restinio::impl::run ( ioctx_on_thread_pool_t< Io_Context_Holder > &  pool,
run_on_thread_pool_settings_t< Traits > &&  settings 
)

An implementation of run-function for thread pool case.

This function receives an already created thread pool object and creates and runs http-server on this thread pool.

Since
v.0.4.2

Definition at line 291 of file http_server_run.hpp.

◆ run_with_break_signal_handling()

template<typename Io_Context_Holder , typename Traits >
void restinio::impl::run_with_break_signal_handling ( ioctx_on_thread_pool_t< Io_Context_Holder > &  pool,
http_server_t< Traits > &  server 
)

An implementation of run-function for thread pool case with existing http_server instance.

This function receives an already created thread pool object and already created http-server and run it on this thread pool.

Attention
This function installs break signal handler and stops server when break signal is raised.
Since
v.0.5.1

Definition at line 496 of file http_server_run.hpp.

◆ run_without_break_signal_handling()

template<typename Io_Context_Holder , typename Traits >
void restinio::impl::run_without_break_signal_handling ( ioctx_on_thread_pool_t< Io_Context_Holder > &  pool,
http_server_t< Traits > &  server 
)

An implementation of run-function for thread pool case with existing http_server instance.

This function receives an already created thread pool object and already created http-server and run it on this thread pool.

Note
This function doesn't install break signal handlers.
Since
v.0.5.1

Definition at line 541 of file http_server_run.hpp.

◆ to_lower_lut()

template<typename C >
const C* restinio::impl::to_lower_lut ( )

Definition at line 3 of file http_headers.hpp.

◆ uchar_at()

constexpr auto restinio::impl::uchar_at ( const char *const  from,
const std::size_t  at 
)
noexcept

Definition at line 35 of file http_headers.hpp.

Variable Documentation

◆ buffer_storage_align

constexpr std::size_t restinio::impl::buffer_storage_align
Initial value:
=
std::max< std::size_t >( {
alignof( empty_buf_t ),
alignof( const_buf_t ),
alignof( string_buf_t ),
alignof( shared_datasizeable_buf_t< std::string > ),
alignof( sendfile_write_operation_t ) } )
datasizeable_buf_t< std::string > string_buf_t
An alias for a std::string instantiation of datasizeable_buf_t<D> template.
Definition: buffers.hpp:239

Definition at line 350 of file buffers.hpp.

◆ needed_storage_max_size

constexpr std::size_t restinio::impl::needed_storage_max_size
Initial value:
=
std::max< std::size_t >( {
sizeof( empty_buf_t ),
sizeof( const_buf_t ),
sizeof( string_buf_t ),
sizeof( shared_datasizeable_buf_t< std::string > ),
sizeof( sendfile_write_operation_t ) } )
datasizeable_buf_t< std::string > string_buf_t
An alias for a std::string instantiation of datasizeable_buf_t<D> template.
Definition: buffers.hpp:239

An of memory that is to be enough to hold any possible buffer entity.

Definition at line 359 of file buffers.hpp.