1
"""All the C imports for 0MQ"""
4
# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
6
# This file is part of pyzmq.
8
# pyzmq is free software; you can redistribute it and/or modify it under
9
# the terms of the Lesser GNU General Public License as published by
10
# the Free Software Foundation; either version 3 of the License, or
11
# (at your option) any later version.
13
# pyzmq is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# Lesser GNU General Public License for more details.
18
# You should have received a copy of the Lesser GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#-----------------------------------------------------------------------------
24
#-----------------------------------------------------------------------------
26
#-----------------------------------------------------------------------------
27
# Import the C header files
28
#-----------------------------------------------------------------------------
31
ctypedef void* const_void_ptr "const void *"
33
cdef extern from "allocate.h":
34
object allocate(size_t n, void **pp)
36
cdef extern from "errno.h" nogil:
37
enum: ZMQ_EINVAL "EINVAL"
38
enum: ZMQ_EAGAIN "EAGAIN"
39
enum: ZMQ_EFAULT "EFAULT"
40
enum: ZMQ_ENOMEM "ENOMEM"
41
enum: ZMQ_ENODEV "ENODEV"
43
cdef extern from "string.h" nogil:
44
void *memcpy(void *dest, void *src, size_t n)
45
size_t strlen(char *s)
47
cdef extern from "zmq_compat.h":
48
ctypedef signed long long int64_t "pyzmq_int64_t"
50
cdef extern from "zmq.h" nogil:
52
void _zmq_version "zmq_version"(int *major, int *minor, int *patch)
54
ctypedef int fd_t "ZMQ_FD_T"
56
enum: ZMQ_VERSION_MAJOR
57
enum: ZMQ_VERSION_MINOR
58
enum: ZMQ_VERSION_PATCH
62
enum: ZMQ_ENOTSUP "ENOTSUP"
63
enum: ZMQ_EPROTONOSUPPORT "EPROTONOSUPPORT"
64
enum: ZMQ_ENOBUFS "ENOBUFS"
65
enum: ZMQ_ENETDOWN "ENETDOWN"
66
enum: ZMQ_EADDRINUSE "EADDRINUSE"
67
enum: ZMQ_EADDRNOTAVAIL "EADDRNOTAVAIL"
68
enum: ZMQ_ECONNREFUSED "ECONNREFUSED"
69
enum: ZMQ_EINPROGRESS "EINPROGRESS"
70
enum: ZMQ_EMTHREAD "EMTHREAD"
72
enum: ZMQ_ENOCOMPATPROTO "ENOCOMPATPROTO"
73
enum: ZMQ_ETERM "ETERM"
74
enum: ZMQ_ECANTROUTE "ECANTROUTE"
77
char *zmq_strerror (int errnum)
80
enum: ZMQ_MAX_VSM_SIZE # 30
81
enum: ZMQ_DELIMITER # 31
83
enum: ZMQ_MSG_MORE # 1
84
enum: ZMQ_MSG_SHARED # 128
86
# blackbox def for zmq_msg_t
87
ctypedef void * zmq_msg_t "zmq_msg_t"
89
ctypedef void zmq_free_fn(void *data, void *hint)
91
int zmq_msg_init (zmq_msg_t *msg)
92
int zmq_msg_init_size (zmq_msg_t *msg, size_t size)
93
int zmq_msg_init_data (zmq_msg_t *msg, void *data,
94
size_t size, zmq_free_fn *ffn, void *hint)
95
int zmq_msg_close (zmq_msg_t *msg)
96
int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src)
97
int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src)
98
void *zmq_msg_data (zmq_msg_t *msg)
99
size_t zmq_msg_size (zmq_msg_t *msg)
101
void *zmq_init (int io_threads)
102
int zmq_term (void *context)
110
enum: ZMQ_DEALER # 5 or 12
112
enum: ZMQ_ROUTER # 6 or 11 or 13
117
enum: ZMQ_UPSTREAM # 7
118
enum: ZMQ_DOWNSTREAM # 8
122
enum: ZMQ_AFFINITY # 4
123
enum: ZMQ_IDENTITY # 5
124
enum: ZMQ_SUBSCRIBE # 6
125
enum: ZMQ_UNSUBSCRIBE # 7
127
enum: ZMQ_RECOVERY_IVL # 9
128
enum: ZMQ_MCAST_LOOP # 10
129
enum: ZMQ_SNDBUF # 11
130
enum: ZMQ_RCVBUF # 12
131
enum: ZMQ_RCVMORE # 13
133
enum: ZMQ_EVENTS # 15
135
enum: ZMQ_LINGER # 17
136
enum: ZMQ_RECONNECT_IVL # 18
137
enum: ZMQ_BACKLOG # 19
138
enum: ZMQ_RECOVERY_IVL_MSEC # 20
139
enum: ZMQ_RECONNECT_IVL_MAX # 21
140
enum: ZMQ_MAXMSGSIZE # 22
141
enum: ZMQ_SNDHWM # 23
142
enum: ZMQ_RCVHWM # 24
143
enum: ZMQ_MULTICAST_HOPS # 25
144
enum: ZMQ_RCVTIMEO # 27
145
enum: ZMQ_SNDTIMEO # 28
146
enum: ZMQ_RCVLABEL # 29
147
enum: ZMQ_RCVCMD # 30
149
enum: ZMQ_NOBLOCK # 1
150
enum: ZMQ_DONTWAIT # 1
151
enum: ZMQ_SNDMORE # 2
152
enum: ZMQ_SNDLABEL # 4
155
void *zmq_socket (void *context, int type)
156
int zmq_close (void *s)
157
int zmq_setsockopt (void *s, int option, void *optval, size_t optvallen)
158
int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen)
159
int zmq_bind (void *s, char *addr)
160
int zmq_connect (void *s, char *addr)
162
int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags)
163
int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags)
164
int zmq_sendbuf (void *s, const_void_ptr buf, size_t n, int flags)
165
int zmq_recvbuf (void *s, void *buf, size_t n, int flags)
168
enum: ZMQ_POLLOUT # 2
169
enum: ZMQ_POLLERR # 4
171
ctypedef struct zmq_pollitem_t:
179
int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
185
int zmq_device (int device_, void *insocket_, void *outsocket_)
187
cdef extern from "zmq_utils.h" nogil:
189
void *zmq_stopwatch_start ()
190
unsigned long zmq_stopwatch_stop (void *watch_)
191
void zmq_sleep (int seconds_)