roar
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Roar Namespace Reference

Namespaces

namespace  Curl
 
namespace  Detail
 
namespace  Dns
 
namespace  Literals
 
namespace  MemoryLiterals
 
namespace  Parser
 
namespace  RegexLiterals
 

Classes

class  Authorization
 
struct  BasicAuth
 
class  Client
 
class  Cookie
 
struct  CorsSettings
 Settings object to control CORS requests. More...
 
class  date
 
struct  DigestAuth
 
struct  Error
 Holds errors that are produced asynchronously anywhere. More...
 
struct  ErrorHandler
 
class  Factory
 This factory creates sessions. More...
 
struct  FileAndStatus
 
struct  FlexibleProviderUnwrapper
 
struct  FlexibleProviderUnwrapper< HolderClassT, T, false >
 
struct  Ipv4
 
struct  Ipv6
 
class  Jail
 
struct  overloaded
 
struct  ProtoRoute
 A proper Route is built up from this object. This object is usually created internally. More...
 
struct  PseudoRegex
 
class  RangeFileBody
 This body is a file body, but with range request support. More...
 
struct  Ranges
 
class  Request
 This class extends the boost::beast::http::request<BodyT> with additional convenience. More...
 
class  Response
 
class  Route
 A route represents the mapping of a verb+path to a user provided function. More...
 
struct  RouteInfo
 This class is what is used in ROAR_GET, ROAR_PUT, ... requests All options you can set for routes behind these macros are part of this object. More...
 
struct  RouteOptions
 Options that modify the server behavior for a given route. More...
 
class  Router
 The route routes http requests to their respective handler functions. More...
 
class  ScopeExit
 
struct  ServeInfo
 
struct  ServeOptions
 
class  Server
 
class  Session
 
class  ShutdownBarrier
 
struct  SslServerContext
 
class  StandardResponseProvider
 Implement your own StandardResponseProvider to make custom 404 pages etc. More...
 
class  StandardTextResponseProvider
 This standard response provider implementation produces very simple text responses. More...
 
struct  Url
 
class  VoidBody
 This body is for reading into nothing. More...
 
class  WebsocketBase
 
class  WebsocketClient
 
struct  WebsocketReadResult
 
class  WebsocketSession
 A WebsocketSession allows you to interact with a client via websocket protocol. More...
 

Typedefs

using EmptyBodyRequest = Request< boost::beast::http::empty_body >
 
template<typename HolderClassT , typename T , bool Optional = false>
using FlexibleProvider = Detail::MakeVariantFromRetrievers_v< Optional, std::function< T(HolderClassT &)>, std::function< T const &(HolderClassT &)>, T const &(HolderClassT::*)(), T const &(HolderClassT::*)() const, T(HolderClassT::*)(), T(HolderClassT::*)() const, T HolderClassT::*, T >
 
template<typename RequestListenerT >
using HandlerType = void(RequestListenerT::*)(Session &, Request< boost::beast::http::empty_body > &&)
 
template<typename RequestListenerT >
using ServeHandlerType = ServeDecision(RequestListenerT::*)(Session &, Request< boost::beast::http::empty_body > const &, FileAndStatus const &, ServeOptions< RequestListenerT > &options)
 

Enumerations

enum class  ServeDecision { Continue , Deny , Handled }
 
enum class  RoutePathType { Unspecified , RegularString , Regex , ServedDirectory }
 

Functions

 BOOST_DEFINE_ENUM (AuthorizationScheme, Basic, Bearer, Digest, Hoba, Mutual, Ntlm, Vapid, Scram, Aws4_Hmac_Sha256, Other)
 
AuthorizationScheme authorizationSchemeFromString (std::string_view)
 
std::string to_string (AuthorizationScheme scheme)
 
CorsSettings makePermissiveCorsSettings (std::string method)
 Reflects all requested headers and origin or sets the Kleene star. Is as permissive as possible. Least secure option.
 
CorsSettings makePermissiveCorsSettings (boost::beast::http::verb method)
 Same as the makePermissiveCorsSettings(std::string method) overload.
 
template<typename StreamT >
StreamT & operator<< (StreamT &stream, Error error)
 
std::filesystem::path resolvePath (std::filesystem::path const &path)
 Will replace prefixes like "~" and "%appdata%" with actual directories on linux and windows.
 
constexpr unsigned long long operator""_Bytes (unsigned long long n)
 
constexpr unsigned long long operator""_KiB (unsigned long long n)
 
constexpr unsigned long long operator""_MiB (unsigned long long n)
 
constexpr unsigned long long operator""_GiB (unsigned long long n)
 
