26#ifndef PCP_WIN_DEFINES
27#define PCP_WIN_DEFINES
36#define sleep(x) Sleep((x) * 1000)
39#define inline __inline
45static inline const char *pcp_inet_ntop(
int af,
const void *src,
char *dst,
48 struct sockaddr_storage srcaddr;
52 struct sockaddr_in *sa4=(
struct sockaddr_in *)&srcaddr;
53 memset(sa4, 0,
sizeof(
struct sockaddr_in));
54 memcpy(&(sa4->sin_addr), src,
sizeof(sa4->sin_addr));
55 slen=
sizeof(
struct sockaddr_in);
56 }
else if (af == AF_INET6) {
57 struct sockaddr_in6 *sa6=(
struct sockaddr_in6 *)&srcaddr;
58 memset(sa6, 0,
sizeof(
struct sockaddr_in6));
59 memcpy(&(sa6->sin6_addr), src,
sizeof(sa6->sin6_addr));
60 slen=
sizeof(
struct sockaddr_in6);
64 srcaddr.ss_family=(ADDRESS_FAMILY)af;
65 if (WSAAddressToStringA((
struct sockaddr *)&srcaddr, (DWORD)slen, 0, dst,
66 (LPDWORD) & cnt) != 0) {
71#define inet_ntop pcp_inet_ntop
74#define ssize_t SSIZE_T
77#define getpid GetCurrentProcessId
79#define snprintf _snprintf
83#define MSG_DONTWAIT 0x0
int gettimeofday(struct timeval *tv, struct timezone *tz)