diff options
author | Simon Rozman <simon@rozman.si> | 2022-03-30 09:56:59 +0200 |
---|---|---|
committer | Simon Rozman <simon@rozman.si> | 2022-03-30 09:56:59 +0200 |
commit | 9dfa703c396d7365bb9d8c08e73301d6363f8ecd (patch) | |
tree | b5bd106d210f525b15cd0a3b3a9c587bd4639aa2 | |
parent | proj: stop building for arm32 (diff) | |
download | wireguard-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.h | 2 |
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 |