RESTinio

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

## Namespaces
namespace | acceptor_details
namespace | connection_settings_details
namespace | overflow_controlled_integer_accumulator_details
namespace | string_caseless_compare_details

## Classes
class | acceptor_t
| Context for accepting http connections. More...
class | buf_iface_t
| Internal interface for a trivial buffer-like entity. More...
struct | check_negative_extremum
struct | check_positive_extremum
struct | chunked_input_info_block_t
| Bunch of data related to chunked input. 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...
class | generic_request_extra_data_holder_t
| Helper class for holding a buffer for extra-data object to be incorporated into a request object. More...
struct | http_parser_ctx_t
| Parsing result context for using in parser callbacks. More...
class | ioctx_on_thread_pool_t
class | overflow_controlled_integer_accumulator_t
| Helper class for accumulating integer value during parsing it from string (with check for overflow). More...
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 | fmt_minimal_memory_buffer_buf_t = datasizeable_buf_t< fmt_minimal_memory_buffer_t >
| An alias for a fmt_minimal_memory_buffer_t 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 invocation when sendfile operation completes. More...
using | asio_bufs_container_t = std::vector< asio_ns::const_buffer >

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

## Functions
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...
template<typename Http_Methods >
http_parser_settings | create_parser_settings () noexcept
| Include parser callbacks. 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)
tls_socket_t * | make_tls_socket_pointer_for_state_listener (asio_ns::ip::tcp::socket &) noexcept
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) noexcept
bool | is_equal_caseless (const char *a, const char *b, std::size_t size) noexcept
| Comparator for fields names. More...
bool | is_equal_caseless (const char *a, std::size_t a_size, const char *b, std::size_t b_size) noexcept
| Comparator for fields names. More...
bool | is_equal_caseless (string_view_t a, string_view_t b) noexcept
| Comparator for fields names. More...
template<typename C >
RESTINIO_NODISCARD const C * | to_lower_lut ()
RESTINIO_NODISCARD char | to_lower_case (char ch)
RESTINIO_NODISCARD char | to_lower_case (unsigned char ch)
template<typename Extra_Data >
connection_handle_t & | access_req_connection (generic_request_t< Extra_Data > &) noexcept
tls_socket_t * | make_tls_socket_pointer_for_state_listener (tls_socket_t &socket) 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 invocation when sendfile operation completes.

Definition at line 39 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 28 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 234 of file connection_settings.hpp.

## ◆ fmt_minimal_memory_buffer_buf_t

using restinio::impl::fmt_minimal_memory_buffer_buf_t = typedef datasizeable_buf_t< fmt_minimal_memory_buffer_t >

An alias for a fmt_minimal_memory_buffer_t instantiation of datasizeable_buf_t<D> template.

Used to figure out buffer_storage_align and needed_storage_max_size constants.

Definition at line 263 of file buffers.hpp.

## ◆ sendfile_operation_shared_ptr_t

using restinio::impl::sendfile_operation_shared_ptr_t = typedef std::shared_ptr< sendfile_operation_base_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 256 of file buffers.hpp.

## ◆ write_groups_container_t

using restinio::impl::write_groups_container_t = typedef std::vector< write_group_t >

Definition at line 30 of file response_coordinator.hpp.

## Enumeration Type Documentation

## ◆ connection_upgrade_stage_t

enum class 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 205 of file connection.hpp.

## ◆ content_length_field_presence_t

enum class restinio::impl::content_length_field_presence_t : std::uint8_t
| strong

Enumerator
add_content_length |
skip_content_length |

Definition at line 33 of file header_helpers.hpp.

## Function Documentation

## ◆ access_req_connection()

template<typename Extra_Data >

connection_handle_t & restinio::impl::access_req_connection | ( | generic_request_t< Extra_Data > & | req | ) |
| noexcept

Definition at line 477 of file request_handler.hpp.

## ◆ append_last_field_accessor()

void restinio::impl::append_last_field_accessor | ( | http_header_fields_t & | ,
|  | string_view_t |
| ) |  |

## ◆ calculate_approx_buffer_size_for_header()

