Skip to content

Commit b906ecb

Browse files
mikmazx2c4
authored andcommitted
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>
1 parent 1ee37b8 commit b906ecb

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

contrib/embeddable-wg-library/wireguard.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,19 @@ enum wg_peer_flags {
4040
WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL = 1U << 4
4141
};
4242

43+
typedef union wg_endpoint {
44+
struct sockaddr addr;
45+
struct sockaddr_in addr4;
46+
struct sockaddr_in6 addr6;
47+
} wg_endpoint;
48+
4349
typedef struct wg_peer {
4450
enum wg_peer_flags flags;
4551

4652
wg_key public_key;
4753
wg_key preshared_key;
4854

49-
union {
50-
struct sockaddr addr;
51-
struct sockaddr_in addr4;
52-
struct sockaddr_in6 addr6;
53-
} endpoint;
55+
wg_endpoint endpoint;
5456

5557
struct timespec64 last_handshake_time;
5658
uint64_t rx_bytes, tx_bytes;

0 commit comments

Comments
 (0)