1
"""All the C imports for 0MQ"""
4
# Copyright (c) 2010 Brian E. Granger
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
enum: ZMQ_VERSION_MAJOR
55
enum: ZMQ_VERSION_MINOR
56
enum: ZMQ_VERSION_PATCH
60
enum: ZMQ_ENOTSUP "ENOTSUP"
61
enum: ZMQ_EPROTONOSUPPORT "EPROTONOSUPPORT"
62
enum: ZMQ_ENOBUFS "ENOBUFS"
63
enum: ZMQ_ENETDOWN "ENETDOWN"
64
enum: ZMQ_EADDRINUSE "EADDRINUSE"
65
enum: ZMQ_EADDRNOTAVAIL "EADDRNOTAVAIL"
66
enum: ZMQ_ECONNREFUSED "ECONNREFUSED"
67
enum: ZMQ_EINPROGRESS "EINPROGRESS"
68
enum: ZMQ_EMTHREAD "EMTHREAD"
70
enum: ZMQ_ENOCOMPATPROTO "ENOCOMPATPROTO"
71
enum: ZMQ_ETERM "ETERM"
74
char *zmq_strerror (int errnum)
77
enum: ZMQ_MAX_VSM_SIZE # 30
78
enum: ZMQ_DELIMITER # 31
80
enum: ZMQ_MSG_MORE # 1
81
enum: ZMQ_MSG_SHARED # 128
83
# blackbox def for zmq_msg_t
84
ctypedef void * zmq_msg_t "zmq_msg_t"
86
ctypedef void zmq_free_fn(void *data, void *hint)
88
int zmq_msg_init (zmq_msg_t *msg)
89
int zmq_msg_init_size (zmq_msg_t *msg, size_t size)
90
int zmq_msg_init_data (zmq_msg_t *msg, void *data,
91
size_t size, zmq_free_fn *ffn, void *hint)
92
int zmq_msg_close (zmq_msg_t *msg)
93
int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src)
94
int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src)
95
void *zmq_msg_data (zmq_msg_t *msg)
96
size_t zmq_msg_size (zmq_msg_t *msg)
98
void *zmq_init (int io_threads)
99
int zmq_term (void *context)
112
enum: ZMQ_UPSTREAM # 7
113
enum: ZMQ_DOWNSTREAM # 8
117
enum: ZMQ_AFFINITY # 4
118
enum: ZMQ_IDENTITY # 5
119
enum: ZMQ_SUBSCRIBE # 6
120
enum: ZMQ_UNSUBSCRIBE # 7
122
enum: ZMQ_RECOVERY_IVL # 9
123
enum: ZMQ_MCAST_LOOP # 10
124
enum: ZMQ_SNDBUF # 11
125
enum: ZMQ_RCVBUF # 12
126
enum: ZMQ_RCVMORE # 13
128
enum: ZMQ_EVENTS # 15
130
enum: ZMQ_LINGER # 17
131
enum: ZMQ_RECONNECT_IVL # 18
132
enum: ZMQ_BACKLOG # 19
133
enum: ZMQ_RECOVERY_IVL_MSEC # 20
134
enum: ZMQ_RECONNECT_IVL_MAX # 21
135
enum: ZMQ_MAXMSGSIZE # 22
136
enum: ZMQ_SNDHWM # 23
137
enum: ZMQ_RCVHWM # 24
139
enum: ZMQ_NOBLOCK # 1
140
enum: ZMQ_DONTWAIT # 1
141
enum: ZMQ_SNDMORE # 2
143
void *zmq_socket (void *context, int type)
144
int zmq_close (void *s)
145
int zmq_setsockopt (void *s, int option, void *optval, size_t optvallen)
146
int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen)
147
int zmq_bind (void *s, char *addr)
148
int zmq_connect (void *s, char *addr)
150
int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags)
151
int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags)
152
int zmq_sendbuf (void *s, const_void_ptr buf, size_t n, int flags)
153
int zmq_recvbuf (void *s, void *buf, size_t n, int flags)
156
enum: ZMQ_POLLOUT # 2
157
enum: ZMQ_POLLERR # 4
159
ctypedef struct zmq_pollitem_t:
167
int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
173
int zmq_device (int device_, void *insocket_, void *outsocket_)
175
cdef extern from "zmq_utils.h" nogil:
177
void *zmq_stopwatch_start ()
178
unsigned long zmq_stopwatch_stop (void *watch_)
179
void zmq_sleep (int seconds_)