1#include <xrpl/beast/utility/instrumentation.h>
2#include <xrpl/protocol/Feature.h>
3#include <xrpl/protocol/Permissions.h>
4#include <xrpl/protocol/jss.h>
11#pragma push_macro("TRANSACTION")
14#define TRANSACTION(tag, value, name, delegable, amendment, ...) {value, amendment},
16#include <xrpl/protocol/detail/transactions.macro>
19#pragma pop_macro("TRANSACTION")
23#pragma push_macro("TRANSACTION")
26#define TRANSACTION(tag, value, name, delegable, ...) {value, delegable},
28#include <xrpl/protocol/detail/transactions.macro>
31#pragma pop_macro("TRANSACTION")
35#pragma push_macro("PERMISSION")
38#define PERMISSION(type, txType, value) {#type, type},
40#include <xrpl/protocol/detail/permissions.macro>
43#pragma pop_macro("PERMISSION")
47#pragma push_macro("PERMISSION")
50#define PERMISSION(type, txType, value) {type, #type},
52#include <xrpl/protocol/detail/permissions.macro>
55#pragma pop_macro("PERMISSION")
59#pragma push_macro("PERMISSION")
62#define PERMISSION(type, txType, value) {type, txType},
64#include <xrpl/protocol/detail/permissions.macro>
67#pragma pop_macro("PERMISSION")
72 permission.second > UINT16_MAX,
73 "xrpl::Permission::granularPermissionMap_ : granular permission "
74 "value must not exceed the maximum uint16_t value.");
94 return item->getName();
104 return static_cast<uint32_t
>(it->second);
133 XRPL_ASSERT(txFeaturesIt !=
txFeatureMap_.end(),
"xrpl::Permissions::getTxFeature : tx exists in txFeatureMap_");
135 if (txFeaturesIt->second ==
uint256{})
137 return txFeaturesIt->second;
144 if (granularPermission)
155 XRPL_ASSERT(txFeaturesIt !=
txFeatureMap_.end(),
"xrpl::Permissions::isDelegable : tx exists in txFeatureMap_");
160 if (txFeaturesIt->second !=
uint256{} && !rules.
enabled(txFeaturesIt->second))
172 return static_cast<uint32_t
>(type) + 1;
178 return static_cast<TxType>(value - 1);
std::optional< std::string > getGranularName(GranularPermissionType const &value) const
std::unordered_map< std::uint16_t, Delegation > delegableTx_
std::optional< std::uint32_t > getGranularValue(std::string const &name) const
TxType permissionToTxType(uint32_t const &value) const
std::optional< TxType > getGranularTxType(GranularPermissionType const &gpType) const
std::optional< std::string > getPermissionName(std::uint32_t const value) const
uint32_t txToPermissionType(TxType const &type) const
bool isDelegable(std::uint32_t const &permissionValue, Rules const &rules) const
std::optional< std::reference_wrapper< uint256 const > > const getTxFeature(TxType txType) const
std::unordered_map< GranularPermissionType, std::string > granularNameMap_
std::unordered_map< std::uint16_t, uint256 > txFeatureMap_
std::unordered_map< std::string, GranularPermissionType > granularPermissionMap_
std::unordered_map< GranularPermissionType, TxType > granularTxTypeMap_
static Permission const & getInstance()
Rules controlling protocol behavior.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
TxType
Transaction type identifiers.
GranularPermissionType
We have both transaction type permissions and granular type permissions.