1b2732e9dSimarom"""All the C imports for 0MQ"""
2b2732e9dSimarom
3b2732e9dSimarom#
4b2732e9dSimarom#    Copyright (c) 2010 Brian E. Granger & Min Ragan-Kelley
5b2732e9dSimarom#
6b2732e9dSimarom#    This file is part of pyzmq.
7b2732e9dSimarom#
8b2732e9dSimarom#    pyzmq is free software; you can redistribute it and/or modify it under
9b2732e9dSimarom#    the terms of the Lesser GNU General Public License as published by
10b2732e9dSimarom#    the Free Software Foundation; either version 3 of the License, or
11b2732e9dSimarom#    (at your option) any later version.
12b2732e9dSimarom#
13b2732e9dSimarom#    pyzmq is distributed in the hope that it will be useful,
14b2732e9dSimarom#    but WITHOUT ANY WARRANTY; without even the implied warranty of
15b2732e9dSimarom#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16b2732e9dSimarom#    Lesser GNU General Public License for more details.
17b2732e9dSimarom#
18b2732e9dSimarom#    You should have received a copy of the Lesser GNU General Public License
19b2732e9dSimarom#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20b2732e9dSimarom#
21b2732e9dSimarom
22b2732e9dSimarom#-----------------------------------------------------------------------------
23b2732e9dSimarom# Imports
24b2732e9dSimarom#-----------------------------------------------------------------------------
25b2732e9dSimarom
26b2732e9dSimarom#-----------------------------------------------------------------------------
27b2732e9dSimarom# Import the C header files
28b2732e9dSimarom#-----------------------------------------------------------------------------
29b2732e9dSimarom
30b2732e9dSimaromcdef extern from *:
31b2732e9dSimarom    ctypedef void* const_void_ptr "const void *"
32b2732e9dSimarom    ctypedef char* const_char_ptr "const char *"
33b2732e9dSimarom
34b2732e9dSimaromcdef extern from "zmq_compat.h":
35b2732e9dSimarom    ctypedef signed long long int64_t "pyzmq_int64_t"
36b2732e9dSimarom
37b2732e9dSimarominclude "constant_enums.pxi"
38b2732e9dSimarom
39b2732e9dSimaromcdef extern from "zmq.h" nogil:
40b2732e9dSimarom
41b2732e9dSimarom    void _zmq_version "zmq_version"(int *major, int *minor, int *patch)
42b2732e9dSimarom    
43b2732e9dSimarom    ctypedef int fd_t "ZMQ_FD_T"
44b2732e9dSimarom    
45b2732e9dSimarom    enum: errno
46b2732e9dSimarom    char *zmq_strerror (int errnum)
47b2732e9dSimarom    int zmq_errno()
48b2732e9dSimarom
49b2732e9dSimarom    void *zmq_ctx_new ()
50b2732e9dSimarom    int zmq_ctx_destroy (void *context)
51b2732e9dSimarom    int zmq_ctx_set (void *context, int option, int optval)
52b2732e9dSimarom    int zmq_ctx_get (void *context, int option)
53b2732e9dSimarom    void *zmq_init (int io_threads)
54b2732e9dSimarom    int zmq_term (void *context)
55b2732e9dSimarom    
56b2732e9dSimarom    # blackbox def for zmq_msg_t
57b2732e9dSimarom    ctypedef void * zmq_msg_t "zmq_msg_t"
58b2732e9dSimarom    
59b2732e9dSimarom    ctypedef void zmq_free_fn(void *data, void *hint)
60b2732e9dSimarom    
61b2732e9dSimarom    int zmq_msg_init (zmq_msg_t *msg)
62b2732e9dSimarom    int zmq_msg_init_size (zmq_msg_t *msg, size_t size)
63b2732e9dSimarom    int zmq_msg_init_data (zmq_msg_t *msg, void *data,
64b2732e9dSimarom        size_t size, zmq_free_fn *ffn, void *hint)
65b2732e9dSimarom    int zmq_msg_send (zmq_msg_t *msg, void *s, int flags)
66b2732e9dSimarom    int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags)
67b2732e9dSimarom    int zmq_msg_close (zmq_msg_t *msg)
68b2732e9dSimarom    int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src)
69b2732e9dSimarom    int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src)
70b2732e9dSimarom    void *zmq_msg_data (zmq_msg_t *msg)
71b2732e9dSimarom    size_t zmq_msg_size (zmq_msg_t *msg)
72b2732e9dSimarom    int zmq_msg_more (zmq_msg_t *msg)
73b2732e9dSimarom    int zmq_msg_get (zmq_msg_t *msg, int option)
74b2732e9dSimarom    int zmq_msg_set (zmq_msg_t *msg, int option, int optval)
75b2732e9dSimarom    const_char_ptr zmq_msg_gets (zmq_msg_t *msg, const_char_ptr property)
76b2732e9dSimarom    int zmq_has (const_char_ptr capability)
77b2732e9dSimarom
78b2732e9dSimarom    void *zmq_socket (void *context, int type)
79b2732e9dSimarom    int zmq_close (void *s)
80b2732e9dSimarom    int zmq_setsockopt (void *s, int option, void *optval, size_t optvallen)
81b2732e9dSimarom    int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen)
82b2732e9dSimarom    int zmq_bind (void *s, char *addr)
83b2732e9dSimarom    int zmq_connect (void *s, char *addr)
84b2732e9dSimarom    int zmq_unbind (void *s, char *addr)
85b2732e9dSimarom    int zmq_disconnect (void *s, char *addr)
86b2732e9dSimarom
87b2732e9dSimarom    int zmq_socket_monitor (void *s, char *addr, int flags)
88b2732e9dSimarom    
89b2732e9dSimarom    # send/recv
90b2732e9dSimarom    int zmq_sendbuf (void *s, const_void_ptr buf, size_t n, int flags)
91b2732e9dSimarom    int zmq_recvbuf (void *s, void *buf, size_t n, int flags)
92b2732e9dSimarom
93b2732e9dSimarom    ctypedef struct zmq_pollitem_t:
94b2732e9dSimarom        void *socket
95b2732e9dSimarom        int fd
96b2732e9dSimarom        short events
97b2732e9dSimarom        short revents
98b2732e9dSimarom
99b2732e9dSimarom    int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
100b2732e9dSimarom
101b2732e9dSimarom    int zmq_device (int device_, void *insocket_, void *outsocket_)
102b2732e9dSimarom    int zmq_proxy (void *frontend, void *backend, void *capture)
103b2732e9dSimarom
104b2732e9dSimaromcdef extern from "zmq_utils.h" nogil:
105b2732e9dSimarom
106b2732e9dSimarom    void *zmq_stopwatch_start ()
107b2732e9dSimarom    unsigned long zmq_stopwatch_stop (void *watch_)
108b2732e9dSimarom    void zmq_sleep (int seconds_)
109b2732e9dSimarom    int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
110b2732e9dSimarom
111