libzmq.pxd 4.7 KB

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