miniupnpc_socketdef.h 899 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* $Id: miniupnpc_socketdef.h,v 1.1 2018/03/13 23:44:10 nanard Exp $ */
  2. /* Miniupnp project : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
  3. * Author : Thomas Bernard
  4. * Copyright (c) 2018 Thomas Bernard
  5. * This software is subject to the conditions detailed in the
  6. * LICENCE file provided within this distribution */
  7. #ifndef MINIUPNPC_SOCKETDEF_H_INCLUDED
  8. #define MINIUPNPC_SOCKETDEF_H_INCLUDED
  9. #ifdef _MSC_VER
  10. #define ISINVALID(s) (INVALID_SOCKET==(s))
  11. #else
  12. #ifndef SOCKET
  13. #define SOCKET int
  14. #endif
  15. #ifndef SSIZE_T
  16. #define SSIZE_T ssize_t
  17. #endif
  18. #ifndef INVALID_SOCKET
  19. #define INVALID_SOCKET (-1)
  20. #endif
  21. #ifndef ISINVALID
  22. #define ISINVALID(s) ((s)<0)
  23. #endif
  24. #endif
  25. #ifdef _WIN32
  26. #define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
  27. #else
  28. #define PRINT_SOCKET_ERROR(x) perror(x)
  29. #endif
  30. #endif /* MINIUPNPC_SOCKETDEF_H_INCLUDED */