libzmq.pxd 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. # were it not for Windows,
  27. # we could cimport these from libc.stdint
  28. cdef extern from "zmq_compat.h":
  29. ctypedef signed long long int64_t "pyzmq_int64_t"
  30. ctypedef unsigned int uint32_t "pyzmq_uint32_t"
  31. include "./constant_enums.pxi"
  32. cdef extern from "zmq.h" nogil:
  33. void _zmq_version "zmq_version"(int *major, int *minor, int *patch)
  34. ctypedef int fd_t "ZMQ_FD_T"
  35. enum: errno
  36. const char *zmq_strerror (int errnum)
  37. int zmq_errno()
  38. void *zmq_ctx_new ()
  39. int zmq_ctx_destroy (void *context)
  40. int zmq_ctx_set (void *context, int option, int optval)
  41. int zmq_ctx_get (void *context, int option)
  42. void *zmq_init (int io_threads)
  43. int zmq_term (void *context)
  44. # blackbox def for zmq_msg_t
  45. ctypedef void * zmq_msg_t "zmq_msg_t"
  46. ctypedef void zmq_free_fn(void *data, void *hint)
  47. int zmq_msg_init (zmq_msg_t *msg)
  48. int zmq_msg_init_size (zmq_msg_t *msg, size_t size)
  49. int zmq_msg_init_data (zmq_msg_t *msg, void *data,
  50. size_t size, zmq_free_fn *ffn, void *hint)
  51. int zmq_msg_send (zmq_msg_t *msg, void *s, int flags)
  52. int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags)
  53. int zmq_msg_close (zmq_msg_t *msg)
  54. int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src)
  55. int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src)
  56. void *zmq_msg_data (zmq_msg_t *msg)
  57. size_t zmq_msg_size (zmq_msg_t *msg)
  58. int zmq_msg_more (zmq_msg_t *msg)
  59. int zmq_msg_get (zmq_msg_t *msg, int option)
  60. int zmq_msg_set (zmq_msg_t *msg, int option, int optval)
  61. const char *zmq_msg_gets (zmq_msg_t *msg, const char *property)
  62. int zmq_has (const char *capability)
  63. void *zmq_socket (void *context, int type)
  64. int zmq_close (void *s)
  65. int zmq_setsockopt (void *s, int option, void *optval, size_t optvallen)
  66. int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen)
  67. int zmq_bind (void *s, char *addr)
  68. int zmq_connect (void *s, char *addr)
  69. int zmq_unbind (void *s, char *addr)
  70. int zmq_disconnect (void *s, char *addr)
  71. int zmq_socket_monitor (void *s, char *addr, int flags)
  72. # send/recv
  73. int zmq_sendbuf (void *s, const void *buf, size_t n, int flags)
  74. int zmq_recvbuf (void *s, void *buf, size_t n, int flags)
  75. ctypedef struct zmq_pollitem_t:
  76. void *socket
  77. int fd
  78. short events
  79. short revents
  80. int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
  81. int zmq_device (int device_, void *insocket_, void *outsocket_)
  82. int zmq_proxy (void *frontend, void *backend, void *capture)
  83. int zmq_proxy_steerable (void *frontend,
  84. void *backend,
  85. void *capture,
  86. void *control)
  87. int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
  88. int zmq_curve_public (char *z85_public_key, char *z85_secret_key)
  89. # 4.2 draft
  90. int zmq_join (void *s, const char *group)
  91. int zmq_leave (void *s, const char *group)
  92. int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id)
  93. uint32_t zmq_msg_routing_id(zmq_msg_t *msg)
  94. int zmq_msg_set_group(zmq_msg_t *msg, const char *group)
  95. const char *zmq_msg_group(zmq_msg_t *msg)