std::size_t restinio::impl::calculate_approx_buffer_size_for_header | ( | const http_response_header_t & | h | ) |
| inline noexcept

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 | ( |  | ) |
| inline noexcept

Include parser callbacks.

Helper for setting parser settings.

Is used to initialize const value in connection_settings_t ctor.

Definition at line 152 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] | ) |
| inline constexpr noexcept

Compile time c-string length.

Definition at line 28 of file header_helpers.hpp.

## ◆ is_equal_caseless() [1/3]

bool restinio::impl::is_equal_caseless | ( | const char * | a,
|  | const char * | b,
|  | std::size_t | size
| ) |  |
| inline noexcept

Comparator for fields names.

Definition at line 40 of file string_caseless_compare.hpp.

## ◆ is_equal_caseless() [2/3]

bool restinio::impl::is_equal_caseless | ( | const char * | a,
|  | std::size_t | a_size,
|  | const char * | b,
|  | std::size_t | b_size
| ) |  |
| inline noexcept

Comparator for fields names.

Definition at line 62 of file string_caseless_compare.hpp.

## ◆ is_equal_caseless() [3/3]

bool restinio::impl::is_equal_caseless | ( | string_view_t | a,
|  | string_view_t | b
| ) |  |
| inline noexcept

Comparator for fields names.

Definition at line 82 of file string_caseless_compare.hpp.

## ◆ make_error_code()

template<typename Error_Type >

auto restinio::impl::make_error_code | ( | const Error_Type & | e | ) |
| noexcept

Definition at line 88 of file sendfile_operation.hpp.

## ◆ make_tls_socket_pointer_for_state_listener() [1/2]

tls_socket_t * restinio::impl::make_tls_socket_pointer_for_state_listener | ( | asio_ns::ip::tcp::socket & |  | ) |
| inline noexcept

Definition at line 277 of file connection.hpp.

## ◆ make_tls_socket_pointer_for_state_listener() [2/2]

tls_socket_t * restinio::impl::make_tls_socket_pointer_for_state_listener | ( | tls_socket_t & | socket | ) |
| inline noexcept

Definition at line 341 of file tls.hpp.

## ◆ modified_memchr()

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

Definition at line 27 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 265 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 303 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 520 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 577 of file http_server_run.hpp.

## ◆ to_lower_case() [1/2]

RESTINIO_NODISCARD char restinio::impl::to_lower_case | ( | char | ch | ) |
| inline

Definition at line 39 of file to_lower_lut.hpp.

## ◆ to_lower_case() [2/2]

RESTINIO_NODISCARD char restinio::impl::to_lower_case | ( | unsigned char | ch | ) |
| inline

Definition at line 48 of file to_lower_lut.hpp.

## ◆ to_lower_lut()

template<typename C >

RESTINIO_NODISCARD const C * restinio::impl::to_lower_lut | ( |  | ) |

Definition at line 13 of file to_lower_lut.hpp.

## Variable Documentation

## ◆ buffer_storage_align

constexpr std::size_t restinio::impl::buffer_storage_align
| constexpr

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 ),
alignof( fmt_minimal_memory_buffer_buf_t ) } )
restinio::impl::const_buf_t
Buffer entity for const buffer.
Definition: buffers.hpp:131
restinio::impl::datasizeable_buf_t
User defined datasizable object.
Definition: buffers.hpp:189
restinio::impl::empty_buf_t
Empty buffer entity.
Definition: buffers.hpp:92
restinio::impl::shared_datasizeable_buf_t
Buffer based on shared_ptr of data-sizeable entity.
Definition: buffers.hpp:273
restinio::impl::string_buf_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:256
restinio::impl::sendfile_write_operation_t
Send file operation wrapper.
Definition: buffers.hpp:326

Definition at line 378 of file buffers.hpp.

## ◆ needed_storage_max_size

constexpr std::size_t restinio::impl::needed_storage_max_size
| constexpr

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 ),
sizeof( fmt_minimal_memory_buffer_buf_t ) } )

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

Definition at line 388 of file buffers.hpp.