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

« back to all changes in this revision

Viewing changes to zmq/core/czmq.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 Brian E. Granger
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
 
    enum: ZMQ_VERSION_MAJOR
55
 
    enum: ZMQ_VERSION_MINOR
56
 
    enum: ZMQ_VERSION_PATCH
57
 
    enum: ZMQ_VERSION
58
 
 
59
 
    enum: ZMQ_HAUSNUMERO
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"
69
 
    enum: ZMQ_EFSM "EFSM"
70
 
    enum: ZMQ_ENOCOMPATPROTO "ENOCOMPATPROTO"
71
 
    enum: ZMQ_ETERM "ETERM"
72
 
    
73
 
    enum: errno
74
 
    char *zmq_strerror (int errnum)
75
 
    int zmq_errno()
76
 
 
77
 
    enum: ZMQ_MAX_VSM_SIZE # 30
78
 
    enum: ZMQ_DELIMITER # 31
79
 
    enum: ZMQ_VSM # 32
80
 
    enum: ZMQ_MSG_MORE # 1
81
 
    enum: ZMQ_MSG_SHARED # 128
82
 
    
83
 
    # blackbox def for zmq_msg_t
84
 
    ctypedef void * zmq_msg_t "zmq_msg_t"
85
 
    
86
 
    ctypedef void zmq_free_fn(void *data, void *hint)
87
 
    
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)
97
 
 
98
 
    void *zmq_init (int io_threads)
99
 
    int zmq_term (void *context)
100
 
 
101
 
    enum: ZMQ_PAIR # 0
102
 
    enum: ZMQ_PUB # 1
103
 
    enum: ZMQ_SUB # 2
104
 
    enum: ZMQ_REQ # 3
105
 
    enum: ZMQ_REP # 4
106
 
    enum: ZMQ_XREQ # 5
107
 
    enum: ZMQ_XREP # 6
108
 
    enum: ZMQ_PULL # 7
109
 
    enum: ZMQ_PUSH # 8
110
 
    enum: ZMQ_XPUB # 9
111
 
    enum: ZMQ_XSUB # 10
112
 
    enum: ZMQ_UPSTREAM # 7
113
 
    enum: ZMQ_DOWNSTREAM # 8
114
 
 
115
 
    enum: ZMQ_HWM # 1
116
 
    enum: ZMQ_SWAP # 3
117
 
    enum: ZMQ_AFFINITY # 4
118
 
    enum: ZMQ_IDENTITY # 5
119
 
    enum: ZMQ_SUBSCRIBE # 6
120
 
    enum: ZMQ_UNSUBSCRIBE # 7
121
 
    enum: ZMQ_RATE # 8
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
127
 
    enum: ZMQ_FD # 14
128
 
    enum: ZMQ_EVENTS # 15
129
 
    enum: ZMQ_TYPE # 16
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
138
 
 
139
 
    enum: ZMQ_NOBLOCK # 1
140
 
    enum: ZMQ_DONTWAIT # 1
141
 
    enum: ZMQ_SNDMORE # 2
142
 
 
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)
149
 
    # send/recv
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)
154
 
 
155
 
    enum: ZMQ_POLLIN # 1
156
 
    enum: ZMQ_POLLOUT # 2
157
 
    enum: ZMQ_POLLERR # 4
158
 
 
159
 
    ctypedef struct zmq_pollitem_t:
160
 
        void *socket
161
 
        int fd
162
 
        # #if defined _WIN32
163
 
        #     SOCKET fd;
164
 
        short events
165
 
        short revents
166
 
 
167
 
    int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
168
 
 
169
 
    enum: ZMQ_STREAMER
170
 
    enum: ZMQ_FORWARDER
171
 
    enum: ZMQ_QUEUE
172
 
    # removed in libzmq
173
 
    int zmq_device (int device_, void *insocket_, void *outsocket_)
174
 
 
175
 
cdef extern from "zmq_utils.h" nogil:
176
 
 
177
 
    void *zmq_stopwatch_start ()
178
 
    unsigned long zmq_stopwatch_stop (void *watch_)
179
 
    void zmq_sleep (int seconds_)
180