constexpr unsigned long long operator""_MemoryPage (unsigned long long n)
 
PseudoRegex operator""_rgx (char const *regexString, std::size_t length)
 
std::optional< std::string > extensionToMime (std::string const &extension)
 
template<typename HolderClassT , typename T >
std::optional< T > unwrapFlexibleProvider (HolderClassT &holder, FlexibleProvider< HolderClassT, T, true > const &flexibleProvider)
 
template<typename HolderClassT , typename T >
unwrapFlexibleProvider (HolderClassT &holder, FlexibleProvider< HolderClassT, T, false > const &flexibleProvider)
 
template<typename RequestListenerT >
auto extendRouteInfo (RouteInfo< RequestListenerT > info, HandlerType< RequestListenerT > handler)
 
template<typename RequestListenerT >
auto extendRouteInfoForServe (ServeInfo< RequestListenerT > info, ServeHandlerType< RequestListenerT > handler)
 
void initializeServerSslContext (SslServerContext &ctx)
 A function to simplify the creation of ssl contexts. Make one on your own if you need more sophisticated settings.
 
boost::asio::ssl::context makeSslContext (const std::string &certificate, const std::string &privateKey)
 
std::string urlEncode (const std::string &source)
 
std::string urlDecode (const std::string &source)
 
std::string base64Encode (std::vector< unsigned char > const &data)
 Encode vector in base64.
 
std::string base64Encode (std::string const &str)
 Encode string in base64.
 
std::string base64Decode (std::string const &base64String)
 Decode base64 to string.
 
std::string base64Decode (std::string_view base64String)
 Decode base64 to string.
 
std::string base64UrlEncode (std::vector< unsigned char > const &data, bool includePadding=false)
 encodes data using base64url algorithm, which is similar to base64, but uses - and _ instead of + and /.
 
std::vector< unsigned charbase64UrlDecode (std::string_view const &base64String)
 Reverses the base64url encoding.
 
template<template< typename... > typename ContainerType, typename ElementType >
void concatContainers (ContainerType< ElementType > &lhs, ContainerType< ElementType > const &rhs)
 
template<template< typename... > typename ContainerType, typename ElementType >
void concatContainers (ContainerType< ElementType > &lhs, ContainerType< ElementType > &&rhs)
 
template<template< typename... > typename ContainerType, typename ElementType >
ContainerType< ElementType > concatContainersCopy (ContainerType< ElementType > lhs, ContainerType< ElementType > const &rhs)
 
template<template< typename... > typename ContainerType, typename ElementType >
ContainerType< ElementType > concatContainersCopy (ContainerType< ElementType > lhs, ContainerType< ElementType > &&rhs)
 
std::string demangleCppSymbol (std::string const &name, std::vector< std::pair< std::string, std::string > > const &replacers={}, bool format=false)
 Demangles a C++ symbol. Useful for tests or debugging purposes.
 
template<typename... Ts>
 overloaded (Ts...) -> overloaded< Ts... >
 
template<typename T >
 ScopeExit (T) -> ScopeExit< T >
 
std::optional< std::string > sha256 (std::string_view data)
 
std::optional< std::string > sha512 (std::string_view data)
 
template<typename... VariantTypes, typename... VisitFunctionTypes>
auto visitOverloaded (std::variant< VariantTypes... > const &variant, VisitFunctionTypes &&... visitFunctions)
 
template<typename... VariantTypes, typename... VisitFunctionTypes>
auto visitOverloaded (std::variant< VariantTypes... > &variant, VisitFunctionTypes &&... visitFunctions)
 
template<typename... VariantTypes, typename... VisitFunctionTypes>
auto visitOverloaded (std::variant< VariantTypes... > &&variant, VisitFunctionTypes &&... visitFunctions)
 
std::unordered_map< std::string, std::string > const & getMimeMapping ()
 
 ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL (Route)
 
 ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL (Router)
 
 ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL (Factory)
 
 ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL_NO_DTOR (Session)
 
std::string tmFormatter (std::tm *tm, const char *suffix=nullptr)
 
void onSignal (int sig)
 

Variables

ShutdownBarrier shutdownBarrier
 

Typedef Documentation

◆ EmptyBodyRequest

using Roar::EmptyBodyRequest = typedef Request<boost::beast::http::empty_body>

◆ FlexibleProvider

template<typename HolderClassT , typename T , bool Optional = false>
using Roar::FlexibleProvider = typedef Detail::MakeVariantFromRetrievers_v< Optional, std::function<T(HolderClassT&)>, std::function<T const&(HolderClassT&)>, T const& (HolderClassT::*)(), T const& (HolderClassT::*)() const, T (HolderClassT::*)(), T (HolderClassT::*)() const, T HolderClassT::*, T>

