compat.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* Copyright (c) 2003-2004, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. #ifndef TOR_COMPAT_H
  6. #define TOR_COMPAT_H
  7. #include "orconfig.h"
  8. #ifdef _WIN32
  9. #include <winsock2.h>
  10. #include <ws2tcpip.h>
  11. #ifndef SIO_IDEAL_SEND_BACKLOG_QUERY
  12. #define SIO_IDEAL_SEND_BACKLOG_QUERY 0x4004747b
  13. #endif
  14. #endif
  15. #include "lib/cc/torint.h"
  16. #include "lib/testsupport/testsupport.h"
  17. #ifdef HAVE_SYS_PARAM_H
  18. #include <sys/param.h>
  19. #endif
  20. #ifdef HAVE_SYS_TYPES_H
  21. #include <sys/types.h>
  22. #endif
  23. #ifdef HAVE_SYS_TIME_H
  24. #include <sys/time.h>
  25. #endif
  26. #ifdef HAVE_TIME_H
  27. #include <time.h>
  28. #endif
  29. #ifdef HAVE_STRING_H
  30. #include <string.h>
  31. #endif
  32. #include <stdarg.h>
  33. #ifdef HAVE_SYS_RESOURCE_H
  34. #include <sys/resource.h>
  35. #endif
  36. #ifdef HAVE_SYS_SOCKET_H
  37. #include <sys/socket.h>
  38. #endif
  39. #ifdef HAVE_NETINET_IN_H
  40. #include <netinet/in.h>
  41. #endif
  42. #ifdef HAVE_NETINET6_IN6_H
  43. #include <netinet6/in6.h>
  44. #endif
  45. #include "lib/cc/compat_compiler.h"
  46. #include "lib/arch/bytes.h"
  47. #include "lib/time/compat_time.h"
  48. #include "lib/string/compat_ctype.h"
  49. #include "lib/string/compat_string.h"
  50. #include "lib/string/printf.h"
  51. #include "lib/log/win32err.h"
  52. #include "lib/net/socket.h"
  53. #include "lib/net/ipv4.h"
  54. #include "lib/net/ipv6.h"
  55. #include "lib/net/resolve.h"
  56. #include "lib/fs/files.h"
  57. #include "lib/fs/mmap.h"
  58. #include "lib/fs/userdb.h"
  59. #include "lib/wallclock/timeval.h"
  60. #include "lib/intmath/cmp.h"
  61. #include <stdio.h>
  62. #include <errno.h>
  63. /* ===== Time compatibility */
  64. /* ===== File compatibility */
  65. /* ===== Net compatibility */
  66. /** Specified SOCKS5 status codes. */
  67. typedef enum {
  68. SOCKS5_SUCCEEDED = 0x00,
  69. SOCKS5_GENERAL_ERROR = 0x01,
  70. SOCKS5_NOT_ALLOWED = 0x02,
  71. SOCKS5_NET_UNREACHABLE = 0x03,
  72. SOCKS5_HOST_UNREACHABLE = 0x04,
  73. SOCKS5_CONNECTION_REFUSED = 0x05,
  74. SOCKS5_TTL_EXPIRED = 0x06,
  75. SOCKS5_COMMAND_NOT_SUPPORTED = 0x07,
  76. SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED = 0x08,
  77. } socks5_reply_status_t;
  78. /* ===== OS compatibility */
  79. /* This needs some of the declarations above so we include it here. */
  80. #include "lib/thread/threads.h"
  81. #endif /* !defined(TOR_COMPAT_H) */