UpnpInet.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef UPNPINET_H
  2. #define UPNPINET_H
  3. /*!
  4. * \addtogroup Sock
  5. *
  6. * @{
  7. *
  8. * \file
  9. *
  10. * \brief Provides a platform independent way to include TCP/IP types and functions.
  11. */
  12. #include "UpnpUniStd.h" /* for close() */
  13. #ifdef WIN32
  14. #include <stdarg.h>
  15. #ifndef UPNP_USE_MSVCPP
  16. /* Removed: not required (and cause compilation issues) */
  17. #include <winbase.h>
  18. #include <windef.h>
  19. #endif
  20. #include <winsock2.h>
  21. #include <iphlpapi.h>
  22. #include <ws2tcpip.h>
  23. #define UpnpCloseSocket closesocket
  24. #if(_WIN32_WINNT < 0x0600)
  25. typedef short sa_family_t;
  26. #else
  27. typedef ADDRESS_FAMILY sa_family_t;
  28. #endif
  29. #else /* WIN32 */
  30. #include <sys/param.h>
  31. #if defined(__sun)
  32. #include <fcntl.h>
  33. #include <sys/sockio.h>
  34. #elif (defined(BSD) && BSD >= 199306) || defined (__FreeBSD_kernel__)
  35. #include <ifaddrs.h>
  36. /* Do not move or remove the include below for "sys/socket"!
  37. * Will break FreeBSD builds. */
  38. #include <sys/socket.h>
  39. #endif
  40. #include <arpa/inet.h> /* for inet_pton() */
  41. #include <net/if.h>
  42. #include <netinet/in.h>
  43. /*! This typedef makes the code slightly more WIN32 tolerant.
  44. * On WIN32 systems, SOCKET is unsigned and is not a file
  45. * descriptor. */
  46. typedef int SOCKET;
  47. /*! INVALID_SOCKET is unsigned on win32. */
  48. #define INVALID_SOCKET (-1)
  49. /*! select() returns SOCKET_ERROR on win32. */
  50. #define SOCKET_ERROR (-1)
  51. /*! Alias to close() to make code more WIN32 tolerant. */
  52. #define UpnpCloseSocket close
  53. #endif /* WIN32 */
  54. /* @} Sock */
  55. #endif /* UPNPINET_H */