aboutsummaryrefslogtreecommitdiff
path: root/src/net_permissions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net_permissions.cpp')
-rw-r--r--src/net_permissions.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/net_permissions.cpp b/src/net_permissions.cpp
index 29eec947c0..228453df20 100644
--- a/src/net_permissions.cpp
+++ b/src/net_permissions.cpp
@@ -23,12 +23,12 @@ namespace {
// The parse the following format "perm1,perm2@xxxxxx"
bool TryParsePermissionFlags(const std::string str, NetPermissionFlags& output, size_t& readen, bilingual_str& error)
{
- NetPermissionFlags flags = NetPermissionFlags::PF_NONE;
+ NetPermissionFlags flags = NetPermissionFlags::None;
const auto atSeparator = str.find('@');
// if '@' is not found (ie, "xxxxx"), the caller should apply implicit permissions
if (atSeparator == std::string::npos) {
- NetPermissions::AddFlag(flags, NetPermissionFlags::PF_ISIMPLICIT);
+ NetPermissions::AddFlag(flags, NetPermissionFlags::Implicit);
readen = 0;
}
// else (ie, "perm1,perm2@xxxxx"), let's enumerate the permissions by splitting by ',' and calculate the flags
@@ -44,14 +44,14 @@ bool TryParsePermissionFlags(const std::string str, NetPermissionFlags& output,
readen += len; // We read "perm1"
if (commaSeparator != std::string::npos) readen++; // We read ","
- if (permission == "bloomfilter" || permission == "bloom") NetPermissions::AddFlag(flags, NetPermissionFlags::PF_BLOOMFILTER);
- else if (permission == "noban") NetPermissions::AddFlag(flags, NetPermissionFlags::PF_NOBAN);
- else if (permission == "forcerelay") NetPermissions::AddFlag(flags, NetPermissionFlags::PF_FORCERELAY);
- else if (permission == "mempool") NetPermissions::AddFlag(flags, NetPermissionFlags::PF_MEMPOOL);
- else if (permission == "download") NetPermissions::AddFlag(flags, NetPermissionFlags::PF_DOWNLOAD);
- else if (permission == "all") NetPermissions::AddFlag(flags, NetPermissionFlags::PF_ALL);
- else if (permission == "relay") NetPermissions::AddFlag(flags, NetPermissionFlags::PF_RELAY);
- else if (permission == "addr") NetPermissions::AddFlag(flags, NetPermissionFlags::PF_ADDR);
+ if (permission == "bloomfilter" || permission == "bloom") NetPermissions::AddFlag(flags, NetPermissionFlags::BloomFilter);
+ else if (permission == "noban") NetPermissions::AddFlag(flags, NetPermissionFlags::NoBan);
+ else if (permission == "forcerelay") NetPermissions::AddFlag(flags, NetPermissionFlags::ForceRelay);
+ else if (permission == "mempool") NetPermissions::AddFlag(flags, NetPermissionFlags::Mempool);
+ else if (permission == "download") NetPermissions::AddFlag(flags, NetPermissionFlags::Download);
+ else if (permission == "all") NetPermissions::AddFlag(flags, NetPermissionFlags::All);
+ else if (permission == "relay") NetPermissions::AddFlag(flags, NetPermissionFlags::Relay);
+ else if (permission == "addr") NetPermissions::AddFlag(flags, NetPermissionFlags::Addr);
else if (permission.length() == 0); // Allow empty entries
else {
error = strprintf(_("Invalid P2P permission: '%s'"), permission);
@@ -71,13 +71,13 @@ bool TryParsePermissionFlags(const std::string str, NetPermissionFlags& output,
std::vector<std::string> NetPermissions::ToStrings(NetPermissionFlags flags)
{
std::vector<std::string> strings;
- if (NetPermissions::HasFlag(flags, NetPermissionFlags::PF_BLOOMFILTER)) strings.push_back("bloomfilter");
- if (NetPermissions::HasFlag(flags, NetPermissionFlags::PF_NOBAN)) strings.push_back("noban");
- if (NetPermissions::HasFlag(flags, NetPermissionFlags::PF_FORCERELAY)) strings.push_back("forcerelay");
- if (NetPermissions::HasFlag(flags, NetPermissionFlags::PF_RELAY)) strings.push_back("relay");
- if (NetPermissions::HasFlag(flags, NetPermissionFlags::PF_MEMPOOL)) strings.push_back("mempool");
- if (NetPermissions::HasFlag(flags, NetPermissionFlags::PF_DOWNLOAD)) strings.push_back("download");
- if (NetPermissions::HasFlag(flags, NetPermissionFlags::PF_ADDR)) strings.push_back("addr");
+ if (NetPermissions::HasFlag(flags, NetPermissionFlags::BloomFilter)) strings.push_back("bloomfilter");
+ if (NetPermissions::HasFlag(flags, NetPermissionFlags::NoBan)) strings.push_back("noban");
+ if (NetPermissions::HasFlag(flags, NetPermissionFlags::ForceRelay)) strings.push_back("forcerelay");
+ if (NetPermissions::HasFlag(flags, NetPermissionFlags::Relay)) strings.push_back("relay");
+ if (NetPermissions::HasFlag(flags, NetPermissionFlags::Mempool)) strings.push_back("mempool");
+ if (NetPermissions::HasFlag(flags, NetPermissionFlags::Download)) strings.push_back("download");
+ if (NetPermissions::HasFlag(flags, NetPermissionFlags::Addr)) strings.push_back("addr");
return strings;
}