◆ HandlerType

template<typename RequestListenerT >
using Roar::HandlerType = typedef void (RequestListenerT::*)(Session&, Request<boost::beast::http::empty_body>&&)

◆ ServeHandlerType

template<typename RequestListenerT >
using Roar::ServeHandlerType = typedef ServeDecision (RequestListenerT::*)( Session&, Request<boost::beast::http::empty_body> const&, FileAndStatus const&, ServeOptions<RequestListenerT>& options)

Enumeration Type Documentation

◆ RoutePathType

enum class Roar::RoutePathType
strong
Enumerator
Unspecified 
RegularString 

Take precedence over any other path.

Regex 

Take precedence over serve paths.

ServedDirectory 

Taken into account last.

◆ ServeDecision

enum class Roar::ServeDecision
strong
Enumerator
Continue 

Continue to serve/delete/upload the file.

Deny 

Will respond with a standard forbidden response.

Handled 

You handled the response, so just end the connection if necessary.

Function Documentation

◆ authorizationSchemeFromString()

AuthorizationScheme Roar::authorizationSchemeFromString ( std::string_view  view)

◆ base64Decode() [1/2]

std::string Roar::base64Decode ( std::string const &  base64String)

Decode base64 to string.

Parameters
base64String
Returns
std::string

◆ base64Decode() [2/2]

std::string Roar::base64Decode ( std::string_view  base64String)

Decode base64 to string.

Parameters
base64String
Returns
std::string

◆ base64Encode() [1/2]

std::string Roar::base64Encode ( std::string const &  str)

Encode string in base64.

Parameters
str
Returns
std::string

◆ base64Encode() [2/2]

std::string Roar::base64Encode ( std::vector< unsigned char > const &  data)

Encode vector in base64.

Parameters
str
Returns
std::string

◆ base64UrlDecode()

std::vector< unsigned char > Roar::base64UrlDecode ( std::string_view const &  base64String)

Reverses the base64url encoding.

Parameters
base64StringAn encoded string.

◆ base64UrlEncode()

std::string Roar::base64UrlEncode ( std::vector< unsigned char > const &  data,
bool  includePadding = false 
)

encodes data using base64url algorithm, which is similar to base64, but uses - and _ instead of + and /.

Parameters
dataThe binary data to encode
includePaddingdetermines whether to include url encoded equal signs at the end so that they exist as %3D
Returns
std::string The encoded result

◆ BOOST_DEFINE_ENUM()

Roar::BOOST_DEFINE_ENUM ( AuthorizationScheme  ,
Basic  ,
Bearer  ,
Digest  ,
Hoba  ,
Mutual  ,
Ntlm  ,
Vapid  ,
Scram  ,
Aws4_Hmac_Sha256  ,
Other   
)

◆ concatContainers() [1/2]

template<template< typename... > typename ContainerType, typename ElementType >
void Roar::concatContainers ( ContainerType< ElementType > &  lhs,
ContainerType< ElementType > &&  rhs 
)

◆ concatContainers() [2/2]

template<template< typename... > typename ContainerType, typename ElementType >
void Roar::concatContainers ( ContainerType< ElementType > &  lhs,
ContainerType< ElementType > const &  rhs 
)

◆ concatContainersCopy() [1/2]

template<template< typename... > typename ContainerType, typename ElementType >
ContainerType< ElementType > Roar::concatContainersCopy ( ContainerType< ElementType >  lhs,
ContainerType< ElementType > &&  rhs 
)

◆ concatContainersCopy() [2/2]

template<template< typename... > typename ContainerType, typename ElementType >
ContainerType< ElementType > Roar::concatContainersCopy ( ContainerType< ElementType >  lhs,
ContainerType< ElementType > const &  rhs 
)

◆ demangleCppSymbol()

std::string Roar::demangleCppSymbol ( std::string const &  name,
std::vector< std::pair< std::string, std::string > > const &  replacers = {},
bool  format = false 
)
inline

Demangles a C++ symbol. Useful for tests or debugging purposes.

Parameters
nameThe mangled name
Returns
std::string A human readable demangled name,

◆ extendRouteInfo()

template<typename RequestListenerT >
auto Roar::extendRouteInfo ( RouteInfo< RequestListenerT >  info,
HandlerType< RequestListenerT >  handler 
)

◆ extendRouteInfoForServe()

template<typename RequestListenerT >
auto Roar::extendRouteInfoForServe ( ServeInfo< RequestListenerT >  info,
ServeHandlerType< RequestListenerT >  handler 
)

