You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
732 B

10 years ago
  1. #ifndef _WIN32_H
  2. #define _WIN32_H
  3. #ifdef _WIN32_WINNT
  4. #undef _WIN32_WINNT
  5. #endif
  6. #define _WIN32_WINNT 0x0501
  7. #include <winsock2.h>
  8. #include <ws2tcpip.h>
  9. #include "utils.h"
  10. #ifdef EWOULDBLOCK
  11. #undef EWOULDBLOCK
  12. #endif
  13. #ifdef errno
  14. #undef errno
  15. #endif
  16. #ifdef ERROR
  17. #undef ERROR
  18. #endif
  19. #define EWOULDBLOCK WSAEWOULDBLOCK
  20. #define errno WSAGetLastError()
  21. #define close(fd) closesocket(fd)
  22. #define ERROR(s) ss_error(s)
  23. #define setsockopt(a, b, c, d, e) setsockopt(a, b, c, (char *) (d), e)
  24. void winsock_init(void);
  25. void winsock_cleanup(void);
  26. void ss_error(const char *s);
  27. size_t strnlen(const char *s, size_t maxlen);
  28. int setnonblocking(int fd);
  29. const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
  30. #endif