~ubuntu-branches/ubuntu/precise/pyzmq/precise

« back to all changes in this revision

Viewing changes to zmq/core/libzmq.pxd

  • Committer: Package Import Robot
  • Author(s): Debian Python Modules Team
  • Date: 2011-09-23 00:16:39 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: package-import@ubuntu.com-20110923001639-girjqodpb7uv17yu
Tags: 2.1.9-1
* New upstream version
  - should build on kFreeBSD without patches (Closes: #637777).
* Build-depend on zeromq 2.1.9

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_EMTHREAD "EMTHREAD"
 
71
    enum: ZMQ_EFSM "EFSM"
 
72
    enum: ZMQ_ENOCOMPATPROTO "ENOCOMPATPROTO"
 
73
    enum: ZMQ_ETERM "ETERM"
 
74
    enum: ZMQ_ECANTROUTE "ECANTROUTE"
 
75
    
 
76
    enum: errno
 
77
    char *zmq_strerror (int errnum)
 
78
    int zmq_errno()
 
79
 
 
80
    enum: ZMQ_MAX_VSM_SIZE # 30
 
81
    enum: ZMQ_DELIMITER # 31
 
82
    enum: ZMQ_VSM # 32
 
83
    enum: ZMQ_MSG_MORE # 1
 
84
    enum: ZMQ_MSG_SHARED # 128
 
85
    
 
86
    # blackbox def for zmq_msg_t
 
87
    ctypedef void * zmq_msg_t "zmq_msg_t"
 
88
    
 
89
    ctypedef void zmq_free_fn(void *data, void *hint)
 
90
    
 
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)
 
100
 
 
101
    void *zmq_init (int io_threads)
 
102
    int zmq_term (void *context)
 
103
 
 
104
    enum: ZMQ_PAIR # 0
 
105
    enum: ZMQ_PUB # 1
 
106
    enum: ZMQ_SUB # 2
 
107
    enum: ZMQ_REQ # 3
 
108
    enum: ZMQ_REP # 4
 
109
    enum: ZMQ_XREQ # 5
 
110
    enum: ZMQ_DEALER # 5 or 12
 
111
    enum: ZMQ_XREP # 6
 
112
    enum: ZMQ_ROUTER # 6 or 11 or 13
 
113
    enum: ZMQ_PULL # 7
 
114
    enum: ZMQ_PUSH # 8
 
115
    enum: ZMQ_XPUB # 9
 
116
    enum: ZMQ_XSUB # 10
 
117
    enum: ZMQ_UPSTREAM # 7
 
118
    enum: ZMQ_DOWNSTREAM # 8
 
119
 
 
120
    enum: ZMQ_HWM # 1
 
121
    enum: ZMQ_SWAP # 3
 
122
    enum: ZMQ_AFFINITY # 4
 
123
    enum: ZMQ_IDENTITY # 5
 
124
    enum: ZMQ_SUBSCRIBE # 6
 
125
    enum: ZMQ_UNSUBSCRIBE # 7
 
126
    enum: ZMQ_RATE # 8
 
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
 
132
    enum: ZMQ_FD # 14
 
133
    enum: ZMQ_EVENTS # 15
 
134
    enum: ZMQ_TYPE # 16
 
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
 
148
 
 
149
    enum: ZMQ_NOBLOCK # 1
 
150
    enum: ZMQ_DONTWAIT # 1
 
151
    enum: ZMQ_SNDMORE # 2
 
152
    enum: ZMQ_SNDLABEL # 4
 
153
    enum: ZMQ_SNDCMD # 8
 
154
 
 
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)
 
161
    # send/recv
 
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)
 
166
 
 
167
    enum: ZMQ_POLLIN # 1
 
168
    enum: ZMQ_POLLOUT # 2
 
169
    enum: ZMQ_POLLERR # 4
 
170
 
 
171
    ctypedef struct zmq_pollitem_t:
 
172
        void *socket
 
173
        int fd
 
174
        # #if defined _WIN32
 
175
        #     SOCKET fd;
 
176
        short events
 
177
        short revents
 
178
 
 
179
    int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
 
180
 
 
181
    enum: ZMQ_STREAMER
 
182
    enum: ZMQ_FORWARDER
 
183
    enum: ZMQ_QUEUE
 
184
    # removed in libzmq
 
185
    int zmq_device (int device_, void *insocket_, void *outsocket_)
 
186
 
 
187
cdef extern from "zmq_utils.h" nogil:
 
188
 
 
189
    void *zmq_stopwatch_start ()
 
190
    unsigned long zmq_stopwatch_stop (void *watch_)
 
191
    void zmq_sleep (int seconds_)
 
192