ip_blocker.hpp
Go to the documentation of this file.
/*
* RESTinio
*/
#pragma once
#include <restinio/common_types.hpp>
namespace restinio
{
namespace ip_blocker
{
//
// inspection_result_t
//
enum class inspection_result_t
{
deny,
allow
};
inline constexpr inspection_result_t
deny() noexcept { return inspection_result_t::deny; }
inline constexpr inspection_result_t
allow() noexcept { return inspection_result_t::allow; }
//
// incoming_info_t
//
class incoming_info_t
{
endpoint_t m_remote_endpoint;
public :
incoming_info_t(
endpoint_t remote_endpoint )
: m_remote_endpoint{ remote_endpoint }
{}
endpoint_t
remote_endpoint() const noexcept { return m_remote_endpoint; }
};
//
// noop_ip_blocker_t
//
struct noop_ip_blocker_t
{
// empty type by design.
};
} /* namespace ip_blocker */
} /* 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
common_types.hpp
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.
restinio::ip_blocker::inspection_result_t::allow
@ allow
New connection is allowed to be processed further.
restinio::ip_blocker::allow
constexpr inspection_result_t allow() noexcept
Shorthand for inspection_result_t::allow.
Definition: ip_blocker.hpp:52
restinio
Definition: asio_include.hpp:21
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
const
#define const
Definition: zconf.h:230