~ubuntu-branches/ubuntu/wily/pyzmq/wily

« back to all changes in this revision

Viewing changes to zmq/core/libzmq.pxd

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2013-02-24 19:23:15 UTC
  • mfrom: (1.2.1) (9 sid)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: package-import@ubuntu.com-20130224192315-qhmwp3m3ymk8r60d
Tags: 2.2.0.1-1
* New upstream release
* relicense debian packaging to LGPL-3
* update watch file to use github directly
  thanks to Bart Martens for the file
* add autopkgtests
* drop obsolete DM-Upload-Allowed
* bump standard to 3.9.4, no changes required

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""All the C imports for 0MQ"""
 
2
 
 
3
#
 
4
#    Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
 
5
#
 
6
#    This file is part of pyzmq.
 
7
#
 
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.
 
12
#
 
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.
 
17
#
 
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/>.
 
20
#
 
21
 
 
22
#-----------------------------------------------------------------------------
 
23
# Imports
 
24
#-----------------------------------------------------------------------------
 
25
 
 
26
#-----------------------------------------------------------------------------
 
27
# Import the C header files
 
28
#-----------------------------------------------------------------------------
 
29
 
 
30
cdef extern from *:
 
31
    ctypedef void* const_void_ptr "const void *"
 
32
 
 
33
cdef extern from "allocate.h":
 
34
    object allocate(size_t n, void **pp)
 
35
 
 
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"
 
42
 
 
43
cdef extern from "string.h" nogil:
 
44
    void *memcpy(void *dest, void *src, size_t n)
 
45
    size_t strlen(char *s)
 
46
 
 
47
cdef extern from "zmq_compat.h":
 
48
    ctypedef signed long long int64_t "pyzmq_int64_t"
 
49
 
 
50
cdef extern from "zmq.h" nogil:
 
51
 
 
52
    void _zmq_version "zmq_version"(int *major, int *minor, int *patch)
 
53
    
 
54
    ctypedef int fd_t "ZMQ_FD_T"
 
55
    
 
56
    enum: ZMQ_VERSION_MAJOR
 
57
    enum: ZMQ_VERSION_MINOR
 
58
    enum: ZMQ_VERSION_PATCH
 
59
    enum: ZMQ_VERSION
 
60
 
 
61
    enum: ZMQ_HAUSNUMERO
 
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_ENOTSOCK "ENOTSOCK"
 
71
    enum: ZMQ_EAFNOSUPPORT "EAFNOSUPPORT"
 
72
    enum: ZMQ_EHOSTUNREACH "EHOSTUNREACH"
 
73
 
 
74
    enum: ZMQ_EFSM "EFSM"
 
75
    enum: ZMQ_ENOCOMPATPROTO "ENOCOMPATPROTO"
 
76
    enum: ZMQ_ETERM "ETERM"
 
77
    enum: ZMQ_EMTHREAD "EMTHREAD"
 
78
    
 
79
    enum: errno
 
80
    char *zmq_strerror (int errnum)
 
81
    int zmq_errno()
 
82
 
 
83
    enum: ZMQ_MAX_VSM_SIZE # 30
 
84
    enum: ZMQ_DELIMITER # 31
 
85
    enum: ZMQ_VSM # 32
 
86
    enum: ZMQ_MSG_MORE # 1
 
87
    enum: ZMQ_MSG_SHARED # 128
 
88
    
 
89
    # blackbox def for zmq_msg_t
 
90
    ctypedef void * zmq_msg_t "zmq_msg_t"
 
91
    
 
92
    ctypedef void zmq_free_fn(void *data, void *hint)
 
93
    
 
94
    int zmq_msg_init (zmq_msg_t *msg)
 
95
    int zmq_msg_init_size (zmq_msg_t *msg, size_t size)
 
96
    int zmq_msg_init_data (zmq_msg_t *msg, void *data,
 
97
        size_t size, zmq_free_fn *ffn, void *hint)
 
98
    int zmq_msg_close (zmq_msg_t *msg)
 
99
    int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src)
 
100
    int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src)
 
101
    void *zmq_msg_data (zmq_msg_t *msg)
 
102
    size_t zmq_msg_size (zmq_msg_t *msg)
 
103
 
 
104
    void *zmq_init (int io_threads)
 
105
    int zmq_term (void *context)
 
106
 
 
107
    enum: ZMQ_PAIR # 0
 
108
    enum: ZMQ_PUB # 1
 
109
    enum: ZMQ_SUB # 2
 
110
    enum: ZMQ_REQ # 3
 
111
    enum: ZMQ_REP # 4
 
112
    enum: ZMQ_DEALER # 5
 
113
    enum: ZMQ_ROUTER # 6
 
114
    enum: ZMQ_PULL # 7
 
115
    enum: ZMQ_PUSH # 8
 
116
    enum: ZMQ_XPUB # 9
 
117
    enum: ZMQ_XSUB # 10
 
118
 
 
119
    enum: ZMQ_HWM # 1
 
120
    enum: ZMQ_SWAP # 3
 
121
    enum: ZMQ_AFFINITY # 4
 
122
    enum: ZMQ_IDENTITY # 5
 
123
    enum: ZMQ_SUBSCRIBE # 6
 
124
    enum: ZMQ_UNSUBSCRIBE # 7
 
125
    enum: ZMQ_RATE # 8
 
126
    enum: ZMQ_RECOVERY_IVL # 9
 
127
    enum: ZMQ_MCAST_LOOP # 10
 
128
    enum: ZMQ_SNDBUF # 11
 
129
    enum: ZMQ_RCVBUF # 12
 
130
    enum: ZMQ_RCVMORE # 13
 
131
    enum: ZMQ_FD # 14
 
132
    enum: ZMQ_EVENTS # 15
 
133
    enum: ZMQ_TYPE # 16
 
134
    enum: ZMQ_LINGER # 17
 
135
    enum: ZMQ_RECONNECT_IVL # 18
 
136
    enum: ZMQ_BACKLOG # 19
 
137
    enum: ZMQ_RECOVERY_IVL_MSEC # 20
 
138
    enum: ZMQ_RECONNECT_IVL_MAX # 21
 
139
    enum: ZMQ_MAXMSGSIZE # 22
 
140
    enum: ZMQ_SNDHWM # 23
 
141
    enum: ZMQ_RCVHWM # 24
 
142
    enum: ZMQ_MULTICAST_HOPS # 25
 
143
    enum: ZMQ_RCVTIMEO # 27
 
144
    enum: ZMQ_SNDTIMEO # 28
 
145
    enum: ZMQ_IPV4ONLY # 31
 
146
    enum: ZMQ_LAST_ENDPOINT # 32
 
147
 
 
148
    enum: ZMQ_ROUTER_BEHAVIOR # 33
 
149
    enum: ZMQ_TCP_KEEPALIVE # 34
 
150
    enum: ZMQ_TCP_KEEPALIVE_CNT # 35
 
151
    enum: ZMQ_TCP_KEEPALIVE_IDLE # 36
 
152
    enum: ZMQ_TCP_KEEPALIVE_INTVL # 37
 
153
    enum: ZMQ_TCP_ACCEPT_FILTER # 38
 
154
    enum: ZMQ_DELAY_ATTACH_ON_CONNECT # 39
 
155
 
 
156
    enum: ZMQ_MORE # 1
 
157
 
 
158
    enum: ZMQ_NOBLOCK # 1
 
159
    enum: ZMQ_DONTWAIT # 1
 
160
    enum: ZMQ_SNDMORE # 2
 
161
 
 
162
    # Socket transport events (tcp and ipc only)
 
163
    enum: ZMQ_EVENT_CONNECTED # 1
 
164
    enum: ZMQ_EVENT_CONNECT_DELAYED # 2
 
165
    enum: ZMQ_EVENT_CONNECT_RETRIED # 4
 
166
 
 
167
    enum: ZMQ_EVENT_LISTENING # 8
 
168
    enum: ZMQ_EVENT_BIND_FAILED # 16
 
169
 
 
170
    enum: ZMQ_EVENT_ACCEPTED # 32
 
171
    enum: ZMQ_EVENT_ACCEPT_FAILED # 64
 
172
 
 
173
    enum: ZMQ_EVENT_CLOSED # 128
 
174
    enum: ZMQ_EVENT_CLOSE_FAILED # 256
 
175
    enum: ZMQ_EVENT_DISCONNECTED # 512
 
176
 
 
177
    void *zmq_socket (void *context, int type)
 
178
    int zmq_close (void *s)
 
179
    int zmq_setsockopt (void *s, int option, void *optval, size_t optvallen)
 
180
    int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen)
 
181
    int zmq_bind (void *s, char *addr)
 
182
    int zmq_connect (void *s, char *addr)
 
183
    # send/recv
 
184
    int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags)
 
185
    int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags)
 
186
    int zmq_sendbuf (void *s, const_void_ptr buf, size_t n, int flags)
 
187
    int zmq_recvbuf (void *s, void *buf, size_t n, int flags)
 
188
 
 
189
    enum: ZMQ_POLLIN # 1
 
190
    enum: ZMQ_POLLOUT # 2
 
191
    enum: ZMQ_POLLERR # 4
 
192
 
 
193
    ctypedef struct zmq_pollitem_t:
 
194
        void *socket
 
195
        int fd
 
196
        # #if defined _WIN32
 
197
        #     SOCKET fd;
 
198
        short events
 
199
        short revents
 
200
 
 
201
    int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
 
202
 
 
203
    enum: ZMQ_STREAMER
 
204
    enum: ZMQ_FORWARDER
 
205
    enum: ZMQ_QUEUE
 
206
    # removed in libzmq
 
207
    int zmq_device (int device_, void *insocket_, void *outsocket_)
 
208
 
 
209
cdef extern from "zmq_utils.h" nogil:
 
210
 
 
211
    void *zmq_stopwatch_start ()
 
212
    unsigned long zmq_stopwatch_stop (void *watch_)
 
213
    void zmq_sleep (int seconds_)
 
214