aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2022-03-30 09:56:59 +0200
committerSimon Rozman <simon@rozman.si>2022-03-30 09:56:59 +0200
commit9dfa703c396d7365bb9d8c08e73301d6363f8ecd (patch)
treeb5bd106d210f525b15cd0a3b3a9c587bd4639aa2
parentproj: stop building for arm32 (diff)
downloadwireguard-nt-9dfa703c396d7365bb9d8c08e73301d6363f8ecd.tar.xz
wireguard-nt-9dfa703c396d7365bb9d8c08e73301d6363f8ecd.zip
api: header: add C++ enum manipulation operators
C++ doesn't have bitwise operators on enums by default. Rather than reinventing the wheel, we use an undocumented DEFINE_ENUM_FLAG_OPERATORS macro from Windows SDK to implement the enum operators. Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r--api/wireguard.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/api/wireguard.h b/api/wireguard.h
index 61d9c3d..50ff5f6 100644
--- a/api/wireguard.h
+++ b/api/wireguard.h
@@ -231,6 +231,7 @@ typedef enum
WIREGUARD_PEER_REMOVE = 1 << 6, /**< Remove specified peer */
WIREGUARD_PEER_UPDATE_ONLY = 1 << 7 /**< Do not add a new peer */
} WIREGUARD_PEER_FLAG;
+DEFINE_ENUM_FLAG_OPERATORS(WIREGUARD_PEER_FLAG)
typedef struct _WIREGUARD_PEER WIREGUARD_PEER;
struct ALIGNED(8) _WIREGUARD_PEER
@@ -254,6 +255,7 @@ typedef enum
WIREGUARD_INTERFACE_HAS_LISTEN_PORT = (1 << 2), /**< The ListenPort field is set */
WIREGUARD_INTERFACE_REPLACE_PEERS = (1 << 3) /**< Remove all peers before adding new ones */
} WIREGUARD_INTERFACE_FLAG;
+DEFINE_ENUM_FLAG_OPERATORS(WIREGUARD_INTERFACE_FLAG)
typedef struct _WIREGUARD_INTERFACE WIREGUARD_INTERFACE;
struct ALIGNED(8) _WIREGUARD_INTERFACE