RESTinio
Toggle main menu visibility
Loading...
Searching...
No Matches
restinio
ip_blocker.hpp
Go to the documentation of this file.
1
/*
2
* RESTinio
3
*/
4
5
/*!
6
* @file
7
* @brief Stuff related to IP blockers.
8
*
9
* @since v.0.5.1
10
*/
11
12
#
pragma
once
13
14
#
include
<
restinio
/
common_types
.
hpp
>
15
16
namespace
restinio
17
{
18
19
namespace
ip_blocker
20
{
21
22
//
23
// inspection_result_t
24
//
25
/*!
26
* @brief Enumeration of result of inspecting new incoming connection.
27
*
28
* @since v.0.5.1
29
*/
30
enum
class
inspection_result_t
31
{
32
//! New connection is disabled and should be closed.
33
deny
,
34
//! New connection is allowed to be processed further.
35
allow
36
};
37
38
/*!
39
* @brief Shorthand for inspection_result_t::deny.
40
*
41
* @since v.0.5.1
42
*/
43
inline
constexpr
inspection_result_t
44
deny
()
noexcept
{
return
inspection_result_t
::
deny
; }
45
46
/*!
47
* @brief Shorthand for inspection_result_t::allow.
48
*
49
* @since v.0.5.1
50
*/
51
inline
constexpr
inspection_result_t
52
allow
()
noexcept
{
return
inspection_result_t
::
allow
; }
53
54
//
55
// incoming_info_t
56
//
57
/*!
58
* @brief An information about new incoming connection to be passed
59
* to IP-blocker object.
60
*
61
* @since v.0.5.1
62
*/
63
class
incoming_info_t
64
{
65
endpoint_t
m_remote_endpoint
;
66
67
public
:
68
//! Initializing constructor.
69
incoming_info_t
(
70
endpoint_t
remote_endpoint )
71
:
m_remote_endpoint
{
remote_endpoint
}
72
{}
73
74
//! Remote endpoint of the new connection.
75
endpoint_t
76
remote_endpoint
()
const
noexcept
{
return
m_remote_endpoint; }
77
};
78
79
//
80
// noop_ip_blocker_t
81
//
82
/*!
83
* @brief The default no-op IP-blocker.
84
*
85
* This type is used for ip_blocker_t trait by default.
86
*
87
* NOTE. When this type if used no calls to IP-blocker will be generated.
88
* It means that there won't be any performance penalties related to
89
* invoking of IP-blocker's inspect() method.
90
*
91
* @since v.0.5.1
92
*/
93
struct
noop_ip_blocker_t
94
{
95
// empty type by design.
96
};
97
98
}
/* namespace ip_blocker */
99
100
}
/* namespace restinio */
restinio::ip_blocker::incoming_info_t
An information about new incoming connection to be passed to IP-blocker object.
Definition
ip_blocker.hpp:64
restinio::ip_blocker::incoming_info_t::remote_endpoint
endpoint_t remote_endpoint() const noexcept
Remote endpoint of the new connection.
Definition
ip_blocker.hpp:76
restinio::ip_blocker::incoming_info_t::incoming_info_t
incoming_info_t(endpoint_t remote_endpoint)
Initializing constructor.
Definition
ip_blocker.hpp:69
restinio::ip_blocker::incoming_info_t::m_remote_endpoint
endpoint_t m_remote_endpoint
Definition
ip_blocker.hpp:65
restinio::ip_blocker
Definition
ip_blocker.hpp:20
restinio::ip_blocker::deny
constexpr inspection_result_t deny() noexcept
Shorthand for inspection_result_t::deny.
Definition
ip_blocker.hpp:44
restinio::ip_blocker::inspection_result_t
inspection_result_t
Enumeration of result of inspecting new incoming connection.
Definition
ip_blocker.hpp:31
restinio::ip_blocker::inspection_result_t::deny
@ deny
New connection is disabled and should be closed.
Definition
ip_blocker.hpp:33
restinio::ip_blocker::inspection_result_t::allow
@ allow
New connection is allowed to be processed further.
Definition
ip_blocker.hpp:35
restinio::ip_blocker::allow
constexpr inspection_result_t allow() noexcept
Shorthand for inspection_result_t::allow.
Definition
ip_blocker.hpp:52
restinio
Definition
sendfile_operation_default.ipp:12
restinio::endpoint_t
asio_ns::ip::tcp::endpoint endpoint_t
An alias for endpoint type from Asio.
Definition
common_types.hpp:177
restinio::ip_blocker::noop_ip_blocker_t
The default no-op IP-blocker.
Definition
ip_blocker.hpp:94
Generated by
1.17.0