Namespaces | |
| namespace | cmd |
| namespace | http |
| namespace | native |
| namespace | parse |
| namespace | utils |
Classes | |
| class | AuthManager |
| class | EVM |
| class | EVMStorage |
| class | Keccak256 |
| class | Registry |
| A class that represents a registry of features, transformations, and conditions. More... | |
| class | RouteArg |
| A class representing a route argument. More... | |
| struct | RouteArgDef |
| A pair of RouteArgType and RouteArgRequirement. More... | |
| class | RouteHandlerFunc |
| A class representing a route handler function. More... | |
| class | RouteKey |
| A class representing a route key, which is a combination of a HTTP method and a URL. More... | |
| class | Router |
| A class representing a router for handling HTTP requests. More... | |
| class | Server |
| A class representing a server for handling HTTP requests. More... | |
| class | Session |
| class | SessionManager |
Typedefs | |
| using | QueryArgsList = absl::flat_hash_map< std::string, RouteArg > |
| using | HandlerDefinition = std::function< asio::awaitable< dcn::http::Response >(const dcn::http::Request &, std::vector< RouteArg >, QueryArgsList)> |
| Type representing a route handler function. | |
| using | SessionID = std::string |
| using | UserID = std::string |
Enumerations | |
| enum class | AuthenticationError : std::uint8_t { Unknown = 0 , MissingCookie , InvalidCookie , MissingToken , InvalidToken , InvalidSignature , InvalidNonce , InvalidAddress } |
| enum class | RouteArgType { Unknown = 0 , character , unsigned_integer , base58 , string , array , object } |
| Enum to represent the type of a route argument. More... | |
| enum class | RouteArgRequirement { Unknown = 0 , optional , required } |
| Enum to represent the requirement of a route argument. More... | |
Functions | |
| void | setCORSHeaders (const http::Request &request, http::Response &response) |
| asio::awaitable< std::expected< evmc::address, AuthenticationError > > | authenticate (const http::Request &request, const AuthManager &auth_manager) |
| asio::awaitable< http::Response > | GET_version (const http::Request &, std::vector< RouteArg >, QueryArgsList, const std::string &build_timestamp) |
| asio::awaitable< http::Response > | HEAD_ServeFile (const http::Request &, std::vector< RouteArg >, QueryArgsList) |
| asio::awaitable< http::Response > | OPTIONS_ServeFile (const http::Request &, std::vector< RouteArg >, QueryArgsList) |
| asio::awaitable< http::Response > | GET_ServeFile (const http::Request &, std::vector< RouteArg >, QueryArgsList, const std::string mime_type, const std::string &file_content) |
| asio::awaitable< http::Response > | GET_ServeBinaryFile (const http::Request &, std::vector< RouteArg >, QueryArgsList, const std::string mime_type, const std::vector< std::byte > &file_content) |
| asio::awaitable< http::Response > | GET_nonce (const http::Request &, std::vector< RouteArg >, QueryArgsList, AuthManager &) |
| Handle a GET request to /auth/nonce. | |
| asio::awaitable< http::Response > | OPTIONS_auth (const http::Request &, std::vector< RouteArg >, QueryArgsList) |
| asio::awaitable< http::Response > | POST_auth (const http::Request &, std::vector< RouteArg >, QueryArgsList, AuthManager &) |
| Handles a POST request to /auth. | |
| asio::awaitable< http::Response > | OPTIONS_refresh (const http::Request &, std::vector< RouteArg >, QueryArgsList) |
| asio::awaitable< http::Response > | POST_refresh (const http::Request &, std::vector< RouteArg >, QueryArgsList, AuthManager &) |
| Handles a POST request to /auth/refresh. | |
| asio::awaitable< http::Response > | OPTIONS_accountInfo (const http::Request &request, std::vector< RouteArg >, QueryArgsList) |
| asio::awaitable< http::Response > | GET_accountInfo (const http::Request &, std::vector< RouteArg >, QueryArgsList, Registry ®istry) |
| asio::awaitable< http::Response > | OPTIONS_feature (const http::Request &, std::vector< RouteArg >, QueryArgsList) |
| asio::awaitable< http::Response > | GET_feature (const http::Request &, std::vector< RouteArg >, QueryArgsList, Registry ®istry, EVM &evm) |
| Returns the newest feature by name or a specific feature by name and id if the id is provided in the url. | |
| asio::awaitable< http::Response > | POST_feature (const http::Request &, std::vector< RouteArg >, QueryArgsList, AuthManager &auth_manager, Registry ®istry, EVM &evm) |
| Handle a POST request to /features. | |
| asio::awaitable< http::Response > | OPTIONS_transformation (const http::Request &, std::vector< RouteArg >, QueryArgsList) |
| asio::awaitable< http::Response > | GET_transformation (const http::Request &, std::vector< RouteArg > args, QueryArgsList, Registry ®istry, EVM &evm) |
| asio::awaitable< http::Response > | POST_transformation (const http::Request &, std::vector< RouteArg > args, QueryArgsList, AuthManager &auth_manager, Registry ®istry, EVM &evm) |
| asio::awaitable< http::Response > | OPTIONS_execute (const http::Request &, std::vector< RouteArg >, QueryArgsList) |
| asio::awaitable< http::Response > | GET_execute (const http::Request &request, std::vector< RouteArg > args, QueryArgsList, const AuthManager &auth_manager, const Registry ®istry, EVM &evm) |
| asio::awaitable< http::Response > | GET_condition (const http::Request &) |
| asio::awaitable< http::Response > | POST_condition (const http::Request &) |
| asio::awaitable< std::expected< std::vector< std::uint8_t >, evmc_status_code > > | fetchOwner (EVM &evm, const evmc::address &address) |
| std::vector< std::uint8_t > | constructFunctionSelector (std::string signature) |
| template<class T > | |
| std::vector< std::uint8_t > | encodeAsArg (const T &val) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< evmc::address > (const evmc::address &address) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< std::uint32_t > (const std::uint32_t &value) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< std::vector< std::uint32_t > > (const std::vector< std::uint32_t > &vec) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< std::vector< std::tuple< std::uint32_t, std::uint32_t > > > (const std::vector< std::tuple< std::uint32_t, std::uint32_t > > &vec) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< std::string > (const std::string &str) |
| template<class T > | |
| T | decodeReturnedValue (const std::vector< std::uint8_t > &bytes) |
| template<> | |
| std::vector< std::vector< std::uint32_t > > | decodeReturnedValue (const std::vector< std::uint8_t > &bytes) |
| template<> | |
| evmc::address | decodeReturnedValue (const std::vector< std::uint8_t > &bytes) |
| template<> | |
| std::vector< Samples > | decodeReturnedValue (const std::vector< uint8_t > &bytes) |
| template<typename H > | |
| H | AbslHashValue (H h, const evmc::address &addr) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< evmc::address > (const evmc::address &address) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< std::uint32_t > (const std::uint32_t &value) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< std::vector< std::uint32_t > > (const std::vector< std::uint32_t > &vec) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< std::vector< std::tuple< std::uint32_t, std::uint32_t > > > (const std::vector< std::tuple< std::uint32_t, std::uint32_t > > &vec) |
| template<> | |
| std::vector< std::uint8_t > | encodeAsArg< std::string > (const std::string &str) |
| template<> | |
| std::vector< std::vector< uint32_t > > | decodeReturnedValue (const std::vector< std::uint8_t > &bytes) |
| template<> | |
| evmc::address | decodeReturnedValue (const std::vector< std::uint8_t > &bytes) |
| template<> | |
| std::vector< Samples > | decodeReturnedValue (const std::vector< std::uint8_t > &bytes) |
| void | setBinPath (std::filesystem::path bin_path) |
| Set the BIN_PATH variable to the path of the binary directory. | |
| std::filesystem::path | getBinPath () |
| std::filesystem::path | getStoragePath () |
| std::filesystem::path | getResourcesPath () |
| std::filesystem::path | getLogsPath () |
| std::filesystem::path | getPTPath () |
| std::optional< std::string > | loadTextFile (std::filesystem::path path) |
| std::optional< std::vector< std::byte > > | loadBinaryFile (std::filesystem::path path) |
| asio::awaitable< bool > | deployFeature (EVM &evm, Registry ®istry, FeatureRecord feature) |
| asio::awaitable< bool > | deployTransformation (EVM &evm, Registry ®istry, TransformationRecord transformation) |
| asio::awaitable< bool > | loadStoredTransformations (EVM &evm, Registry ®istry) |
| asio::awaitable< bool > | loadStoredFeatures (EVM &evm, Registry ®istry) |
| template<typename H > | |
| H | AbslHashValue (H h, const Condition &c) |
| Combines hash values for a Condition object. | |
| template<typename H > | |
| H | AbslHashValue (H h, const TransformationDef &td) |
| Combines hash values for a TransformationDef object. | |
| template<typename H > | |
| H | AbslHashValue (H h, const Dimension &d) |
| Combines hash values for a Dimension object. | |
| template<typename H > | |
| H | AbslHashValue (H h, const Feature &f) |
| Combines hash values for a Feature object. | |
| std::string | constructFeatureSolidityCode (const Feature &feature) |
| template<typename H > | |
| H | AbslHashValue (H h, const Transformation &t) |
| Combines hash values for a Transformation object. | |
| std::string | constructTransformationSolidityCode (const Transformation &transformation) |
| template<typename H > | |
| H | AbslHashValue (H h, const RouteKey &route_key) |
| Combines hash values for a RouteKey object. | |
Variables | |
| const asio::ip::port_type | DEFAULT_PORT = 54321 |
| const asio::ip::port_type | DEFAULT_TLS_PORT = 54322 |
| const short int | MAJOR_VERSION = 0 |
| const short int | MINOR_VERSION = 0 |
| const short int | PATCH_VERSION = 1 |
| using dcn::HandlerDefinition = typedef std::function<asio::awaitable<dcn::http::Response>(const dcn::http::Request &, std::vector<RouteArg>, QueryArgsList)> |
Type representing a route handler function.
| using dcn::QueryArgsList = typedef absl::flat_hash_map<std::string, RouteArg> |
| using dcn::SessionID = typedef std::string |
| using dcn::UserID = typedef std::string |
|
strong |
|
strong |
|
strong |
Combines hash values for a Condition object.
| H | The hash state type. |
| h | The initial hash state. |
| c | The Condition object whose attributes will be hashed. |
Combines hash values for a Dimension object.
| H | The hash state type. |
| h | The initial hash state. |
| d | The Dimension object whose attributes will be hashed. |
Combines hash values for a Feature object.
| H | The hash state type. |
| h | The initial hash state. |
| f | The Feature object whose attributes will be hashed. |
Combines hash values for a Transformation object.
| H | The hash state type. |
| h | The initial hash state. |
| t | The Transformation object whose attributes will be hashed. |
Combines hash values for a TransformationDef object.
| H | The hash state type. |
| h | The initial hash state. |
| td | The TransformationDef object whose attributes will be hashed. |
| asio::awaitable< std::expected< evmc::address, AuthenticationError > > dcn::authenticate | ( | const http::Request & | request, |
| const AuthManager & | auth_manager | ||
| ) |
| std::vector< std::uint8_t > dcn::constructFunctionSelector | ( | std::string | signature | ) |
| std::string dcn::constructTransformationSolidityCode | ( | const Transformation & | transformation | ) |
| std::vector< std::vector< std::uint32_t > > dcn::decodeReturnedValue | ( | const std::vector< std::uint8_t > & | bytes | ) |
| evmc::address dcn::decodeReturnedValue | ( | const std::vector< std::uint8_t > & | bytes | ) |
| std::vector< std::vector< uint32_t > > dcn::decodeReturnedValue | ( | const std::vector< std::uint8_t > & | bytes | ) |
| evmc::address dcn::decodeReturnedValue | ( | const std::vector< std::uint8_t > & | bytes | ) |
| std::vector< Samples > dcn::decodeReturnedValue | ( | const std::vector< std::uint8_t > & | bytes | ) |
| asio::awaitable< bool > dcn::deployFeature | ( | EVM & | evm, |
| Registry & | registry, | ||
| FeatureRecord | feature | ||
| ) |
| asio::awaitable< bool > dcn::deployTransformation | ( | EVM & | evm, |
| Registry & | registry, | ||
| TransformationRecord | transformation | ||
| ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< evmc::address > | ( | const evmc::address & | address | ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< evmc::address > | ( | const evmc::address & | address | ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< std::string > | ( | const std::string & | str | ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< std::string > | ( | const std::string & | str | ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< std::uint32_t > | ( | const std::uint32_t & | value | ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< std::uint32_t > | ( | const std::uint32_t & | value | ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< std::vector< std::tuple< std::uint32_t, std::uint32_t > > > | ( | const std::vector< std::tuple< std::uint32_t, std::uint32_t > > & | vec | ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< std::vector< std::tuple< std::uint32_t, std::uint32_t > > > | ( | const std::vector< std::tuple< std::uint32_t, std::uint32_t > > & | vec | ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< std::vector< std::uint32_t > > | ( | const std::vector< std::uint32_t > & | vec | ) |
| std::vector< std::uint8_t > dcn::encodeAsArg< std::vector< std::uint32_t > > | ( | const std::vector< std::uint32_t > & | vec | ) |
| asio::awaitable< std::expected< std::vector< std::uint8_t >, evmc_status_code > > dcn::fetchOwner | ( | EVM & | evm, |
| const evmc::address & | address | ||
| ) |
| asio::awaitable< http::Response > dcn::GET_accountInfo | ( | const http::Request & | request, |
| std::vector< RouteArg > | args, | ||
| QueryArgsList | query_args, | ||
| Registry & | registry | ||
| ) |
| asio::awaitable< http::Response > dcn::GET_condition | ( | const http::Request & | ) |
| asio::awaitable< http::Response > dcn::GET_execute | ( | const http::Request & | request, |
| std::vector< RouteArg > | args, | ||
| QueryArgsList | , | ||
| const AuthManager & | auth_manager, | ||
| const Registry & | registry, | ||
| EVM & | evm | ||
| ) |
| asio::awaitable< http::Response > dcn::GET_feature | ( | const http::Request & | request, |
| std::vector< RouteArg > | args, | ||
| QueryArgsList | , | ||
| Registry & | registry, | ||
| EVM & | evm | ||
| ) |
Returns the newest feature by name or a specific feature by name and id if the id is provided in the url.
The url must be in one of the following formats:
| asio::awaitable< http::Response > dcn::GET_nonce | ( | const http::Request & | request, |
| std::vector< RouteArg > | args, | ||
| QueryArgsList | , | ||
| AuthManager & | auth_manager | ||
| ) |
Handle a GET request to /auth/nonce.
The url must be in the following format:
The response body will be a json string with the following format:
{ "nonce": "<nonce>" }
Where <nonce> is the generated nonce.
| asio::awaitable< http::Response > dcn::GET_ServeBinaryFile | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | , | ||
| const std::string | mime_type, | ||
| const std::vector< std::byte > & | file_content | ||
| ) |
| asio::awaitable< http::Response > dcn::GET_ServeFile | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | , | ||
| const std::string | mime_type, | ||
| const std::string & | file_content | ||
| ) |
Handles GET requests for a simple form by returning the form content.
| request | The incoming HTTP request (not used in this implementation) |
| routeArgs | Route arguments (not used in this implementation) |
| simple_form | The content of the simple form to be returned |
| asio::awaitable< http::Response > dcn::GET_transformation | ( | const http::Request & | request, |
| std::vector< RouteArg > | args, | ||
| QueryArgsList | , | ||
| Registry & | registry, | ||
| EVM & | evm | ||
| ) |
Handles GET requests for the transformation endpoint.
Retrieves a transformation by name and optional ID, and returns it as JSON.
| request | The incoming HTTP request |
| args | Route arguments (transformation name and optional ID) |
| registry | Registry instance for retrieving transformations |
| asio::awaitable< http::Response > dcn::GET_version | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | , | ||
| const std::string & | build_timestamp | ||
| ) |
| std::filesystem::path dcn::getBinPath | ( | ) |
| std::filesystem::path dcn::getLogsPath | ( | ) |
| std::filesystem::path dcn::getPTPath | ( | ) |
| std::filesystem::path dcn::getResourcesPath | ( | ) |
| std::filesystem::path dcn::getStoragePath | ( | ) |
| asio::awaitable< http::Response > dcn::HEAD_ServeFile | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | |||
| ) |
Handles HEAD requests for a simple form by returning a response with CORS headers.
| request | The incoming HTTP request (not used in this implementation) |
| routeArgs | Route arguments (not used in this implementation) |
| std::optional< std::vector< std::byte > > dcn::loadBinaryFile | ( | std::filesystem::path | path | ) |
| std::optional< std::string > dcn::loadTextFile | ( | std::filesystem::path | path | ) |
| asio::awaitable< http::Response > dcn::OPTIONS_accountInfo | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | |||
| ) |
| asio::awaitable< http::Response > dcn::OPTIONS_auth | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | |||
| ) |
| asio::awaitable< http::Response > dcn::OPTIONS_execute | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | |||
| ) |
| asio::awaitable< http::Response > dcn::OPTIONS_feature | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | |||
| ) |
Handles OPTIONS requests by returning a response with CORS headers.
| request | The incoming HTTP request (not used in this implementation) |
| routeArgs | Route arguments (not used in this implementation) |
| asio::awaitable< http::Response > dcn::OPTIONS_refresh | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | |||
| ) |
| asio::awaitable< http::Response > dcn::OPTIONS_ServeFile | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | |||
| ) |
Handles OPTIONS requests for a simple form by returning a response with CORS headers.
| request | The incoming HTTP request (not used in this implementation) |
| routeArgs | Route arguments (not used in this implementation) |
| asio::awaitable< http::Response > dcn::OPTIONS_transformation | ( | const http::Request & | request, |
| std::vector< RouteArg > | , | ||
| QueryArgsList | |||
| ) |
Handles OPTIONS requests for the transformation endpoint by returning a response with CORS headers.
| request | The incoming HTTP request (not used in this implementation) |
| routeArgs | Route arguments (not used in this implementation) |
| asio::awaitable< http::Response > dcn::POST_auth | ( | const http::Request & | request, |
| std::vector< RouteArg > | args, | ||
| QueryArgsList | , | ||
| AuthManager & | auth_manager | ||
| ) |
Handles a POST request to /auth.
The url must be in the following format:
The request body must be a json string in format
{ "address": "<address>", "signature": "<signature>", "message": "<message>" }
Where <address> is the address of the user who is trying to authenticate, <signature> is the signature of the message by the user, and <message> is the nonce generated by the server.
The response body will be a json string in format
{ "success": "true/false", }
| request | The request object |
| args | The arguments of the request |
| auth_manager | The authentication manager |
| asio::awaitable< http::Response > dcn::POST_condition | ( | const http::Request & | ) |
| asio::awaitable< http::Response > dcn::POST_feature | ( | const http::Request & | request, |
| std::vector< RouteArg > | args, | ||
| QueryArgsList | , | ||
| AuthManager & | auth_manager, | ||
| Registry & | registry, | ||
| EVM & | evm | ||
| ) |
Handle a POST request to /features.
The url must be in the following format:
The request body must be a json string representing a hm::Feature object.
The response body will be a json string with the following format:
{ "name": "<name>", "version": "<version>" }
Where <name> is the name of the feature and <version> is the hash of the feature.
| asio::awaitable< http::Response > dcn::POST_refresh | ( | const http::Request & | request, |
| std::vector< RouteArg > | args, | ||
| QueryArgsList | , | ||
| AuthManager & | auth_manager | ||
| ) |
Handles a POST request to /auth/refresh.
The url must be in the following format:
The request body must be a json string in format
{ "refresh_token": "<refresh_token>" }
Where <refresh_token> is the refresh token of the user who is trying to refresh their access token.
The response body will be a json string in format
{ "success": "true/false" }
| request | The request object |
| args | The arguments of the request |
| auth_manager | The authentication manager |
| asio::awaitable< http::Response > dcn::POST_transformation | ( | const http::Request & | request, |
| std::vector< RouteArg > | args, | ||
| QueryArgsList | , | ||
| AuthManager & | auth_manager, | ||
| Registry & | registry, | ||
| EVM & | evm | ||
| ) |
Handles POST requests for the transformation endpoint.
Verifies the access token in the cookie header, then adds a new transformation to the registry.
| request | The incoming HTTP request with the transformation data in the body |
| args | Route arguments (not used in this implementation) |
| auth_manager | Authentication manager instance for verifying access tokens |
| registry | Registry instance for adding transformations |
| void dcn::setBinPath | ( | std::filesystem::path | bin_path | ) |
Set the BIN_PATH variable to the path of the binary directory.
| bin_path | The path of the binary directory. |
| void dcn::setCORSHeaders | ( | const http::Request & | request, |
| http::Response & | response | ||
| ) |
| const asio::ip::port_type dcn::DEFAULT_PORT = 54321 |
| const asio::ip::port_type dcn::DEFAULT_TLS_PORT = 54322 |