aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib/embeddable-wg-library/wireguard.h
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2020-11-07 13:32:56 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-10-22 13:26:04 -0600
commitb906ecb614d93a69ef78c67bfd240554fbc95270 (patch)
tree37e2a9578d662a070fcc4cff0cfe488dc73aa271 /contrib/embeddable-wg-library/wireguard.h
parentipc: use more clever PnP enumerator (diff)
downloadwireguard-tools-b906ecb614d93a69ef78c67bfd240554fbc95270.tar.xz
wireguard-tools-b906ecb614d93a69ef78c67bfd240554fbc95270.zip
embeddable-wg-library: add named wg_endpoint union
Define wg_endpoint as a named union to allow users of the emeddable library to use the type in function arguments, variables etc. Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--contrib/embeddable-wg-library/wireguard.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/embeddable-wg-library/wireguard.h b/contrib/embeddable-wg-library/wireguard.h
index fbd8765..328fcb4 100644
--- a/contrib/embeddable-wg-library/wireguard.h
+++ b/contrib/embeddable-wg-library/wireguard.h
@@ -40,17 +40,19 @@ enum wg_peer_flags {
WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL = 1U << 4
};
+typedef union wg_endpoint {
+ struct sockaddr addr;
+ struct sockaddr_in addr4;
+ struct sockaddr_in6 addr6;
+} wg_endpoint;
+
typedef struct wg_peer {
enum wg_peer_flags flags;
wg_key public_key;
wg_key preshared_key;
- union {
- struct sockaddr addr;
- struct sockaddr_in addr4;
- struct sockaddr_in6 addr6;
- } endpoint;
+ wg_endpoint endpoint;
struct timespec64 last_handshake_time;
uint64_t rx_bytes, tx_bytes;