]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
embeddable-wg-library: add named wg_endpoint union
authorMikael Magnusson <mikma@users.sourceforge.net>
Sat, 7 Nov 2020 12:32:56 +0000 (13:32 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 22 Oct 2021 19:26:04 +0000 (13:26 -0600)
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>
contrib/embeddable-wg-library/wireguard.h

index fbd8765ff29a099783a1a03ac2dfeafc6fd9ea99..328fcb423d90d24a8ac709b66f151e21f82deda7 100644 (file)
@@ -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;