zmq_compat.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 COPYING.BSD, distributed as part of this software.
  6. //-----------------------------------------------------------------------------
  7. #if defined(_MSC_VER)
  8. #define pyzmq_int64_t __int64
  9. #define pyzmq_uint32_t unsigned __int32
  10. #else
  11. #include <stdint.h>
  12. #define pyzmq_int64_t int64_t
  13. #define pyzmq_uint32_t uint32_t
  14. #endif
  15. #include "zmq.h"
  16. // version compatibility for constants:
  17. #include "zmq_constants.h"
  18. #define _missing (-1)
  19. // define fd type (from libzmq's fd.hpp)
  20. #ifdef _WIN32
  21. #if defined(_MSC_VER) && _MSC_VER <= 1400
  22. #define ZMQ_FD_T UINT_PTR
  23. #else
  24. #define ZMQ_FD_T SOCKET
  25. #endif
  26. #else
  27. #define ZMQ_FD_T int
  28. #endif
  29. #if ZMQ_VERSION_MAJOR >= 4 && ZMQ_VERSION_MINOR >= 2
  30. // Nothing to remove
  31. #else
  32. #define zmq_curve_public(z85_public_key, z85_secret_key) _missing
  33. #endif
  34. // use unambiguous aliases for zmq_send/recv functions
  35. #if ZMQ_VERSION_MAJOR >= 4
  36. // nothing to remove
  37. #if ZMQ_VERSION_MINOR == 0
  38. // zmq 4.1 deprecates zmq_utils.h
  39. // we only get zmq_curve_keypair from it
  40. #include "zmq_utils.h"
  41. #endif
  42. #else
  43. #define zmq_curve_keypair(z85_public_key, z85_secret_key) _missing
  44. #endif
  45. // libzmq 4.2 draft API
  46. #ifdef ZMQ_BUILD_DRAFT_API
  47. #if ZMQ_VERSION_MAJOR >= 4 && ZMQ_VERSION_MINOR >= 2
  48. #define PYZMQ_DRAFT_42
  49. #endif
  50. #endif
  51. #ifndef PYZMQ_DRAFT_42
  52. #define zmq_join(s, group) _missing
  53. #define zmq_leave(s, group) _missing
  54. #define zmq_msg_set_routing_id(msg, routing_id) _missing
  55. #define zmq_msg_routing_id(msg) 0
  56. #define zmq_msg_set_group(msg, group) _missing
  57. #define zmq_msg_group(msg) NULL
  58. #endif
  59. #if ZMQ_VERSION_MAJOR >= 4 && ZMQ_VERSION_MINOR >= 1
  60. // nothing to remove
  61. #else
  62. #define zmq_msg_gets(msg, prop) _missing
  63. #define zmq_has(capability) _missing
  64. #define zmq_proxy_steerable(in, out, mon, ctrl) _missing
  65. #endif
  66. #if ZMQ_VERSION_MAJOR >= 3
  67. #define zmq_sendbuf zmq_send
  68. #define zmq_recvbuf zmq_recv
  69. // 3.x deprecations - these symbols haven't been removed,
  70. // but let's protect against their planned removal
  71. #define zmq_device(device_type, isocket, osocket) _missing
  72. #define zmq_init(io_threads) ((void*)NULL)
  73. #define zmq_term zmq_ctx_destroy
  74. #else
  75. #define zmq_ctx_set(ctx, opt, val) _missing
  76. #define zmq_ctx_get(ctx, opt) _missing
  77. #define zmq_ctx_destroy zmq_term
  78. #define zmq_ctx_new() ((void*)NULL)
  79. #define zmq_proxy(a,b,c) _missing
  80. #define zmq_disconnect(s, addr) _missing
  81. #define zmq_unbind(s, addr) _missing
  82. #define zmq_msg_more(msg) _missing
  83. #define zmq_msg_get(msg, opt) _missing
  84. #define zmq_msg_set(msg, opt, val) _missing
  85. #define zmq_msg_send(msg, s, flags) zmq_send(s, msg, flags)
  86. #define zmq_msg_recv(msg, s, flags) zmq_recv(s, msg, flags)
  87. #define zmq_sendbuf(s, buf, len, flags) _missing
  88. #define zmq_recvbuf(s, buf, len, flags) _missing
  89. #define zmq_socket_monitor(s, addr, flags) _missing
  90. #endif