module LibZMQ

Wraps the libzmq library and attaches to the functions that are common across the 3.2.x+ and 4.x APIs.

Wraps the new API methods available in ZeroMQ 4

Constants

VERSION
ZMQ_LIB_PATHS

Search for libzmq in the following order…

Public Class Methods

size_of_zmq_msg_t() click to toggle source

here are the typedefs for zmsg_msg_t for all known releases of libzmq grep 'typedef struct zmq_msg_t' */include/zmq.h zeromq-3.2.2/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-3.2.3/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-3.2.4/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-3.2.5/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-4.0.0/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-4.0.1/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-4.0.2/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-4.0.3/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-4.0.4/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-4.0.5/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-4.0.6/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-4.0.7/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t; zeromq-4.1.0/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [48];} zmq_msg_t; zeromq-4.1.1/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [64];} zmq_msg_t; zeromq-4.1.2/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [64];} zmq_msg_t; zeromq-4.1.3/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [64];} zmq_msg_t; zeromq-4.1.4/include/zmq.h:typedef struct zmq_msg_t {unsigned char _ [64];} zmq_msg_t; libzmq/include/zmq.h: typedef union zmq_msg_t {unsigned char _ [64]; void *p; } zmq_msg_t;

# File lib/ffi-rzmq-core/structures.rb, line 34
def self.size_of_zmq_msg_t
  if version_number < 040100
    32
  elsif version_number < 040101
    48
  else
    64
  end
end
terminate_context(context) click to toggle source

Wrapper function for context termination

# File lib/ffi-rzmq-core/libzmq.rb, line 133
def self.terminate_context(context)
  zmq_ctx_destroy(context)
end
version() click to toggle source

Returns a hash of the form {:major => X, :minor => Y, :patch => Z} to represent the version of libzmq.

Class method.

Invoke as: ZMQ::LibZMQ.version

# File lib/ffi-rzmq-core/utilities.rb, line 11
def self.version
  unless @version
    major = FFI::MemoryPointer.new :int
    minor = FFI::MemoryPointer.new :int
    patch = FFI::MemoryPointer.new :int
    LibZMQ.zmq_version major, minor, patch
    @version = {:major => major.read_int, :minor => minor.read_int, :patch => patch.read_int}
  end

  @version
end
version3?() click to toggle source
# File lib/ffi-rzmq-core/utilities.rb, line 23
def self.version3?
  version[:major] == 3 && version[:minor] >= 2
end
version4?() click to toggle source
# File lib/ffi-rzmq-core/utilities.rb, line 27
def self.version4?
  version[:major] == 4
end
version_number() click to toggle source
# File lib/ffi-rzmq-core/structures.rb, line 3
def self.version_number
  10000 * version[:major] + 100 * version[:minor] + version[:patch]
end
version_string() click to toggle source
# File lib/ffi-rzmq-core/structures.rb, line 7
def self.version_string
  "%d.%d.%d" % version.values_at(:major, :minor, :patch)
end