• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef foopulsecoresockethfoo
2 #define foopulsecoresockethfoo
3 
4 #ifdef HAVE_SYS_SOCKET_H
5 #include <sys/socket.h>
6 #endif
7 
8 #ifdef HAVE_WINSOCK2_H
9 #include <winsock2.h>
10 #include "winerrno.h"
11 
12 typedef long suseconds_t;
13 
14 /** Windows 10 supports AF_UNIX as of build 17603, with
15     support provided in the header file <afunix.h>.  However,
16     only the latest Windows SDK provides this file; older SDKs and
17     MinGW do not.
18 
19     Hence we define SOCKADDR_UN here.  We do not expect this definition to change
20     as Windows has some pretty good binary backwards-compatibility guarantees.
21 
22     This shouldn't pose a problem for older versions of Windows; we expect them to
23     fail with an error whenever we try to make a socket of type AF_UNIX. */
24 #define UNIX_PATH_MAX 108
25 
26 typedef struct sockaddr_un
27 {
28      ADDRESS_FAMILY sun_family;     /* AF_UNIX */
29      char sun_path[UNIX_PATH_MAX];  /* pathname */
30 } SOCKADDR_UN, *PSOCKADDR_UN;
31 
32 #ifndef SUN_LEN
33 #define SUN_LEN(ptr) \
34     ((size_t)(((struct sockaddr_un *) 0)->sun_path) + strlen((ptr)->sun_path))
35 #endif
36 
37 #define HAVE_SYS_UN_H
38 
39 #endif
40 
41 #ifdef HAVE_WS2TCPIP_H
42 #include <ws2tcpip.h>
43 #endif
44 
45 #endif
46