RESTinio

settings.hpp
Go to the documentation of this file.
1/*
2 restinio
3*/
4
9#pragma once
10
11#include <restinio/asio_include.hpp>
12
13#include <restinio/exception.hpp>
14#include <restinio/request_handler.hpp>
15#include <restinio/traits.hpp>
16
17#include <restinio/incoming_http_msg_limits.hpp>
18
19#include <restinio/variant.hpp>
20
21#include <chrono>
22#include <tuple>
23#include <utility>
24
25 namespace restinio
26{
27
28 namespace details
29{
30
32 template < typename Object >
33 inline auto
34 create_default_unique_object_instance( std::false_type )
35{
36 return std::unique_ptr< Object >{};
37}
38
39 template < typename Object >
40 inline auto
41 create_default_unique_object_instance( std::true_type )
42{
43 return std::make_unique< Object >();
44}
45
47 template < typename Object >
48 inline auto
49 create_default_shared_object_instance( std::false_type )
50{
51 return std::shared_ptr< Object >{};
52}
53
54 template < typename Object >
55 inline auto
56 create_default_shared_object_instance( std::true_type )
57{
58 return std::make_shared< Object >();
59}
60
61} /* namespace details */
62
63//
64// create_default_unique_object_instance
65//
66
68 template < typename Object>
69 inline auto
70 create_default_unique_object_instance()
71{
72 typename std::is_default_constructible< Object >::type tag;
73 return details::create_default_unique_object_instance< Object >( tag );
74}
75
77 template <>
78 inline auto
79 create_default_unique_object_instance< default_request_handler_t >()
80{
81 return details::create_default_unique_object_instance< default_request_handler_t >(
82 std::false_type{} );
83}
84
85//
86// create_default_shared_object_instance
87//
88
90 template < typename Object>
91 inline auto
92 create_default_shared_object_instance()
93{
94 typename std::is_default_constructible< Object >::type tag;
95 return details::create_default_shared_object_instance< Object >( tag );
96}
97
99 template <>
100 inline auto
101 create_default_shared_object_instance< default_request_handler_t >()
102{
103 return details::create_default_shared_object_instance< default_request_handler_t >(
104 std::false_type{} );
105}
106
107//
108// ensure_created()
109//
110
112 template < typename Object >
113 auto
114 ensure_created(
115 std::unique_ptr< Object > mb_created_one,
116 string_view_t fail_description )
117{
118 if( !mb_created_one )
119 mb_created_one = create_default_unique_object_instance< Object >();
120
121 if( !mb_created_one )
122 throw exception_t{ fail_description };
123
124 return mb_created_one;
125}
126
127//
128// unsure_created()
129//
130
132 template < typename Object >
133 auto
134 ensure_created(
135 std::shared_ptr< Object > mb_created_one,
136 string_view_t fail_description )
137{
138 if( !mb_created_one )
139 mb_created_one = create_default_shared_object_instance< Object >();
140
141 if( !mb_created_one )
142 throw exception_t{ fail_description };
143
144 return mb_created_one;
145}
146
147
148//
149// socket_type_dependent_settings_t
150//
151
153 template < typename Settings, typename Socket >
154 class socket_type_dependent_settings_t
155{
156protected :
157 ~socket_type_dependent_settings_t() noexcept = default;
158
159public :
160 socket_type_dependent_settings_t() noexcept = default;
161
162 socket_type_dependent_settings_t(const socket_type_dependent_settings_t &) noexcept = default;
163 socket_type_dependent_settings_t(socket_type_dependent_settings_t &&) noexcept = default;
164
165 socket_type_dependent_settings_t &
166 operator=(const socket_type_dependent_settings_t &) noexcept = default;
167
168 socket_type_dependent_settings_t &
169 operator=(socket_type_dependent_settings_t &&) noexcept = delete;
170
171 // No extra settings by default.
172};
173
174//
175// acceptor_options_t
176//
177
179
184class acceptor_options_t
185{
186 public:
187 acceptor_options_t( asio_ns::ip::tcp::acceptor & acceptor )
188 : m_acceptor{ acceptor }
189 {}
190
193 template< typename Option >
194 void
195 set_option( const Option & option )
196 {
197 m_acceptor.set_option( option );
198 }
199
200 template< typename Option >
201 void
202 set_option( const Option & option, asio_ns::error_code & ec )
203 {
204 m_acceptor.set_option( option, ec );
205 }
206
207 template< typename Option >
208 void
209 get_option( Option & option )
210 {
211 m_acceptor.get_option( option );
212 }
213
214 template< typename Option >
215 void
216 get_option( Option & option, asio_ns::error_code & ec )
217 {
218 m_acceptor.get_option( option, ec );
219 }
221
222 private:
223 asio_ns::ip::tcp::acceptor & m_acceptor;
224};
225
226 using acceptor_options_setter_t = std::function< void ( acceptor_options_t & ) >;
227
228 template <>
229 inline auto
230 create_default_unique_object_instance< acceptor_options_setter_t >()
231{
232 return std::make_unique< acceptor_options_setter_t >(
233 []( acceptor_options_t & options ){
234 options.set_option( asio_ns::ip::tcp::acceptor::reuse_address( true ) );
235 } );
236}
237
238//
239// socket_options_t
240//
241
243
248 class socket_options_t
249{
250 public:
251 socket_options_t(
253 asio_ns::basic_socket< asio_ns::ip::tcp > & socket )
254 : m_socket{ socket }
255 {}
256
259 template< typename Option >
260 void
261 set_option( const Option & option )
262 {
263 m_socket.set_option( option );
264 }
265
266 template< typename Option >
267 void
268 set_option( const Option & option, asio_ns::error_code & ec )
269 {
270 m_socket.set_option( option, ec );
271 }
272
273 template< typename Option >
274 void
275 get_option( Option & option )
276 {
277 m_socket.get_option( option );
278 }
279
280 template< typename Option >
281 void
282 get_option( Option & option, asio_ns::error_code & ec )
283 {
284 m_socket.get_option( option, ec );
285 }
287
288 private:
290 asio_ns::basic_socket< asio_ns::ip::tcp > & m_socket;
291};
292
293 using socket_options_setter_t = std::function< void ( socket_options_t & ) >;
294
295 template <>
296 inline auto
297 create_default_unique_object_instance< socket_options_setter_t >()
298{
299 return std::make_unique< socket_options_setter_t >( []( auto & ){} );
300}
301
302//
303// cleanup_functor_t
304//
308 using cleanup_functor_t = std::function< void(void) >;
309
310//
311// connection_state_listener_holder_t
312//
322 template< typename Listener >
323 struct connection_state_listener_holder_t
324{
325 std::shared_ptr< Listener > m_connection_state_listener;
326
327 static constexpr bool has_actual_connection_state_listener = true;
328
330
333 void
334 check_valid_connection_state_listener_pointer() const
335 {
336 if( !m_connection_state_listener )
337 throw exception_t{ "connection state listener is not specified" };
338 }
339};
340
349 template<>
350 struct connection_state_listener_holder_t< connection_state::noop_listener_t >
351{
352 static constexpr bool has_actual_connection_state_listener = false;
353
354 void
355 check_valid_connection_state_listener_pointer() const
356 {
357 // Nothing to do.
358 }
359};
360
361//
362// ip_blocker_holder_t
363//
373 template< typename Ip_Blocker >
374 struct ip_blocker_holder_t
375{
376 static_assert(
377 noexcept( std::declval<Ip_Blocker>().inspect(
378 std::declval<ip_blocker::incoming_info_t>() ) ),
379 "Ip_Blocker::inspect() method should be noexcept" );
380
381 static_assert(
382 std::is_same<
383 restinio::ip_blocker::inspection_result_t,
384 decltype(std::declval<Ip_Blocker>().inspect(
385 std::declval<ip_blocker::incoming_info_t>())) >::value,
386 "Ip_Blocker::inspect() should return "
387 "restinio::ip_blocker::inspection_result_t" );
388
389 std::shared_ptr< Ip_Blocker > m_ip_blocker;
390
391 static constexpr bool has_actual_ip_blocker = true;
392
394
397 void
398 check_valid_ip_blocker_pointer() const
399 {
400 if( !m_ip_blocker )
401 throw exception_t{ "IP-blocker is not specified" };
402 }
403};
404
413 template<>
414 struct ip_blocker_holder_t< ip_blocker::noop_ip_blocker_t >
415{
416 static constexpr bool has_actual_ip_blocker = false;
417
418 void
419 check_valid_ip_blocker_pointer() const
420 {
421 // Nothing to do.
422 }
423};
424
425//
426// acceptor_post_bind_hook_t
427//
434 using acceptor_post_bind_hook_t = std::function<
435 void(asio_ns::ip::tcp::acceptor &) >;
436
437 namespace details
438{
439
440//
441// no_address_specified_t
442//
449 struct no_address_specified_t {};
450
451//
452// address_variant_t
453//
460 using address_variant_t = variant_t<
461 no_address_specified_t,
462 std::string,
463 asio_ns::ip::address >;
464
465//
466// max_parallel_connections_holder_t
467//
480 template< typename Count_Limiter >
481 struct max_parallel_connections_holder_t
482{
483 static constexpr bool has_actual_max_parallel_connections = true;
484
490 std::size_t m_max_parallel_connections{
491 std::numeric_limits<std::size_t>::max()
492 };
493
494 std::size_t
495 max_parallel_connections() const noexcept
496 {
497 return m_max_parallel_connections;
498 }
499
500 void
501 set_max_parallel_connections( std::size_t v ) noexcept
502 {
503 m_max_parallel_connections = v;
504 }
505};
506
518 template<>
519 struct max_parallel_connections_holder_t<
520 ::restinio::connection_count_limits::noop_connection_count_limiter_t >
521{
522 static constexpr bool has_actual_max_parallel_connections = false;
523
524 std::size_t
525 max_parallel_connections() const noexcept
526 {
527 return std::numeric_limits<std::size_t>::max();
528 }
529};
530
531} /* namespace details */
532
533//
534// basic_server_settings_t
535//
536
538
548 template<typename Derived, typename Traits>
549 class basic_server_settings_t
550 : public socket_type_dependent_settings_t< Derived, typename Traits::stream_socket_t >
551 , protected connection_state_listener_holder_t<
552 typename Traits::connection_state_listener_t >
553 , protected ip_blocker_holder_t< typename Traits::ip_blocker_t >
554 , protected details::max_parallel_connections_holder_t<
555 typename connection_count_limit_types<Traits>::limiter_t >
556{
557 using base_type_t = socket_type_dependent_settings_t<
558 Derived, typename Traits::stream_socket_t>;
559
560 using max_parallel_connections_holder_base_t =
561 details::max_parallel_connections_holder_t<
562 typename connection_count_limit_types<Traits>::limiter_t >;
563
564 using connection_state_listener_holder_t<
565 typename Traits::connection_state_listener_t
566 >::has_actual_connection_state_listener;
567
568 using ip_blocker_holder_t<
569 typename Traits::ip_blocker_t
570 >::has_actual_ip_blocker;
571
572 using max_parallel_connections_holder_base_t::has_actual_max_parallel_connections;
573
574 public:
575 basic_server_settings_t(
576 std::uint16_t port = 8080,
577 asio_ns::ip::tcp protocol = asio_ns::ip::tcp::v4() )
578 : base_type_t{}
579 , m_port{ port }
580 , m_protocol{ protocol }
581 {}
582
585 Derived &
586 port( std::uint16_t p ) &
587 {
588 m_port = p;
589 return reference_to_derived();
590 }
591
592 Derived &&
593 port( std::uint16_t p ) &&
594 {
595 return std::move( this->port( p ) );
596 }
597
598 RESTINIO_NODISCARD
599 std::uint16_t
600 port() const
601 {
602 return m_port;
603 }
604
605 Derived &
606 protocol( asio_ns::ip::tcp p ) &
607 {
608 m_protocol = p;
609 return reference_to_derived();
610 }
611
612 Derived &&
613 protocol( asio_ns::ip::tcp p ) &&
614 {
615 return std::move( this->protocol( p ) );
616 }
617
618 RESTINIO_NODISCARD
619 asio_ns::ip::tcp
620 protocol() const
621 {
622 return m_protocol;
623 }
624
642 Derived &
643 address( std::string addr ) &
644 {
645 m_address = std::move(addr);
646 return reference_to_derived();
647 }
648
662 Derived &&
663 address( std::string addr ) &&
664 {
665 return std::move( this->address( std::move( addr ) ) );
666 }
667
687 Derived &
688 address( asio_ns::ip::address addr ) &
689 {
690 m_address = addr;
691 return reference_to_derived();
692 }
693
709 Derived &&
710 address( asio_ns::ip::address addr ) &&
711 {
712 return std::move( this->address( addr ) );
713 }
714
715 RESTINIO_NODISCARD
716 const details::address_variant_t &
717 address() const
718 {
719 return m_address;
720 }
722
724
729 Derived &
730 buffer_size( std::size_t s ) &
731 {
732 m_buffer_size = s;
733 return reference_to_derived();
734 }
735
736 Derived &&
737 buffer_size( std::size_t s ) &&
738 {
739 return std::move( this->buffer_size( s ) );
740 }
741
742 std::size_t
743 buffer_size() const
744 {
745 return m_buffer_size;
746 }
748
752
756 Derived &
757 read_next_http_message_timelimit( std::chrono::steady_clock::duration d ) &
758 {
759 m_read_next_http_message_timelimit = std::move( d );
760 return reference_to_derived();
761 }
762
763 Derived &&
764 read_next_http_message_timelimit( std::chrono::steady_clock::duration d ) &&
765 {
766 return std::move( this->read_next_http_message_timelimit( std::move( d ) ) );
767 }
768
769 std::chrono::steady_clock::duration
770 read_next_http_message_timelimit() const
771 {
772 return m_read_next_http_message_timelimit;
773 }
775
778 Derived &
779 write_http_response_timelimit( std::chrono::steady_clock::duration d ) &
780 {
781 m_write_http_response_timelimit = std::move( d );
782 return reference_to_derived();
783 }
784
785 Derived &&
786 write_http_response_timelimit( std::chrono::steady_clock::duration d ) &&
787 {
788 return std::move( this->write_http_response_timelimit( std::move( d ) ) );
789 }
790
791 std::chrono::steady_clock::duration
792 write_http_response_timelimit() const
793 {
794 return m_write_http_response_timelimit;
795 }
797
800 Derived &
801 handle_request_timeout( std::chrono::steady_clock::duration d ) &
802 {
803 m_handle_request_timeout = std::move( d );
804 return reference_to_derived();
805 }
806
807 Derived &&
808 handle_request_timeout( std::chrono::steady_clock::duration d ) &&
809 {
810 return std::move( this->handle_request_timeout( std::move( d ) ) );
811 }
812
813 std::chrono::steady_clock::duration
814 handle_request_timeout() const
815 {
816 return m_handle_request_timeout;
817 }
819
822 Derived &
823 max_pipelined_requests( std::size_t mpr ) &
824 {
825 m_max_pipelined_requests = mpr;
826 return reference_to_derived();
827 }
828
829 Derived &&
830 max_pipelined_requests( std::size_t mpr ) &&
831 {
832 return std::move( this->max_pipelined_requests( mpr ) );
833 }
834
835 std::size_t
836 max_pipelined_requests() const
837 {
838 return m_max_pipelined_requests;
839 }
841
842
845 using request_handler_t = request_handler_type_from_traits_t< Traits >;
846
847 Derived &
848 request_handler( std::unique_ptr< request_handler_t > handler ) &
849 {
850 m_request_handler = std::move( handler );
851 return reference_to_derived();
852 }
853
854 template< typename... Params >
855 Derived &
856 request_handler( Params &&... params ) &
857 {
858 return set_unique_instance(
859 m_request_handler,
860 std::forward< Params >( params )... );
861 }
862
863
864 template< typename... Params >
865 Derived &&
866 request_handler( Params &&... params ) &&
867 {
868 return std::move( this->request_handler( std::forward< Params >( params )... ) );
869 }
870
871 std::unique_ptr< request_handler_t >
872 request_handler()
873 {
874 return ensure_created(
875 std::move( m_request_handler ),
876 "request handler must be set" );
877 }
879
880
883 using timer_manager_t = typename Traits::timer_manager_t;
884 using timer_factory_t = typename timer_manager_t::factory_t;
885
886 template< typename... Params >
887 Derived &
888 timer_manager( Params &&... params ) &
889 {
890 return set_unique_instance(
891 m_timer_factory,
892 std::forward< Params >( params )... );
893 }
894
895 template< typename... Params >
896 Derived &&
897 timer_manager( Params &&... params ) &&
898 {
899 return std::move( this->timer_manager( std::forward< Params >( params )... ) );
900 }
901
902 std::unique_ptr< timer_factory_t >
903 timer_factory()
904 {
905 return ensure_created(
906 std::move( m_timer_factory ),
907 "timer manager is not set" );
908 }
910
913 using logger_t = typename Traits::logger_t;
914
915 template< typename... Params >
916 Derived &
917 logger( Params &&... params ) &
918 {
919 return set_unique_instance(
920 m_logger,
921 std::forward< Params >( params )... );
922 }
923
924 template< typename... Params >
925 Derived &&
926 logger( Params &&... params ) &&
927 {
928 return std::move( this->logger( std::forward< Params >( params )... ) );
929 }
930
931 std::unique_ptr< logger_t >
932 logger()
933 {
934 return ensure_created(
935 std::move( m_logger ),
936 "logger must be set" );
937 }
939
942 Derived &
943 acceptor_options_setter( acceptor_options_setter_t aos ) &
944 {
945 if( !aos )
946 throw exception_t{ "acceptor options setter cannot be empty" };
947
948 return set_unique_instance(
949 m_acceptor_options_setter,
950 std::move( aos ) );
951 }
952
953 Derived &&
954 acceptor_options_setter( acceptor_options_setter_t aos ) &&
955 {
956 return std::move( this->acceptor_options_setter( std::move( aos ) ) );
957 }
958
959 std::unique_ptr< acceptor_options_setter_t >
960 acceptor_options_setter()
961 {
962 return ensure_created(
963 std::move( m_acceptor_options_setter ),
964 "acceptor options setter must be set" );
965 }
967
970 Derived &
971 socket_options_setter( socket_options_setter_t sos ) &
972 {
973 if( !sos )
974 throw exception_t{ "socket options setter cannot be empty" };
975
976 return set_unique_instance(
977 m_socket_options_setter,
978 std::move( sos ) );
979 }
980
981 Derived &&
982 socket_options_setter( socket_options_setter_t sos ) &&
983 {
984 return std::move( this->socket_options_setter( std::move( sos ) ) );
985 }
986
987 std::unique_ptr< socket_options_setter_t >
988 socket_options_setter()
989 {
990 return ensure_created(
991 std::move( m_socket_options_setter ),
992 "socket options setter must be set" );
993 }
995
997
1002 Derived &
1003 concurrent_accepts_count( std::size_t n ) &
1004 {
1005 if( 0 == n || 1024 < n )
1006 throw exception_t{
1007 fmt::format(
1008 "invalid value for number of cuncurrent connects: {}",
1009 n ) };
1010
1011 m_concurrent_accepts_count = n;
1012 return reference_to_derived();
1013 }
1014
1015 Derived &&
1016 concurrent_accepts_count( std::size_t n ) &&
1017 {
1018 return std::move( this->concurrent_accepts_count( n ) );
1019 }
1020
1021 std::size_t
1022 concurrent_accepts_count() const
1023 {
1024 return m_concurrent_accepts_count;
1025 }
1027
1029
1038 Derived &
1039 separate_accept_and_create_connect( bool do_separate ) & noexcept
1040 {
1041 m_separate_accept_and_create_connect = do_separate;
1042 return reference_to_derived();
1043 }
1044
1045 Derived &&
1046 separate_accept_and_create_connect( bool do_separate ) && noexcept
1047 {
1048 return std::move( this->separate_accept_and_create_connect( do_separate ) );
1049 }
1050
1051 bool
1052 separate_accept_and_create_connect() const noexcept
1053 {
1054 return m_separate_accept_and_create_connect;
1055 }
1057
1060 template< typename Func >
1061 Derived &
1062 cleanup_func( Func && func ) &
1063 {
1064 m_cleanup_functor = std::move(func);
1065 return reference_to_derived();
1066 }
1067
1068 template< typename Func >
1069 Derived &&
1070 cleanup_func( Func && func ) &&
1071 {
1072 return std::move(this->cleanup_func( std::forward<Func>(func) ));
1073 }
1074
1081 RESTINIO_NODISCARD
1082 cleanup_functor_t
1083 giveaway_cleanup_func()
1084 {
1085 return std::move(m_cleanup_functor);
1086 }
1088
1119 Derived &
1120 connection_state_listener(
1121 std::shared_ptr< typename Traits::connection_state_listener_t > listener ) &
1122 {
1123 static_assert(
1124 has_actual_connection_state_listener,
1125 "connection_state_listener(listener) can't be used "
1126 "for the default connection_state::noop_listener_t" );
1127
1128 this->m_connection_state_listener = std::move(listener);
1129 return reference_to_derived();
1130 }
1131
1163 Derived &&
1164 connection_state_listener(
1165 std::shared_ptr< typename Traits::connection_state_listener_t > listener ) &&
1166 {
1167 return std::move(this->connection_state_listener(
1168 std::move(listener)));
1169 }
1170
1179 const std::shared_ptr< typename Traits::connection_state_listener_t > &
1180 connection_state_listener() const noexcept
1181 {
1182 static_assert(
1183 has_actual_connection_state_listener,
1184 "connection_state_listener() can't be used "
1185 "for the default connection_state::noop_listener_t" );
1186
1187 return this->m_connection_state_listener;
1188 }
1189
1199 void
1200 ensure_valid_connection_state_listener()
1201 {
1202 this->check_valid_connection_state_listener_pointer();
1203 }
1204
1236 Derived &
1237 ip_blocker(
1238 std::shared_ptr< typename Traits::ip_blocker_t > blocker ) &
1239 {
1240 static_assert(
1241 basic_server_settings_t::has_actual_ip_blocker,
1242 "ip_blocker(blocker) can't be used "
1243 "for the default ip_blocker::noop_ip_blocker_t" );
1244
1245 this->m_ip_blocker = std::move(blocker);
1246 return reference_to_derived();
1247 }
1248
1281 Derived &&
1282 ip_blocker(
1283 std::shared_ptr< typename Traits::ip_blocker_t > blocker ) &&
1284 {
1285 return std::move(this->ip_blocker(std::move(blocker)));
1286 }
1287
1296 const std::shared_ptr< typename Traits::ip_blocker_t > &
1297 ip_blocker() const noexcept
1298 {
1299 static_assert(
1300 basic_server_settings_t::has_actual_ip_blocker,
1301 "ip_blocker() can't be used "
1302 "for the default ip_blocker::noop_ip_blocker_t" );
1303
1304 return this->m_ip_blocker;
1305 }
1306
1315 void
1316 ensure_valid_ip_blocker()
1317 {
1318 this->check_valid_ip_blocker_pointer();
1319 }
1320
1321 // Acceptor post-bind hook.
1345 Derived &
1346 acceptor_post_bind_hook( acceptor_post_bind_hook_t hook ) &
1347 {
1348 if( !hook )
1349 throw exception_t{ "acceptor_post_bind_hook cannot be empty" };
1350
1351 m_acceptor_post_bind_hook = std::move(hook);
1352 return reference_to_derived();
1353 }
1354
1374 Derived &&
1375 acceptor_post_bind_hook( acceptor_post_bind_hook_t hook ) &&
1376 {
1377 return std::move(this->acceptor_post_bind_hook( std::move(hook) ));
1378 }
1379
1390 RESTINIO_NODISCARD
1391 acceptor_post_bind_hook_t
1392 giveaway_acceptor_post_bind_hook()
1393 {
1394 return std::move(m_acceptor_post_bind_hook);
1395 }
1396
1410 RESTINIO_NODISCARD
1411 const incoming_http_msg_limits_t &
1412 incoming_http_msg_limits() const noexcept
1413 {
1414 return m_incoming_http_msg_limits;
1415 }
1416
1439 Derived &
1440 incoming_http_msg_limits(
1441 const incoming_http_msg_limits_t & limits ) & noexcept
1442 {
1443 m_incoming_http_msg_limits = limits;
1444 return reference_to_derived();
1445 }
1446
1469 Derived &&
1470 incoming_http_msg_limits(
1471 const incoming_http_msg_limits_t & limits ) && noexcept
1472 {
1473 return std::move(this->incoming_http_msg_limits(limits));
1474 }
1475
1500 Derived &
1501 max_parallel_connections( std::size_t value ) & noexcept
1502 {
1503 static_assert(
1504 basic_server_settings_t::has_actual_max_parallel_connections,
1505 "max_parallel_connections(value) can't be used "
1506 "for the noop_connection_count_limiter_t" );
1507
1508 this->set_max_parallel_connections( value );
1509 return reference_to_derived();
1510 }
1511
1535 Derived &&
1536 max_parallel_connections( std::size_t value ) && noexcept
1537 {
1538 return std::move(this->max_parallel_connections( value ));
1539 }
1540
1541 using max_parallel_connections_holder_base_t::max_parallel_connections;
1542
1551 using extra_data_factory_t = typename Traits::extra_data_factory_t;
1556 using extra_data_factory_handle_t = std::shared_ptr< extra_data_factory_t >;
1557
1591 Derived &
1592 extra_data_factory(
1593 extra_data_factory_handle_t factory ) &
1594 {
1595 this->m_extra_data_factory = std::move(factory);
1596 return reference_to_derived();
1597 }
1598
1631 Derived &&
1632 extra_data_factory(
1633 extra_data_factory_handle_t factory ) &&
1634 {
1635 return std::move(this->extra_data_factory( std::move(factory) ));
1636 }
1637
1642 RESTINIO_NODISCARD
1643 extra_data_factory_handle_t
1644 giveaway_extra_data_factory() const noexcept
1645 {
1646 return ensure_created(
1647 std::move(this->m_extra_data_factory),
1648 "extra_data_factory is not set" );
1649 }
1654 private:
1655 Derived &
1656 reference_to_derived()
1657 {
1658 return static_cast<Derived &>(*this);
1659 }
1660
1661 template< typename Target, typename... Params >
1662 Derived &
1663 set_unique_instance( std::unique_ptr< Target > & t, Params &&... params )
1664 {
1665 t =
1666 std::make_unique< Target >(
1667 std::forward< Params >( params )... );
1668
1669 return reference_to_derived();
1670 }
1671
1672 template< typename Target, typename... Params >
1673 Derived &
1674 set_shared_instance( std::shared_ptr< Target > & t, Params &&... params )
1675 {
1676 t =
1677 std::make_shared< Target >(
1678 std::forward< Params >( params )... );
1679
1680 return reference_to_derived();
1681 }
1682
1685 std::uint16_t m_port;
1686 asio_ns::ip::tcp m_protocol;
1691 details::address_variant_t m_address;
1693
1695 std::size_t m_buffer_size{ 4 * 1024 };
1696
1699 std::chrono::steady_clock::duration
1700 m_read_next_http_message_timelimit{ std::chrono::seconds( 60 ) };
1701
1702 std::chrono::steady_clock::duration
1703 m_write_http_response_timelimit{ std::chrono::seconds( 5 ) };
1704
1705 std::chrono::steady_clock::duration
1706 m_handle_request_timeout{ std::chrono::seconds( 10 ) };
1708
1710 std::size_t m_max_pipelined_requests{ 1 };
1711
1713 std::unique_ptr< request_handler_t > m_request_handler;
1714
1716 std::unique_ptr< timer_factory_t > m_timer_factory;
1717
1719 std::unique_ptr< logger_t > m_logger;
1720
1722 std::unique_ptr< acceptor_options_setter_t > m_acceptor_options_setter;
1723
1725
1730 acceptor_post_bind_hook_t m_acceptor_post_bind_hook{
1731 [](asio_ns::ip::tcp::acceptor &) {}
1732 };
1733
1735 std::unique_ptr< socket_options_setter_t > m_socket_options_setter;
1736
1737 std::size_t m_concurrent_accepts_count{ 1 };
1738
1740 bool m_separate_accept_and_create_connect{ false };
1741
1743 cleanup_functor_t m_cleanup_functor;
1744
1750 incoming_http_msg_limits_t m_incoming_http_msg_limits;
1751
1757 extra_data_factory_handle_t m_extra_data_factory;
1758};
1759
1760//
1761// server_settings_t
1762//
1763
1765 template<typename Traits = default_traits_t>
1766 class server_settings_t final
1767 : public basic_server_settings_t< server_settings_t<Traits>, Traits >
1768{
1769 using base_type_t = basic_server_settings_t<
1770 server_settings_t<Traits>, Traits>;
1771 public:
1772 using base_type_t::base_type_t;
1773};
1774
1775 template < typename Traits, typename Configurator >
1776 auto
1777 exec_configurator( Configurator && configurator )
1778{
1779 server_settings_t< Traits > result;
1780
1781 configurator( result );
1782
1783 return result;
1784}
1785
1786} /* namespace restinio */
1787
asio_include.hpp
nonstd::variants::variant
Definition: variant.hpp:1301
restinio::acceptor_options_t
An adapter for setting acceptor options before running server.
Definition: settings.hpp:185
restinio::acceptor_options_t::set_option
void set_option(const Option &option, asio_ns::error_code &ec)
Definition: settings.hpp:202
restinio::acceptor_options_t::set_option
void set_option(const Option &option)
API for setting/getting options.
Definition: settings.hpp:195
restinio::acceptor_options_t::get_option
void get_option(Option &option, asio_ns::error_code &ec)
Definition: settings.hpp:216
restinio::acceptor_options_t::get_option
void get_option(Option &option)
Definition: settings.hpp:209
restinio::acceptor_options_t::m_acceptor
asio_ns::ip::tcp::acceptor & m_acceptor
Definition: settings.hpp:223
restinio::acceptor_options_t::acceptor_options_t
acceptor_options_t(asio_ns::ip::tcp::acceptor &acceptor)
Definition: settings.hpp:187
restinio::basic_server_settings_t
Basic container for http_server settings.
Definition: settings.hpp:556
restinio::basic_server_settings_t::incoming_http_msg_limits
RESTINIO_NODISCARD const incoming_http_msg_limits_t & incoming_http_msg_limits() const noexcept
Getter of optional limits for incoming HTTP messages.
Definition: settings.hpp:1412
restinio::basic_server_settings_t::timer_factory_t
typename timer_manager_t::factory_t timer_factory_t
Definition: settings.hpp:884
restinio::basic_server_settings_t::ip_blocker
const std::shared_ptr< typename Traits::ip_blocker_t > & ip_blocker() const noexcept
Get reference to IP-blocker.
Definition: settings.hpp:1297
restinio::basic_server_settings_t::m_request_handler
std::unique_ptr< request_handler_t > m_request_handler
Request handler.
Definition: settings.hpp:1713
restinio::basic_server_settings_t::giveaway_extra_data_factory
RESTINIO_NODISCARD extra_data_factory_handle_t giveaway_extra_data_factory() const noexcept
Extractor for extra-data-factory.
Definition: settings.hpp:1644
restinio::basic_server_settings_t::m_acceptor_options_setter
std::unique_ptr< acceptor_options_setter_t > m_acceptor_options_setter
Acceptor options setter.
Definition: settings.hpp:1722
restinio::basic_server_settings_t::concurrent_accepts_count
std::size_t concurrent_accepts_count() const
Definition: settings.hpp:1022
restinio::basic_server_settings_t::m_socket_options_setter
std::unique_ptr< socket_options_setter_t > m_socket_options_setter
Socket options setter.
Definition: settings.hpp:1735
restinio::basic_server_settings_t::address
RESTINIO_NODISCARD const details::address_variant_t & address() const
Definition: settings.hpp:717
restinio::basic_server_settings_t::logger_t
typename Traits::logger_t logger_t
Logger.
Definition: settings.hpp:913
restinio::basic_server_settings_t::port
Derived & port(std::uint16_t p) &
Server endpoint.
Definition: settings.hpp:586
restinio::basic_server_settings_t::handle_request_timeout
Derived && handle_request_timeout(std::chrono::steady_clock::duration d) &&
Definition: settings.hpp:808
restinio::basic_server_settings_t::ip_blocker
Derived & ip_blocker(std::shared_ptr< typename Traits::ip_blocker_t > blocker) &
Setter for IP-blocker.
Definition: settings.hpp:1237
restinio::basic_server_settings_t::concurrent_accepts_count
Derived && concurrent_accepts_count(std::size_t n) &&
Definition: settings.hpp:1016
restinio::basic_server_settings_t::buffer_size
Derived & buffer_size(std::size_t s) &
Size of buffer for io operations.
Definition: settings.hpp:730
restinio::basic_server_settings_t::concurrent_accepts_count
Derived & concurrent_accepts_count(std::size_t n) &
Max number of running concurrent accepts.
Definition: settings.hpp:1003
restinio::basic_server_settings_t::separate_accept_and_create_connect
Derived && separate_accept_and_create_connect(bool do_separate) &&noexcept
Definition: settings.hpp:1046
restinio::basic_server_settings_t::cleanup_func
Derived && cleanup_func(Func &&func) &&
Definition: settings.hpp:1070
restinio::basic_server_settings_t::max_parallel_connections
Derived & max_parallel_connections(std::size_t value) &noexcept
Setter for connection count limit.
Definition: settings.hpp:1501
restinio::basic_server_settings_t::socket_options_setter
std::unique_ptr< socket_options_setter_t > socket_options_setter()
Definition: settings.hpp:988
restinio::basic_server_settings_t::extra_data_factory
Derived && extra_data_factory(extra_data_factory_handle_t factory) &&
Setter for extra-data-factory.
Definition: settings.hpp:1632
restinio::basic_server_settings_t::protocol
RESTINIO_NODISCARD asio_ns::ip::tcp protocol() const
Definition: settings.hpp:620
restinio::basic_server_settings_t::request_handler
Derived & request_handler(Params &&... params) &
Definition: settings.hpp:856
restinio::basic_server_settings_t::socket_options_setter
Derived && socket_options_setter(socket_options_setter_t sos) &&
Definition: settings.hpp:982
restinio::basic_server_settings_t::ensure_valid_connection_state_listener
void ensure_valid_connection_state_listener()
Internal method for checking presence of state listener object.
Definition: settings.hpp:1200
restinio::basic_server_settings_t::m_port
std::uint16_t m_port
Server endpoint.
Definition: settings.hpp:1685
restinio::basic_server_settings_t::logger
Derived && logger(Params &&... params) &&
Definition: settings.hpp:926
restinio::basic_server_settings_t::m_logger
std::unique_ptr< logger_t > m_logger
Logger.
Definition: settings.hpp:1719
restinio::basic_server_settings_t::max_parallel_connections
Derived && max_parallel_connections(std::size_t value) &&noexcept
Setter for connection count limit.
Definition: settings.hpp:1536
restinio::basic_server_settings_t::timer_manager
Derived && timer_manager(Params &&... params) &&
Definition: settings.hpp:897
restinio::basic_server_settings_t::write_http_response_timelimit
Derived & write_http_response_timelimit(std::chrono::steady_clock::duration d) &
A period of time wait for response to be written to socket.
Definition: settings.hpp:779
restinio::basic_server_settings_t::extra_data_factory_handle_t
std::shared_ptr< extra_data_factory_t > extra_data_factory_handle_t
Type of shared-pointer to extra-data-factory.
Definition: settings.hpp:1556
restinio::basic_server_settings_t::m_extra_data_factory
extra_data_factory_handle_t m_extra_data_factory
User-data-factory for server.
Definition: settings.hpp:1757
restinio::basic_server_settings_t::cleanup_func
Derived & cleanup_func(Func &&func) &
Cleanup function.
Definition: settings.hpp:1062
restinio::basic_server_settings_t::request_handler
std::unique_ptr< request_handler_t > request_handler()
Definition: settings.hpp:872
restinio::basic_server_settings_t::acceptor_options_setter
Derived && acceptor_options_setter(acceptor_options_setter_t aos) &&
Definition: settings.hpp:954
restinio::basic_server_settings_t::connection_state_listener
Derived && connection_state_listener(std::shared_ptr< typename Traits::connection_state_listener_t > listener) &&
Setter for connection state listener.
Definition: settings.hpp:1164
restinio::basic_server_settings_t::protocol
Derived & protocol(asio_ns::ip::tcp p) &
Definition: settings.hpp:606
restinio::basic_server_settings_t::request_handler
Derived & request_handler(std::unique_ptr< request_handler_t > handler) &
Definition: settings.hpp:848
restinio::basic_server_settings_t::basic_server_settings_t
basic_server_settings_t(std::uint16_t port=8080, asio_ns::ip::tcp protocol=asio_ns::ip::tcp::v4())
Definition: settings.hpp:575
restinio::basic_server_settings_t::read_next_http_message_timelimit
Derived && read_next_http_message_timelimit(std::chrono::steady_clock::duration d) &&
Definition: settings.hpp:764
restinio::basic_server_settings_t::incoming_http_msg_limits
Derived & incoming_http_msg_limits(const incoming_http_msg_limits_t &limits) &noexcept
Setter of optional limits for incoming HTTP messages.
Definition: settings.hpp:1440
restinio::basic_server_settings_t::m_protocol
asio_ns::ip::tcp m_protocol
Definition: settings.hpp:1686
restinio::basic_server_settings_t::ip_blocker
Derived && ip_blocker(std::shared_ptr< typename Traits::ip_blocker_t > blocker) &&
Setter for IP-blocker.
Definition: settings.hpp:1282
restinio::basic_server_settings_t::max_pipelined_requests
Derived && max_pipelined_requests(std::size_t mpr) &&
Definition: settings.hpp:830
restinio::basic_server_settings_t::m_incoming_http_msg_limits
incoming_http_msg_limits_t m_incoming_http_msg_limits
Limits for incoming HTTP messages.
Definition: settings.hpp:1750
restinio::basic_server_settings_t::buffer_size
std::size_t buffer_size() const
Definition: settings.hpp:743
restinio::basic_server_settings_t::handle_request_timeout
Derived & handle_request_timeout(std::chrono::steady_clock::duration d) &
A period of time that is given for a handler to create response.
Definition: settings.hpp:801
restinio::basic_server_settings_t::reference_to_derived
Derived & reference_to_derived()
Definition: settings.hpp:1656
restinio::basic_server_settings_t::m_timer_factory
std::unique_ptr< timer_factory_t > m_timer_factory
Timers factory.
Definition: settings.hpp:1716
restinio::basic_server_settings_t::timer_manager
Derived & timer_manager(Params &&... params) &
Definition: settings.hpp:888
restinio::basic_server_settings_t::request_handler
Derived && request_handler(Params &&... params) &&
Definition: settings.hpp:866
restinio::basic_server_settings_t::address
Derived && address(std::string addr) &&
Definition: settings.hpp:663
restinio::basic_server_settings_t::handle_request_timeout
std::chrono::steady_clock::duration handle_request_timeout() const
Definition: settings.hpp:814
restinio::basic_server_settings_t::logger
Derived & logger(Params &&... params) &
Definition: settings.hpp:917
restinio::basic_server_settings_t::acceptor_options_setter
std::unique_ptr< acceptor_options_setter_t > acceptor_options_setter()
Definition: settings.hpp:960
restinio::basic_server_settings_t::address
Derived & address(asio_ns::ip::address addr) &
Definition: settings.hpp:688
restinio::basic_server_settings_t::ensure_valid_ip_blocker
void ensure_valid_ip_blocker()
Internal method for checking presence of IP-blocker object.
Definition: settings.hpp:1316
restinio::basic_server_settings_t::acceptor_options_setter
Derived & acceptor_options_setter(acceptor_options_setter_t aos) &
Acceptor options setter.
Definition: settings.hpp:943
restinio::basic_server_settings_t::extra_data_factory
Derived & extra_data_factory(extra_data_factory_handle_t factory) &
Setter for extra-data-factory.
Definition: settings.hpp:1592
restinio::basic_server_settings_t::write_http_response_timelimit
Derived && write_http_response_timelimit(std::chrono::steady_clock::duration d) &&
Definition: settings.hpp:786
restinio::basic_server_settings_t::giveaway_cleanup_func
RESTINIO_NODISCARD cleanup_functor_t giveaway_cleanup_func()
Definition: settings.hpp:1083
restinio::basic_server_settings_t::read_next_http_message_timelimit
std::chrono::steady_clock::duration read_next_http_message_timelimit() const
Definition: settings.hpp:770
restinio::basic_server_settings_t::max_pipelined_requests
Derived & max_pipelined_requests(std::size_t mpr) &
Max pipelined requests able to receive on single connection.
Definition: settings.hpp:823
restinio::basic_server_settings_t::set_unique_instance
Derived & set_unique_instance(std::unique_ptr< Target > &t, Params &&... params)
Definition: settings.hpp:1663
restinio::basic_server_settings_t::timer_manager_t
typename Traits::timer_manager_t timer_manager_t
Timers manager.
Definition: settings.hpp:883
restinio::basic_server_settings_t::extra_data_factory_t
typename Traits::extra_data_factory_t extra_data_factory_t
The actual type of extra-data-factory.
Definition: settings.hpp:1551
restinio::basic_server_settings_t::set_shared_instance
Derived & set_shared_instance(std::shared_ptr< Target > &t, Params &&... params)
Definition: settings.hpp:1674
restinio::basic_server_settings_t::connection_state_listener
const std::shared_ptr< typename Traits::connection_state_listener_t > & connection_state_listener() const noexcept
Get reference to connection state listener.
Definition: settings.hpp:1180
restinio::basic_server_settings_t::max_pipelined_requests
std::size_t max_pipelined_requests() const
Definition: settings.hpp:836
restinio::basic_server_settings_t::has_actual_max_parallel_connections
static constexpr bool has_actual_max_parallel_connections
Definition: settings.hpp:483
restinio::basic_server_settings_t::acceptor_post_bind_hook
Derived && acceptor_post_bind_hook(acceptor_post_bind_hook_t hook) &&
A setter for post-bind callback.
Definition: settings.hpp:1375
restinio::basic_server_settings_t::m_cleanup_functor
cleanup_functor_t m_cleanup_functor
Optional cleanup functor.
Definition: settings.hpp:1743
restinio::basic_server_settings_t::port
Derived && port(std::uint16_t p) &&
Definition: settings.hpp:593
restinio::basic_server_settings_t::timer_factory
std::unique_ptr< timer_factory_t > timer_factory()
Definition: settings.hpp:903
restinio::basic_server_settings_t::address
Derived && address(asio_ns::ip::address addr) &&
Definition: settings.hpp:710
restinio::basic_server_settings_t::socket_options_setter
Derived & socket_options_setter(socket_options_setter_t sos) &
Socket options setter.
Definition: settings.hpp:971
restinio::basic_server_settings_t::acceptor_post_bind_hook
Derived & acceptor_post_bind_hook(acceptor_post_bind_hook_t hook) &
A setter for post-bind callback.
Definition: settings.hpp:1346
restinio::basic_server_settings_t::incoming_http_msg_limits
Derived && incoming_http_msg_limits(const incoming_http_msg_limits_t &limits) &&noexcept
Setter of optional limits for incoming HTTP messages.
Definition: settings.hpp:1470
restinio::basic_server_settings_t::write_http_response_timelimit
std::chrono::steady_clock::duration write_http_response_timelimit() const
Definition: settings.hpp:792
restinio::basic_server_settings_t::m_address
details::address_variant_t m_address
Definition: settings.hpp:1691
restinio::basic_server_settings_t::request_handler_t
request_handler_type_from_traits_t< Traits > request_handler_t
Request handler.
Definition: settings.hpp:845
restinio::basic_server_settings_t::buffer_size
Derived && buffer_size(std::size_t s) &&
Definition: settings.hpp:737
restinio::basic_server_settings_t::separate_accept_and_create_connect
Derived & separate_accept_and_create_connect(bool do_separate) &noexcept
Do separate an accept operation and connection instantiation.
Definition: settings.hpp:1039
restinio::basic_server_settings_t::read_next_http_message_timelimit
Derived & read_next_http_message_timelimit(std::chrono::steady_clock::duration d) &
}
Definition: settings.hpp:757
restinio::basic_server_settings_t::port
RESTINIO_NODISCARD std::uint16_t port() const
Definition: settings.hpp:600
restinio::basic_server_settings_t::giveaway_acceptor_post_bind_hook
RESTINIO_NODISCARD acceptor_post_bind_hook_t giveaway_acceptor_post_bind_hook()
A getter for post-bind callback.
Definition: settings.hpp:1392
restinio::basic_server_settings_t::address
Derived & address(std::string addr) &
Definition: settings.hpp:643
restinio::basic_server_settings_t::connection_state_listener
Derived & connection_state_listener(std::shared_ptr< typename Traits::connection_state_listener_t > listener) &
Setter for connection state listener.
Definition: settings.hpp:1120
restinio::basic_server_settings_t::protocol
Derived && protocol(asio_ns::ip::tcp p) &&
Definition: settings.hpp:613
restinio::basic_server_settings_t::separate_accept_and_create_connect
bool separate_accept_and_create_connect() const noexcept
Definition: settings.hpp:1052
restinio::basic_server_settings_t::logger
std::unique_ptr< logger_t > logger()
Definition: settings.hpp:932
restinio::connection_count_limits::noop_connection_count_limiter_t
An implementation of connection count limiter for the case when connection count is not limited.
Definition: connection_count_limiter.hpp:271
restinio::exception_t
Exception class for all exceptions thrown by RESTinio.
Definition: exception.hpp:26
restinio::incoming_http_msg_limits_t
A type of holder of limits related to an incoming HTTP message.
Definition: incoming_http_msg_limits.hpp:69
restinio::server_settings_t
A fluent style interface for setting http server params.
Definition: settings.hpp:1768
restinio::socket_options_t
An adapter for setting acceptor options before running server.
Definition: settings.hpp:249
restinio::socket_options_t::set_option
void set_option(const Option &option, asio_ns::error_code &ec)
Definition: settings.hpp:268
restinio::socket_options_t::m_socket
asio_ns::basic_socket< asio_ns::ip::tcp > & m_socket
A reference on the most base class with interface of setting options.
Definition: settings.hpp:290
restinio::socket_options_t::get_option
void get_option(Option &option)
Definition: settings.hpp:275
restinio::socket_options_t::get_option
void get_option(Option &option, asio_ns::error_code &ec)
Definition: settings.hpp:282
restinio::socket_options_t::socket_options_t
socket_options_t(asio_ns::basic_socket< asio_ns::ip::tcp > &socket)
Definition: settings.hpp:251
restinio::socket_options_t::set_option
void set_option(const Option &option)
API for setting/getting options.
Definition: settings.hpp:261
restinio::socket_type_dependent_settings_t
Extra settings needed for working with socket.
Definition: settings.hpp:155
restinio::socket_type_dependent_settings_t::~socket_type_dependent_settings_t
~socket_type_dependent_settings_t() noexcept=default
RESTINIO_NODISCARD
#define RESTINIO_NODISCARD
Definition: compiler_features.hpp:33
exception.hpp
incoming_http_msg_limits.hpp
Stuff related to limits of an incoming HTTP message.
nonstd::optional_lite::std11::false_type
bool_constant< false > false_type
Definition: optional.hpp:460
nonstd::optional_lite::std11::move
T & move(T &t)
Definition: optional.hpp:465
nonstd::optional_lite::std11::true_type
bool_constant< true > true_type
Definition: optional.hpp:459
restinio::details::create_default_unique_object_instance
auto create_default_unique_object_instance(std::false_type)
Default instantiation for a specific type.
Definition: settings.hpp:34
restinio::details::create_default_shared_object_instance
auto create_default_shared_object_instance(std::false_type)
Default instantiation for a specific type.
Definition: settings.hpp:49
restinio::ip_blocker::inspection_result_t
inspection_result_t
Enumeration of result of inspecting new incoming connection.
Definition: ip_blocker.hpp:31
restinio
Definition: asio_include.hpp:21
restinio::ensure_created
auto ensure_created(std::unique_ptr< Object > mb_created_one, string_view_t fail_description)
Ensure that object was created.
Definition: settings.hpp:114
restinio::create_default_unique_object_instance< acceptor_options_setter_t >
auto create_default_unique_object_instance< acceptor_options_setter_t >()
Definition: settings.hpp:230
restinio::acceptor_post_bind_hook_t
std::function< void(asio_ns::ip::tcp::acceptor &) > acceptor_post_bind_hook_t
A type of callback to be called after a successful invocation of bind() function for the acceptor.
Definition: settings.hpp:435
restinio::string_view_t
nonstd::string_view string_view_t
Definition: string_view.hpp:19
restinio::create_default_shared_object_instance
auto create_default_shared_object_instance()
Default instantiation for a specific type.
Definition: settings.hpp:92
restinio::cleanup_functor_t
std::function< void(void) > cleanup_functor_t
Type of holder for user's cleanup function.
Definition: settings.hpp:308
restinio::exec_configurator
auto exec_configurator(Configurator &&configurator)
Definition: settings.hpp:1777
restinio::create_default_shared_object_instance< default_request_handler_t >
auto create_default_shared_object_instance< default_request_handler_t >()
Default instantiation for default_request_handler_t.
Definition: settings.hpp:101
restinio::socket_options_setter_t
std::function< void(socket_options_t &) > socket_options_setter_t
Definition: settings.hpp:293
restinio::request_handler_type_from_traits_t
typename details::actual_request_handler_type_detector< typename Traits::request_handler_t, typename Traits::extra_data_factory_t >::request_handler_t request_handler_type_from_traits_t
A metafunction for extraction a request-handler type from server's traits.
Definition: traits.hpp:379
restinio::create_default_unique_object_instance
auto create_default_unique_object_instance()
Default instantiation for a specific type.
Definition: settings.hpp:70
restinio::create_default_unique_object_instance< default_request_handler_t >
auto create_default_unique_object_instance< default_request_handler_t >()
Default instantiation for default_request_handler_t.
Definition: settings.hpp:79
restinio::acceptor_options_setter_t
std::function< void(acceptor_options_t &) > acceptor_options_setter_t
Definition: settings.hpp:226
restinio::create_default_unique_object_instance< socket_options_setter_t >
auto create_default_unique_object_instance< socket_options_setter_t >()
Definition: settings.hpp:297
request_handler.hpp
restinio::connection_count_limit_types::limiter_t
typename std::conditional< Traits::use_connection_count_limiter, connection_count_limits::connection_count_limiter_t< typename Traits::strand_t >, connection_count_limits::noop_connection_count_limiter_t >::type limiter_t
Definition: connection_count_limiter.hpp:466
restinio::connection_state_listener_holder_t< connection_state::noop_listener_t >::check_valid_connection_state_listener_pointer
void check_valid_connection_state_listener_pointer() const
Definition: settings.hpp:355
restinio::connection_state_listener_holder_t
A special class for holding actual connection state listener.
Definition: settings.hpp:324
restinio::connection_state_listener_holder_t::m_connection_state_listener
std::shared_ptr< Listener > m_connection_state_listener
Definition: settings.hpp:325
restinio::connection_state_listener_holder_t::check_valid_connection_state_listener_pointer
void check_valid_connection_state_listener_pointer() const
Checks that pointer to state listener is not null.
Definition: settings.hpp:334
restinio::details::max_parallel_connections_holder_t< ::restinio::connection_count_limits::noop_connection_count_limiter_t >::max_parallel_connections
std::size_t max_parallel_connections() const noexcept
Definition: settings.hpp:525
restinio::details::max_parallel_connections_holder_t
A special type for holding the value of maximum allowed count of parallel connections.
Definition: settings.hpp:482
restinio::details::max_parallel_connections_holder_t::set_max_parallel_connections
void set_max_parallel_connections(std::size_t v) noexcept
Definition: settings.hpp:501
restinio::details::max_parallel_connections_holder_t::max_parallel_connections
std::size_t max_parallel_connections() const noexcept
Definition: settings.hpp:495
restinio::details::no_address_specified_t
A special indicator for the case when IP address for a server is not set explicitly.
Definition: settings.hpp:449
restinio::ip_blocker_holder_t< ip_blocker::noop_ip_blocker_t >::check_valid_ip_blocker_pointer
void check_valid_ip_blocker_pointer() const
Definition: settings.hpp:419
restinio::ip_blocker_holder_t
A special class for holding actual IP-blocker object.
Definition: settings.hpp:375
restinio::ip_blocker_holder_t::check_valid_ip_blocker_pointer
void check_valid_ip_blocker_pointer() const
Checks that pointer to IP-blocker is not null.
Definition: settings.hpp:398
restinio::ip_blocker_holder_t::m_ip_blocker
std::shared_ptr< Ip_Blocker > m_ip_blocker
Definition: settings.hpp:379
restinio::ip_blocker_holder_t< Traits::ip_blocker_t >::has_actual_ip_blocker
static constexpr bool has_actual_ip_blocker
Definition: settings.hpp:391
traits.hpp
variant.hpp
const
#define const
Definition: zconf.h:230