zmq_compat.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2010 Brian Granger, Min Ragan-Kelley
  3. //
  4. // Distributed under the terms of the New BSD License. The full license is in
  5. // the file LICENSE.BSD, distributed as part of this software.
  6. //-----------------------------------------------------------------------------
  7. #pragma once
  8. #if defined(_MSC_VER)
  9. #define pyzmq_int64_t __int64
  10. #define pyzmq_uint32_t unsigned __int32
  11. #else
  12. #include <stdint.h>
  13. #define pyzmq_int64_t int64_t
  14. #define pyzmq_uint32_t uint32_t
  15. #endif
  16. #include "zmq.h"
  17. #define _missing (-1)
  18. #if (ZMQ_VERSION >= 40303)
  19. // libzmq >= 4.3.3 defines zmq_fd_t for us
  20. #define ZMQ_FD_T zmq_fd_t
  21. #else
  22. #ifdef _WIN32
  23. #if defined(_MSC_VER) && _MSC_VER <= 1400
  24. #define ZMQ_FD_T UINT_PTR
  25. #else
  26. #define ZMQ_FD_T SOCKET
  27. #endif
  28. #else
  29. #define ZMQ_FD_T int
  30. #endif
  31. #endif
  32. #if (ZMQ_VERSION >= 40200)
  33. // Nothing to remove
  34. #else
  35. #define zmq_curve_public(z85_public_key, z85_secret_key) _missing
  36. #endif
  37. // use unambiguous aliases for zmq_send/recv functions
  38. #if ZMQ_VERSION_MAJOR >= 4
  39. // nothing to remove
  40. #if ZMQ_VERSION_MAJOR == 4 && ZMQ_VERSION_MINOR == 0
  41. // zmq 4.1 deprecates zmq_utils.h
  42. // we only get zmq_curve_keypair from it
  43. #include "zmq_utils.h"
  44. #endif
  45. #else
  46. #define zmq_curve_keypair(z85_public_key, z85_secret_key) _missing
  47. #endif
  48. // libzmq 4.2 draft API
  49. #ifdef ZMQ_BUILD_DRAFT_API
  50. #define PYZMQ_DRAFT_API 1
  51. #if ZMQ_VERSION >= 40200
  52. #define PYZMQ_DRAFT_42
  53. #endif
  54. #if ZMQ_VERSION >= 40302
  55. #define PYZMQ_DRAFT_432
  56. #endif
  57. #else
  58. #define PYZMQ_DRAFT_API 0
  59. #endif
  60. #ifndef PYZMQ_DRAFT_42
  61. #define zmq_join(s, group) _missing
  62. #define zmq_leave(s, group) _missing
  63. #define zmq_msg_set_routing_id(msg, routing_id) _missing
  64. #define zmq_msg_routing_id(msg) 0
  65. #define zmq_msg_set_group(msg, group) _missing
  66. #define zmq_msg_group(msg) NULL
  67. #define zmq_poller_new() NULL
  68. #define zmq_poller_destroy(poller_p) _missing
  69. #define zmq_poller_add(poller, socket, userdata, events) _missing
  70. #define zmq_poller_modify(poller, socket, events) _missing
  71. #define zmq_poller_remove(poller, socket) _missing
  72. #endif
  73. #ifndef PYZMQ_DRAFT_432
  74. #define zmq_poller_fd(poller, fd) _missing
  75. #endif
  76. #if ZMQ_VERSION >= 40100
  77. // nothing to remove
  78. #else
  79. #define zmq_msg_gets(msg, prop) _missing
  80. #define zmq_has(capability) _missing
  81. #define zmq_proxy_steerable(in, out, mon, ctrl) _missing
  82. #endif
  83. // 3.x deprecations - these symbols haven't been removed,
  84. // but let's protect against their planned removal
  85. #define zmq_device(device_type, isocket, osocket) _missing
  86. #define zmq_init(io_threads) ((void*)NULL)
  87. #define zmq_term zmq_ctx_destroy