Clio
develop
The XRP Ledger API server.
|
An interface for a connection metadata class. More...
#include <Connection.hpp>
Public Member Functions | |
ConnectionMetadata (std::string ip, util::TagDecoratorFactory const &tagDecoratorFactory) | |
Construct a new ConnectionMetadata object. | |
virtual bool | wasUpgraded () const =0 |
Whether the connection was upgraded. Upgraded connections are websocket connections. | |
std::string const & | ip () const |
Get the ip of the client. | |
void | setIp (std::string newIp) |
Set the ip of the client. | |
bool | isAdmin () const |
Get whether the client is an admin. | |
template<std::invocable T> | |
void | setIsAdmin (T &&setter) |
Set the isAdmin field. | |
Public Member Functions inherited from util::Taggable | |
Taggable (Taggable &&)=default | |
Taggable & | operator= (Taggable &&)=default |
BaseTagDecorator const & | tag () const |
Getter for tag decorator. |
Protected Attributes | |
std::string | ip_ |
std::optional< bool > | isAdmin_ |
Additional Inherited Members | |
Protected Member Functions inherited from util::Taggable | |
Taggable (util::TagDecoratorFactory const &tagFactory) | |
New Taggable from a specified factory. |
An interface for a connection metadata class.
web::ng::ConnectionMetadata::ConnectionMetadata | ( | std::string | ip, |
util::TagDecoratorFactory const & | tagDecoratorFactory ) |
Construct a new ConnectionMetadata object.
ip | The client ip. |
tagDecoratorFactory | The factory for creating tag decorators. |
std::string const & web::ng::ConnectionMetadata::ip | ( | ) | const |
Get the ip of the client.
bool web::ng::ConnectionMetadata::isAdmin | ( | ) | const |
Get whether the client is an admin.
|
inline |
Set the ip of the client.
newIp | The new ip to set. |
|
inline |
Set the isAdmin field.
T | The invocable type of the function to call to set the isAdmin. |
setter | The function to call to set the isAdmin. |
|
pure virtual |
Whether the connection was upgraded. Upgraded connections are websocket connections.
Implemented in web::ng::impl::HttpConnection< StreamType >, web::ng::impl::HttpConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, web::ng::impl::HttpConnection< boost::beast::tcp_stream >, web::ng::impl::WsConnection< StreamType >, web::ng::impl::WsConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, and web::ng::impl::WsConnection< boost::beast::tcp_stream >.