◆ extensionToMime()

std::optional< std::string > Roar::extensionToMime ( std::string const &  extension)

◆ getMimeMapping()

std::unordered_map< std::string, std::string > const & Roar::getMimeMapping ( )

◆ initializeServerSslContext()

void Roar::initializeServerSslContext ( SslServerContext ctx)

A function to simplify the creation of ssl contexts. Make one on your own if you need more sophisticated settings.

Parameters
settings
Returns
boost::asio::ssl::context

◆ makePermissiveCorsSettings() [1/2]

CorsSettings Roar::makePermissiveCorsSettings ( boost::beast::http::verb  method)
inline

Same as the makePermissiveCorsSettings(std::string method) overload.

Parameters
methodThe method to allow.
Returns
CorsSettings A created cors settings object.

◆ makePermissiveCorsSettings() [2/2]

CorsSettings Roar::makePermissiveCorsSettings ( std::string  method)
inline

Reflects all requested headers and origin or sets the Kleene star. Is as permissive as possible. Least secure option.

Parameters
methodThe method to allow.
Returns
CorsSettings A created cors settings object.

◆ makeSslContext()

boost::asio::ssl::context Roar::makeSslContext ( const std::string &  certificate,
const std::string &  privateKey 
)

◆ onSignal()

void Roar::onSignal ( int  sig)

◆ operator<<()

template<typename StreamT >
StreamT & Roar::operator<< ( StreamT &  stream,
Error  error 
)

◆ overloaded()

template<typename... Ts>
Roar::overloaded ( Ts...  ) -> overloaded< Ts... >

◆ resolvePath()

std::filesystem::path Roar::resolvePath ( std::filesystem::path const &  path)

Will replace prefixes like "~" and "%appdata%" with actual directories on linux and windows.

The percent values are case insensitive. ~ Linux: home. Windows: home userprofile% Linux: home. Windows: home appdata% Linux: home. Windows: CSIDL_APPDATA localappdata% Linux: home. Windows: CSIDL_APPDATA_LOCAL temp% Linux: /tmp. Windows: ${USER}\AppData\Local\Temp

Parameters
path
Returns
std::filesystem::path

◆ ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL() [1/3]

Roar::ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL ( Factory  )

◆ ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL() [2/3]

Roar::ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL ( Route  )

◆ ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL() [3/3]

Roar::ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL ( Router  )

◆ ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL_NO_DTOR()

Roar::ROAR_PIMPL_SPECIAL_FUNCTIONS_IMPL_NO_DTOR ( Session  )

◆ ScopeExit()

template<typename T >
Roar::ScopeExit ( ) -> ScopeExit< T >

◆ sha256()

std::optional< std::string > Roar::sha256 ( std::string_view  data)

◆ sha512()

std::optional< std::string > Roar::sha512 ( std::string_view  data)

◆ tmFormatter()

std::string Roar::tmFormatter ( std::tm *  tm,
const char suffix = nullptr 
)

◆ to_string()

std::string Roar::to_string ( AuthorizationScheme  scheme)

◆ unwrapFlexibleProvider() [1/2]

template<typename HolderClassT , typename T >
T Roar::unwrapFlexibleProvider ( HolderClassT &  holder,
FlexibleProvider< HolderClassT, T, false > const &  flexibleProvider 
)

◆ unwrapFlexibleProvider() [2/2]

template<typename HolderClassT , typename T >
std::optional< T > Roar::unwrapFlexibleProvider ( HolderClassT &  holder,
FlexibleProvider< HolderClassT, T, true > const &  flexibleProvider 
)

◆ urlDecode()

std::string Roar::urlDecode ( const std::string &  source)

◆ urlEncode()

std::string Roar::urlEncode ( const std::string &  source)

◆ visitOverloaded() [1/3]

template<typename... VariantTypes, typename... VisitFunctionTypes>
auto Roar::visitOverloaded ( std::variant< VariantTypes... > &&  variant,
VisitFunctionTypes &&...  visitFunctions 
)

◆ visitOverloaded() [2/3]

template<typename... VariantTypes, typename... VisitFunctionTypes>
auto Roar::visitOverloaded ( std::variant< VariantTypes... > &  variant,
VisitFunctionTypes &&...  visitFunctions 
)

◆ visitOverloaded() [3/3]

template<typename... VariantTypes, typename... VisitFunctionTypes>
auto Roar::visitOverloaded ( std::variant< VariantTypes... > const &  variant,
VisitFunctionTypes &&...  visitFunctions 
)

Variable Documentation

◆ shutdownBarrier

ShutdownBarrier Roar::shutdownBarrier