Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
web::ng::ConnectionMetadata Class Referenceabstract

An interface for a connection metadata class. More...

#include <Connection.hpp>

Inheritance diagram for web::ng::ConnectionMetadata:
Collaboration diagram for web::ng::ConnectionMetadata:

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.
 
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
 
Taggableoperator= (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.
 

Detailed Description

An interface for a connection metadata class.

Constructor & Destructor Documentation

◆ ConnectionMetadata()

web::ng::ConnectionMetadata::ConnectionMetadata ( std::string ip,
util::TagDecoratorFactory const & tagDecoratorFactory )

Construct a new ConnectionMetadata object.

Parameters
ipThe client ip.
tagDecoratorFactoryThe factory for creating tag decorators.

Member Function Documentation

◆ ip()

std::string const & web::ng::ConnectionMetadata::ip ( ) const

Get the ip of the client.

Returns
The ip of the client.

◆ isAdmin()

bool web::ng::ConnectionMetadata::isAdmin ( ) const

Get whether the client is an admin.

Returns
true if the client is an admin.

◆ setIsAdmin()

template<std::invocable T>
void web::ng::ConnectionMetadata::setIsAdmin ( T && setter)
inline

Set the isAdmin field.

Note
This function is lazy, it will update isAdmin only if it is not set yet.
Template Parameters
TThe invocable type of the function to call to set the isAdmin.
Parameters
setterThe function to call to set the isAdmin.

◆ wasUpgraded()

virtual bool web::ng::ConnectionMetadata::wasUpgraded ( ) const
pure virtual

Whether the connection was upgraded. Upgraded connections are websocket connections.

Returns
true if the connection was upgraded.

Implemented in web::ng::impl::HttpConnection< StreamType >, and web::ng::impl::WsConnection< StreamType >.


The documentation for this class was generated from the following files: