Bitcoin ABC  0.22.13
P2P Digital Currency
net_permissions.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2018 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_NET_PERMISSIONS_H
6 #define BITCOIN_NET_PERMISSIONS_H
7 
8 #include <netaddress.h>
9 
10 #include <string>
11 #include <vector>
12 
13 struct bilingual_str;
14 
16  PF_NONE = 0,
17  // Can query bloomfilter even if -peerbloomfilters is false
18  PF_BLOOMFILTER = (1U << 1),
19  // Relay and accept transactions from this peer, even if -blocksonly is true
20  PF_RELAY = (1U << 3),
21  // Always relay transactions from this peer, even if already in mempool or
22  // rejected from policy Keep parameter interaction: forcerelay implies relay
23  PF_FORCERELAY = (1U << 2) | PF_RELAY,
24  // Can't be banned/disconnected/discouraged for misbehavior
25  PF_NOBAN = (1U << 4),
26  // Can query the mempool
27  PF_MEMPOOL = (1U << 5),
28 
29  // True if the user did not specifically set fine grained permissions
30  PF_ISIMPLICIT = (1U << 31),
32 };
34 public:
36  static std::vector<std::string> ToStrings(NetPermissionFlags flags);
37  static inline bool HasFlag(const NetPermissionFlags &flags,
39  return (flags & f) == f;
40  }
41  static inline void AddFlag(NetPermissionFlags &flags,
43  flags = static_cast<NetPermissionFlags>(flags | f);
44  }
45  static inline void ClearFlag(NetPermissionFlags &flags,
47  flags = static_cast<NetPermissionFlags>(flags & ~f);
48  }
49 };
51 public:
52  static bool TryParse(const std::string str, NetWhitebindPermissions &output,
55 };
56 
58 public:
59  static bool TryParse(const std::string str, NetWhitelistPermissions &output,
62 };
63 
64 #endif // BITCOIN_NET_PERMISSIONS_H
static void AddFlag(NetPermissionFlags &flags, NetPermissionFlags f)
Bilingual messages:
Definition: translation.h:17
static void ClearFlag(NetPermissionFlags &flags, NetPermissionFlags f)
A combination of a network address (CNetAddr) and a (TCP) port.
Definition: netaddress.h:179
static bool HasFlag(const NetPermissionFlags &flags, NetPermissionFlags f)
NetPermissionFlags
NetPermissionFlags m_flags
int flags
Definition: bitcoin-tx.cpp:529
bool error(const char *fmt, const Args &... args)
Definition: system.h:47
static std::vector< std::string > ToStrings(NetPermissionFlags flags)