From 47397b090c8314d2b1b13d2b7746fd6a636bd282 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Wed, 4 Sep 2013 07:06:39 +0000 Subject: [PATCH] Create a union for all the different sockaddr_* types we may use. --- src/xpdev/sockwrap.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/xpdev/sockwrap.h b/src/xpdev/sockwrap.h index 9896248059..a7501ef236 100644 --- a/src/xpdev/sockwrap.h +++ b/src/xpdev/sockwrap.h @@ -59,6 +59,7 @@ #include <netdb.h> /* gethostbyname */ #include <sys/types.h> /* For u_int32_t on FreeBSD */ #include <netinet/in.h> /* IPPROTO_IP */ +#include <sys/un.h> /* define _BSD_SOCKLEN_T_ in order to define socklen_t on darwin */ #ifdef __DARWIN__ #define _BSD_SOCKLEN_T_ int @@ -86,6 +87,20 @@ typedef struct { int value; } socket_option_t; +/* + * Fancy sockaddr_* union + */ +union xp_sockaddr { + struct sockaddr addr; + struct sockaddr_in in; + struct sockaddr_in6 in6; +#ifndef _WIN32 + struct sockaddr_un un; +#endif + struct sockaddr_storage store; +}; + + /**********************************/ /* Socket Implementation-specific */ /**********************************/ -- GitLab