File: libzmq4.rb

package info (click to toggle)
ruby-ffi-rzmq-core 1.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 192 kB
  • sloc: ruby: 524; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 801 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Wraps the new API methods available in ZeroMQ 4
#
module LibZMQ

  attach_function :zmq_ctx_term,     [:pointer], :void, :blocking => true
  attach_function :zmq_ctx_shutdown, [:pointer], :void, :blocking => true

  attach_function :zmq_send_const,   [:pointer, :pointer, :size_t], :int, :blocking => true

  attach_function :zmq_z85_encode,   [:pointer, :pointer, :size_t], :string, :blocking => true
  attach_function :zmq_z85_decode,   [:pointer, :string],           :pointer, :blocking => true

  # Requires ZMQ compiled with libsodium
  # Will return -1 with errno set to ENOSUP otherwise
  attach_function :zmq_curve_keypair, [:pointer, :pointer], :int, :blocking => true

  # Wrapper function for context termination
  def self.terminate_context(context)
    zmq_ctx_term(context)
  end

end