aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/netbase.h')
-rw-r--r--src/netbase.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/netbase.h b/src/netbase.h
index b225f128e7..751f7eb3f0 100644
--- a/src/netbase.h
+++ b/src/netbase.h
@@ -18,6 +18,7 @@
#include <memory>
#include <stdint.h>
#include <string>
+#include <type_traits>
#include <vector>
extern int nConnectTimeout;
@@ -28,6 +29,22 @@ static const int DEFAULT_CONNECT_TIMEOUT = 5000;
//! -dns default
static const int DEFAULT_NAME_LOOKUP = true;
+enum class ConnectionDirection {
+ None = 0,
+ In = (1U << 0),
+ Out = (1U << 1),
+ Both = (In | Out),
+};
+static inline ConnectionDirection& operator|=(ConnectionDirection& a, ConnectionDirection b) {
+ using underlying = typename std::underlying_type<ConnectionDirection>::type;
+ a = ConnectionDirection(underlying(a) | underlying(b));
+ return a;
+}
+static inline bool operator&(ConnectionDirection a, ConnectionDirection b) {
+ using underlying = typename std::underlying_type<ConnectionDirection>::type;
+ return (underlying(a) & underlying(b));
+}
+
class proxyType
{
public: