zmq_compat.h revision 781d71db
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
8#if defined(_MSC_VER)
9#define pyzmq_int64_t __int64
10#else
11#include <stdint.h>
12#define pyzmq_int64_t int64_t
13#endif
14
15
16#include "zmq.h"
17// version compatibility for constants:
18#include "zmq_constants.h"
19
20#define _missing (-1)
21
22
23// define fd type (from libzmq's fd.hpp)
24#ifdef _WIN32
25  #ifdef _MSC_VER && _MSC_VER <= 1400
26    #define ZMQ_FD_T UINT_PTR
27  #else
28    #define ZMQ_FD_T SOCKET
29  #endif
30#else
31    #define ZMQ_FD_T int
32#endif
33
34// use unambiguous aliases for zmq_send/recv functions
35
36#if ZMQ_VERSION_MAJOR >= 4
37// nothing to remove
38#else
39    #define zmq_curve_keypair(z85_public_key, z85_secret_key) _missing
40#endif
41
42#if ZMQ_VERSION_MAJOR >= 4 && ZMQ_VERSION_MINOR >= 1
43// nothing to remove
44#else
45    #define zmq_msg_gets(msg, prop) _missing
46    #define zmq_has(capability) _missing
47#endif
48
49#if ZMQ_VERSION_MAJOR >= 3
50    #define zmq_sendbuf zmq_send
51    #define zmq_recvbuf zmq_recv
52
53    // 3.x deprecations - these symbols haven't been removed,
54    // but let's protect against their planned removal
55    #define zmq_device(device_type, isocket, osocket) _missing
56    #define zmq_init(io_threads) ((void*)NULL)
57    #define zmq_term zmq_ctx_destroy
58#else
59    #define zmq_ctx_set(ctx, opt, val) _missing
60    #define zmq_ctx_get(ctx, opt) _missing
61    #define zmq_ctx_destroy zmq_term
62    #define zmq_ctx_new() ((void*)NULL)
63
64    #define zmq_proxy(a,b,c) _missing
65
66    #define zmq_disconnect(s, addr) _missing
67    #define zmq_unbind(s, addr) _missing
68
69    #define zmq_msg_more(msg) _missing
70    #define zmq_msg_get(msg, opt) _missing
71    #define zmq_msg_set(msg, opt, val) _missing
72    #define zmq_msg_send(msg, s, flags) zmq_send(s, msg, flags)
73    #define zmq_msg_recv(msg, s, flags) zmq_recv(s, msg, flags)
74
75    #define zmq_sendbuf(s, buf, len, flags) _missing
76    #define zmq_recvbuf(s, buf, len, flags) _missing
77
78    #define zmq_socket_monitor(s, addr, flags) _missing
79
80#endif
81