Class: CZMQ::FFI::Zsys

Inherits:
Object
  • Object
show all
Defined in:
lib/czmq-ffi-gen/czmq/ffi/zsys.rb

Overview

Note:

This class is 100% generated using zproject.

Defined Under Namespace

Classes: DestroyedError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr, finalize = true) ⇒ Zsys

Attaches the pointer ptr to this instance and defines a finalizer for it if necessary.

Parameters:

  • ptr (::FFI::Pointer)
  • finalize (Boolean) (defaults to: true)


24
25
26
27
28
29
30
31
32
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 24

def initialize(ptr, finalize = true)
  @ptr = ptr
  if @ptr.null?
    @ptr = nil # Remove null pointers so we don't have to test for them.
  elsif finalize
    @finalizer = self.class.create_finalizer_for @ptr
    ObjectSpace.define_finalizer self, @finalizer
  end
end

Class Method Details

.auto_use_fdInteger

Return use of automatic pre-allocated FDs for zsock instances.

Returns:

  • (Integer)


737
738
739
740
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 737

def self.auto_use_fd()
  result = ::CZMQ::FFI.zsys_auto_use_fd()
  result
end

.catch_interruptsvoid

This method returns an undefined value.

Set default interrupt handler, so Ctrl-C or SIGTERM will set zsys_interrupted. Idempotent; safe to call multiple times. Can be supressed by ZSYS_SIGHANDLER=false *** This is for CZMQ internal use only and may change arbitrarily ***



195
196
197
198
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 195

def self.catch_interrupts()
  result = ::CZMQ::FFI.zsys_catch_interrupts()
  result
end

.close(handle, filename, line_nbr) ⇒ Integer

Destroy/close a ZMQ socket. You should call this for every socket you create using zsys_socket(). *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • handle (::FFI::Pointer, #to_ptr)
  • filename (String, #to_s, nil)
  • line_nbr (Integer, #to_int, #to_i)

Returns:

  • (Integer)


139
140
141
142
143
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 139

def self.close(handle, filename, line_nbr)
  line_nbr = Integer(line_nbr)
  result = ::CZMQ::FFI.zsys_close(handle, filename, line_nbr)
  result
end

.create_finalizer_for(ptr) ⇒ Proc

Returns:

  • (Proc)


34
35
36
37
38
39
40
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 34

def self.create_finalizer_for(ptr)
  Proc.new do
    "WARNING: "\
    "Objects of type #{self} cannot be destroyed implicitly. "\
    "Please call the correct destroy method with the relevant arguments."
  end
end

.create_pipe(backend_p) ⇒ Zsock

Create a pipe, which consists of two PAIR sockets connected over inproc. The pipe is configured to use the zsys_pipehwm setting. Returns the frontend socket successful, NULL if failed.

Parameters:

Returns:



162
163
164
165
166
167
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 162

def self.create_pipe(backend_p)
  backend_p = backend_p.__ptr_give_ref
  result = ::CZMQ::FFI.zsys_create_pipe(backend_p)
  result = Zsock.__new result, false
  result
end

.daemonize(workdir) ⇒ Integer

Move the current process into the background. The precise effect depends on the operating system. On POSIX boxes, moves to a specified working directory (if specified), closes all file handles, reopens stdin, stdout, and stderr to the null device, and sets the process to ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there was an error.

Parameters:

  • workdir (String, #to_s, nil)

Returns:

  • (Integer)


435
436
437
438
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 435

def self.daemonize(workdir)
  result = ::CZMQ::FFI.zsys_daemonize(workdir)
  result
end

.debug(format, *args) ⇒ void

This method returns an undefined value.

Log debug-level message - lowest priority

Parameters:



835
836
837
838
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 835

def self.debug(format, *args)
  result = ::CZMQ::FFI.zsys_debug(format, *args)
  result
end

.dir_change(pathname) ⇒ Integer

Move to a specified working directory. Returns 0 if OK, -1 if this failed.

Parameters:

  • pathname (String, #to_s, nil)

Returns:

  • (Integer)


292
293
294
295
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 292

def self.dir_change(pathname)
  result = ::CZMQ::FFI.zsys_dir_change(pathname)
  result
end

.dir_create(pathname, *args) ⇒ Integer

Create a file path if it doesn’t exist. The file path is treated as printf format.

Parameters:

Returns:

  • (Integer)


273
274
275
276
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 273

def self.dir_create(pathname, *args)
  result = ::CZMQ::FFI.zsys_dir_create(pathname, *args)
  result
end

.dir_delete(pathname, *args) ⇒ Integer

Remove a file path if empty; the pathname is treated as printf format.

Parameters:

Returns:

  • (Integer)


283
284
285
286
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 283

def self.dir_delete(pathname, *args)
  result = ::CZMQ::FFI.zsys_dir_delete(pathname, *args)
  result
end

.error(format, *args) ⇒ void

This method returns an undefined value.

Log error condition - highest priority

Parameters:



795
796
797
798
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 795

def self.error(format, *args)
  result = ::CZMQ::FFI.zsys_error(format, *args)
  result
end

.file_delete(filename) ⇒ Integer

Delete file. Does not complain if the file is absent

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (Integer)


253
254
255
256
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 253

def self.file_delete(filename)
  result = ::CZMQ::FFI.zsys_file_delete(filename)
  result
end

.file_exists(filename) ⇒ Boolean

Return 1 if file exists, else zero

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (Boolean)


224
225
226
227
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 224

def self.file_exists(filename)
  result = ::CZMQ::FFI.zsys_file_exists(filename)
  result
end

.file_mode(filename) ⇒ Integer

Return file mode; provides at least support for the POSIX S_ISREG(m) and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. Returns a mode_t cast to int, or -1 in case of error.

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (Integer)


244
245
246
247
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 244

def self.file_mode(filename)
  result = ::CZMQ::FFI.zsys_file_mode(filename)
  result
end

.file_mode_defaultvoid

This method returns an undefined value.

Reset default file creation mode; all files created from here will use process file mode defaults.



310
311
312
313
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 310

def self.file_mode_default()
  result = ::CZMQ::FFI.zsys_file_mode_default()
  result
end

.file_mode_privatevoid

This method returns an undefined value.

Set private file creation mode; all files created from here will be readable/writable by the owner only.



301
302
303
304
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 301

def self.file_mode_private()
  result = ::CZMQ::FFI.zsys_file_mode_private()
  result
end

.file_modified(filename) ⇒ ::FFI::Pointer

Return file modification time. Returns 0 if the file does not exist.

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (::FFI::Pointer)


233
234
235
236
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 233

def self.file_modified(filename)
  result = ::CZMQ::FFI.zsys_file_modified(filename)
  result
end

.file_stable(filename) ⇒ Boolean

Check if file is ‘stable’

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (Boolean)


262
263
264
265
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 262

def self.file_stable(filename)
  result = ::CZMQ::FFI.zsys_file_stable(filename)
  result
end

.file_stable_age_msec::FFI::Pointer

Return current threshold value of file stable age in msec. This can be used in code that chooses to wait for this timeout before testing if a filesystem object is “stable” or not.

Returns:

  • (::FFI::Pointer)


564
565
566
567
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 564

def self.file_stable_age_msec()
  result = ::CZMQ::FFI.zsys_file_stable_age_msec()
  result
end

.handler_fnObject

Note:

WARNING: If your Ruby code doesn’t retain a reference to the FFI::Function object after passing it to a C function call, it may be garbage collected while C still holds the pointer, potentially resulting in a segmentation fault.

Create a new callback of the following type: Callback for interrupt signal handler

typedef void (zsys_handler_fn) (
    int signal_value);


84
85
86
87
88
89
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 84

def self.handler_fn
  ::FFI::Function.new :void, [:int], blocking: true do |signal_value|
    result = yield signal_value
    result
  end
end

.handler_resetvoid

This method returns an undefined value.

Reset interrupt handler, call this at exit if needed



184
185
186
187
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 184

def self.handler_reset()
  result = ::CZMQ::FFI.zsys_handler_reset()
  result
end

.handler_set(handler_fn) ⇒ void

This method returns an undefined value.

Set interrupt handler; this saves the default handlers so that a zsys_handler_reset () can restore them. If you call this multiple times then the last handler will take affect. If handler_fn is NULL, disables default SIGINT/SIGTERM handling in CZMQ.

Parameters:

  • handler_fn (::FFI::Pointer, #to_ptr)


176
177
178
179
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 176

def self.handler_set(handler_fn)
  result = ::CZMQ::FFI.zsys_handler_set(handler_fn)
  result
end

.has_curveBoolean

Returns true if the underlying libzmq supports CURVE security. Uses a heuristic probe according to the version of libzmq being used.

Returns:

  • (Boolean)


459
460
461
462
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 459

def self.has_curve()
  result = ::CZMQ::FFI.zsys_has_curve()
  result
end

.hostname::FFI::Pointer

Return current host name, for use in public tcp:// endpoints. Caller gets a freshly allocated string, should free it using zstr_free(). If the host name is not resolvable, returns NULL.

Returns:

  • (::FFI::Pointer)


422
423
424
425
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 422

def self.hostname()
  result = ::CZMQ::FFI.zsys_hostname()
  result
end

.info(format, *args) ⇒ void

This method returns an undefined value.

Log informational message - low priority

Parameters:



825
826
827
828
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 825

def self.info(format, *args)
  result = ::CZMQ::FFI.zsys_info(format, *args)
  result
end

.init::FFI::Pointer

Initialize CZMQ zsys layer; this happens automatically when you create a socket or an actor; however this call lets you force initialization earlier, so e.g. logging is properly set-up before you start working. Not threadsafe, so call only from main thread. Safe to call multiple times. Returns global CZMQ context.

Returns:

  • (::FFI::Pointer)


98
99
100
101
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 98

def self.init()
  result = ::CZMQ::FFI.zsys_init()
  result
end

.interfaceString

Return network interface to use for broadcasts, or “” if none was set.

Returns:

  • (String)


673
674
675
676
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 673

def self.interface()
  result = ::CZMQ::FFI.zsys_interface()
  result
end

.ipv6Integer

Return use of IPv6 for zsock instances.

Returns:

  • (Integer)


651
652
653
654
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 651

def self.ipv6()
  result = ::CZMQ::FFI.zsys_ipv6()
  result
end

.ipv6_addressString

Return IPv6 address to use for zbeacon reception, or “” if none was set.

Returns:

  • (String)


693
694
695
696
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 693

def self.ipv6_address()
  result = ::CZMQ::FFI.zsys_ipv6_address()
  result
end

.ipv6_mcast_addressString

Return IPv6 multicast address to use for sending zbeacon, or “” if none was set.

Returns:

  • (String)


714
715
716
717
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 714

def self.ipv6_mcast_address()
  result = ::CZMQ::FFI.zsys_ipv6_mcast_address()
  result
end

.is_interruptedBoolean

Check if default interrupt handler of Ctrl-C or SIGTERM was called. Does not work if ZSYS_SIGHANDLER is false and code does not call set interrupted on signal.

Returns:

  • (Boolean)


205
206
207
208
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 205

def self.is_interrupted()
  result = ::CZMQ::FFI.zsys_is_interrupted()
  result
end

.max_msgszInteger

Return maximum message size.

Returns:

  • (Integer)


541
542
543
544
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 541

def self.max_msgsz()
  result = ::CZMQ::FFI.zsys_max_msgsz()
  result
end

.notice(format, *args) ⇒ void

This method returns an undefined value.

Log normal, but significant, condition - normal priority

Parameters:



815
816
817
818
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 815

def self.notice(format, *args)
  result = ::CZMQ::FFI.zsys_notice(format, *args)
  result
end

.pipehwmInteger

Return the HWM for zactor internal pipes.

Returns:

  • (Integer)


628
629
630
631
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 628

def self.pipehwm()
  result = ::CZMQ::FFI.zsys_pipehwm()
  result
end

.run_as(lockfile, group, user) ⇒ Integer

Drop the process ID into the lockfile, with exclusive lock, and switch the process to the specified group and/or user. Any of the arguments may be null, indicating a no-op. Returns 0 on success, -1 on failure. Note if you combine this with zsys_daemonize, run after, not before that method, or the lockfile will hold the wrong process ID.

Parameters:

  • lockfile (String, #to_s, nil)
  • group (String, #to_s, nil)
  • user (String, #to_s, nil)

Returns:

  • (Integer)


450
451
452
453
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 450

def self.run_as(lockfile, group, user)
  result = ::CZMQ::FFI.zsys_run_as(lockfile, group, user)
  result
end

.set_auto_use_fd(auto_use_fd) ⇒ void

This method returns an undefined value.

Configure the automatic use of pre-allocated FDs when creating new sockets. If 0 (default), nothing will happen. Else, when a new socket is bound, the system API will be used to check if an existing pre-allocated FD with a matching port (if TCP) or path (if IPC) exists, and if it does it will be set via the ZMQ_USE_FD socket option so that the library will use it instead of creating a new socket.

Parameters:

  • auto_use_fd (Integer, #to_int, #to_i)


728
729
730
731
732
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 728

def self.set_auto_use_fd(auto_use_fd)
  auto_use_fd = Integer(auto_use_fd)
  result = ::CZMQ::FFI.zsys_set_auto_use_fd(auto_use_fd)
  result
end

.set_file_stable_age_msec(file_stable_age_msec) ⇒ void

This method returns an undefined value.

Configure the threshold value of filesystem object age per st_mtime that should elapse until we consider that object “stable” at the current zclock_time() moment. The default is S_DEFAULT_ZSYS_FILE_STABLE_AGE_MSEC defined in zsys.c which generally depends on host OS, with fallback value of 5000.

Parameters:

  • file_stable_age_msec (::FFI::Pointer, #to_ptr)


554
555
556
557
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 554

def self.set_file_stable_age_msec(file_stable_age_msec)
  result = ::CZMQ::FFI.zsys_set_file_stable_age_msec(file_stable_age_msec)
  result
end

.set_interface(value) ⇒ void

This method returns an undefined value.

Set network interface name to use for broadcasts, particularly zbeacon. This lets the interface be configured for test environments where required. For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is the default when there is no specified interface. If the environment variable ZSYS_INTERFACE is set, use that as the default interface name. Setting the interface to “*” means “use all available interfaces”.

Parameters:

  • value (String, #to_s, nil)


665
666
667
668
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 665

def self.set_interface(value)
  result = ::CZMQ::FFI.zsys_set_interface(value)
  result
end

.set_interruptedvoid

This method returns an undefined value.

Set interrupted flag. This is done by default signal handler, however this can be handy for language bindings or cases without default signal handler.



215
216
217
218
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 215

def self.set_interrupted()
  result = ::CZMQ::FFI.zsys_set_interrupted()
  result
end

.set_io_threads(io_threads) ⇒ void

This method returns an undefined value.

Configure the number of I/O threads that ZeroMQ will use. A good rule of thumb is one thread per gigabit of traffic in or out. The default is 1, sufficient for most applications. If the environment variable ZSYS_IO_THREADS is defined, that provides the default. Note that this method is valid only before any socket is created.

Parameters:

  • io_threads (Integer, #to_int, #to_i)


472
473
474
475
476
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 472

def self.set_io_threads(io_threads)
  io_threads = Integer(io_threads)
  result = ::CZMQ::FFI.zsys_set_io_threads(io_threads)
  result
end

.set_ipv6(ipv6) ⇒ void

This method returns an undefined value.

Configure use of IPv6 for new zsock instances. By default sockets accept and make only IPv4 connections. When you enable IPv6, sockets will accept and connect to both IPv4 and IPv6 peers. You can override the setting on each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the default. Note: has no effect on ZMQ v2.

Parameters:

  • ipv6 (Integer, #to_int, #to_i)


642
643
644
645
646
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 642

def self.set_ipv6(ipv6)
  ipv6 = Integer(ipv6)
  result = ::CZMQ::FFI.zsys_set_ipv6(ipv6)
  result
end

.set_ipv6_address(value) ⇒ void

This method returns an undefined value.

Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. This needs to be set IPv6 is enabled as IPv6 can have multiple addresses on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, use that as the default IPv6 address.

Parameters:

  • value (String, #to_s, nil)


685
686
687
688
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 685

def self.set_ipv6_address(value)
  result = ::CZMQ::FFI.zsys_set_ipv6_address(value)
  result
end

.set_ipv6_mcast_address(value) ⇒ void

This method returns an undefined value.

Set IPv6 milticast address to use for sending zbeacon messages. This needs to be set if IPv6 is enabled. If the environment variable ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast address.

Parameters:

  • value (String, #to_s, nil)


705
706
707
708
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 705

def self.set_ipv6_mcast_address(value)
  result = ::CZMQ::FFI.zsys_set_ipv6_mcast_address(value)
  result
end

.set_linger(linger) ⇒ void

This method returns an undefined value.

Configure the default linger timeout in msecs for new zsock instances. You can also set this separately on each zsock_t instance. The default linger time is zero, i.e. any pending messages will be dropped. If the environment variable ZSYS_LINGER is defined, that provides the default. Note that process exit will typically be delayed by the linger time.

Parameters:

  • linger (Integer, #to_int, #to_i)


577
578
579
580
581
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 577

def self.set_linger(linger)
  linger = Integer(linger)
  result = ::CZMQ::FFI.zsys_set_linger(linger)
  result
end

.set_logident(value) ⇒ void

This method returns an undefined value.

Set log identity, which is a string that prefixes all log messages sent by this process. The log identity defaults to the environment variable ZSYS_LOGIDENT, if that is set.

Parameters:

  • value (String, #to_s, nil)


748
749
750
751
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 748

def self.set_logident(value)
  result = ::CZMQ::FFI.zsys_set_logident(value)
  result
end

.set_logsender(endpoint) ⇒ void

This method returns an undefined value.

Sends log output to a PUB socket bound to the specified endpoint. To collect such log output, create a SUB socket, subscribe to the traffic you care about, and connect to the endpoint. Log traffic is sent as a single string frame, in the same format as when sent to stdout. The log system supports a single sender; multiple calls to this method will bind the same sender to multiple endpoints. To disable the sender, call this method with a null argument.

Parameters:

  • endpoint (String, #to_s, nil)


774
775
776
777
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 774

def self.set_logsender(endpoint)
  result = ::CZMQ::FFI.zsys_set_logsender(endpoint)
  result
end

.set_logstream(stream) ⇒ void

This method returns an undefined value.

Set stream to receive log traffic. By default, log traffic is sent to stdout. If you set the stream to NULL, no stream will receive the log traffic (it may still be sent to the system facility).

Parameters:

  • stream (::FFI::Pointer, #to_ptr)


759
760
761
762
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 759

def self.set_logstream(stream)
  result = ::CZMQ::FFI.zsys_set_logstream(stream)
  result
end

.set_logsystem(logsystem) ⇒ void

This method returns an undefined value.

Enable or disable logging to the system facility (syslog on POSIX boxes, event log on Windows). By default this is disabled.

Parameters:

  • logsystem (Boolean)


784
785
786
787
788
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 784

def self.set_logsystem(logsystem)
  logsystem = !(0==logsystem||!logsystem) # boolean
  result = ::CZMQ::FFI.zsys_set_logsystem(logsystem)
  result
end

.set_max_msgsz(max_msgsz) ⇒ void

This method returns an undefined value.

Configure the maximum allowed size of a message sent. The default is INT_MAX.

Parameters:

  • max_msgsz (Integer, #to_int, #to_i)


532
533
534
535
536
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 532

def self.set_max_msgsz(max_msgsz)
  max_msgsz = Integer(max_msgsz)
  result = ::CZMQ::FFI.zsys_set_max_msgsz(max_msgsz)
  result
end

.set_max_sockets(max_sockets) ⇒ void

This method returns an undefined value.

Configure the number of sockets that ZeroMQ will allow. The default is 1024. The actual limit depends on the system, and you can query it by using zsys_socket_limit (). A value of zero means “maximum”. Note that this method is valid only before any socket is created.

Parameters:

  • max_sockets (Integer, #to_int, #to_i)


513
514
515
516
517
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 513

def self.set_max_sockets(max_sockets)
  max_sockets = Integer(max_sockets)
  result = ::CZMQ::FFI.zsys_set_max_sockets(max_sockets)
  result
end

.set_pipehwm(pipehwm) ⇒ void

This method returns an undefined value.

Configure the default HWM for zactor internal pipes; this is set on both ends of the pipe, for outgoing messages only (sndhwm). The default HWM is 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is defined, that provides the default. Note that a value of zero means no limit, i.e. infinite memory consumption.

Parameters:

  • pipehwm (Integer, #to_int, #to_i)


619
620
621
622
623
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 619

def self.set_pipehwm(pipehwm)
  pipehwm = Integer(pipehwm)
  result = ::CZMQ::FFI.zsys_set_pipehwm(pipehwm)
  result
end

.set_rcvhwm(rcvhwm) ⇒ void

This method returns an undefined value.

Configure the default incoming pipe limit (HWM) for new zsock instances. You can also set this separately on each zsock_t instance. The default HWM is 1,000, on all versions of ZeroMQ. If the environment variable ZSYS_RCVHWM is defined, that provides the default. Note that a value of zero means no limit, i.e. infinite memory consumption.

Parameters:

  • rcvhwm (Integer, #to_int, #to_i)


605
606
607
608
609
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 605

def self.set_rcvhwm(rcvhwm)
  rcvhwm = Integer(rcvhwm)
  result = ::CZMQ::FFI.zsys_set_rcvhwm(rcvhwm)
  result
end

.set_sndhwm(sndhwm) ⇒ void

This method returns an undefined value.

Configure the default outgoing pipe limit (HWM) for new zsock instances. You can also set this separately on each zsock_t instance. The default HWM is 1,000, on all versions of ZeroMQ. If the environment variable ZSYS_SNDHWM is defined, that provides the default. Note that a value of zero means no limit, i.e. infinite memory consumption.

Parameters:

  • sndhwm (Integer, #to_int, #to_i)


591
592
593
594
595
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 591

def self.set_sndhwm(sndhwm)
  sndhwm = Integer(sndhwm)
  result = ::CZMQ::FFI.zsys_set_sndhwm(sndhwm)
  result
end

.set_thread_priority(priority) ⇒ void

This method returns an undefined value.

Configure the scheduling priority of the ZMQ context thread pool. Not available on Windows. See the sched_setscheduler man page or sched.h for more information. If the environment variable ZSYS_THREAD_PRIORITY is defined, that provides the default. Note that this method is valid only before any socket is created.

Parameters:

  • priority (Integer, #to_int, #to_i)


500
501
502
503
504
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 500

def self.set_thread_priority(priority)
  priority = Integer(priority)
  result = ::CZMQ::FFI.zsys_set_thread_priority(priority)
  result
end

.set_thread_sched_policy(policy) ⇒ void

This method returns an undefined value.

Configure the scheduling policy of the ZMQ context thread pool. Not available on Windows. See the sched_setscheduler man page or sched.h for more information. If the environment variable ZSYS_THREAD_SCHED_POLICY is defined, that provides the default. Note that this method is valid only before any socket is created.

Parameters:

  • policy (Integer, #to_int, #to_i)


486
487
488
489
490
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 486

def self.set_thread_sched_policy(policy)
  policy = Integer(policy)
  result = ::CZMQ::FFI.zsys_set_thread_sched_policy(policy)
  result
end

.shutdownvoid

This method returns an undefined value.

Optionally shut down the CZMQ zsys layer; this normally happens automatically when the process exits; however this call lets you force a shutdown earlier, avoiding any potential problems with atexit() ordering, especially with Windows dlls.



109
110
111
112
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 109

def self.shutdown()
  result = ::CZMQ::FFI.zsys_shutdown()
  result
end

.socket(type, filename, line_nbr) ⇒ ::FFI::Pointer

Get a new ZMQ socket, automagically creating a ZMQ context if this is the first time. Caller is responsible for destroying the ZMQ socket before process exits, to avoid a ZMQ deadlock. Note: you should not use this method in CZMQ apps, use zsock_new() instead. *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • type (Integer, #to_int, #to_i)
  • filename (String, #to_s, nil)
  • line_nbr (Integer, #to_int, #to_i)

Returns:

  • (::FFI::Pointer)


124
125
126
127
128
129
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 124

def self.socket(type, filename, line_nbr)
  type = Integer(type)
  line_nbr = Integer(line_nbr)
  result = ::CZMQ::FFI.zsys_socket(type, filename, line_nbr)
  result
end

.socket_error(reason) ⇒ void

This method returns an undefined value.

Handle an I/O error on some socket operation; will report and die on fatal errors, and continue silently on “try again” errors. *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • reason (String, #to_s, nil)


412
413
414
415
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 412

def self.socket_error(reason)
  result = ::CZMQ::FFI.zsys_socket_error(reason)
  result
end

.socket_limitInteger

Return maximum number of ZeroMQ sockets that the system will support.

Returns:

  • (Integer)


522
523
524
525
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 522

def self.socket_limit()
  result = ::CZMQ::FFI.zsys_socket_limit()
  result
end

.sockname(socktype) ⇒ ::FFI::Pointer

Return ZMQ socket name for socket type *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • socktype (Integer, #to_int, #to_i)

Returns:

  • (::FFI::Pointer)


150
151
152
153
154
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 150

def self.sockname(socktype)
  socktype = Integer(socktype)
  result = ::CZMQ::FFI.zsys_sockname(socktype)
  result
end

.sprintf(format, *args) ⇒ ::FFI::Pointer

Format a string using printf formatting, returning a freshly allocated buffer. If there was insufficient memory, returns NULL. Free the returned string using zstr_free().

Parameters:

Returns:

  • (::FFI::Pointer)


334
335
336
337
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 334

def self.sprintf(format, *args)
  result = ::CZMQ::FFI.zsys_sprintf(format, *args)
  result
end

.test(verbose) ⇒ void

This method returns an undefined value.

Self test of this class.

Parameters:

  • verbose (Boolean)


844
845
846
847
848
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 844

def self.test(verbose)
  verbose = !(0==verbose||!verbose) # boolean
  result = ::CZMQ::FFI.zsys_test(verbose)
  result
end

.udp_close(handle) ⇒ Integer

Close a UDP socket *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • handle (Integer or FFI::Pointer)

Returns:

  • (Integer)


369
370
371
372
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 369

def self.udp_close(handle)
  result = ::CZMQ::FFI.zsys_udp_close(handle)
  result
end

.udp_new(routable) ⇒ Integer or FFI::Pointer

Create UDP beacon socket; if the routable option is true, uses multicast (not yet implemented), else uses broadcast. This method and related ones might eventually be moved to a zudp class. *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • routable (Boolean)

Returns:

  • (Integer or FFI::Pointer)


358
359
360
361
362
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 358

def self.udp_new(routable)
  routable = !(0==routable||!routable) # boolean
  result = ::CZMQ::FFI.zsys_udp_new(routable)
  result
end

.udp_recv(udpsock, peername, peerlen) ⇒ Zframe

Receive zframe from UDP socket, and set address of peer that sent it The peername must be a char [INET_ADDRSTRLEN] array if IPv6 is disabled or NI_MAXHOST if it’s enabled. Returns NULL when failing to get peer address. *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • udpsock (Integer or FFI::Pointer)
  • peername (::FFI::Pointer, #to_ptr)
  • peerlen (Integer, #to_int, #to_i)

Returns:



399
400
401
402
403
404
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 399

def self.udp_recv(udpsock, peername, peerlen)
  peerlen = Integer(peerlen)
  result = ::CZMQ::FFI.zsys_udp_recv(udpsock, peername, peerlen)
  result = Zframe.__new result, false
  result
end

.udp_send(udpsock, frame, address, addrlen) ⇒ Integer

Send zframe to UDP socket, return -1 if sending failed due to interface having disappeared (happens easily with WiFi) *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • udpsock (Integer or FFI::Pointer)
  • frame (Zframe, #__ptr)
  • address (::FFI::Pointer, #to_ptr)
  • addrlen (Integer, #to_int, #to_i)

Returns:

  • (Integer)


383
384
385
386
387
388
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 383

def self.udp_send(udpsock, frame, address, addrlen)
  frame = frame.__ptr if frame
  addrlen = Integer(addrlen)
  result = ::CZMQ::FFI.zsys_udp_send(udpsock, frame, address, addrlen)
  result
end

.version(major, minor, patch) ⇒ void

This method returns an undefined value.

Return the CZMQ version for run-time API detection; returns version number into provided fields, providing reference isn’t null in each case.

Parameters:

  • major (::FFI::Pointer, #to_ptr)
  • minor (::FFI::Pointer, #to_ptr)
  • patch (::FFI::Pointer, #to_ptr)


322
323
324
325
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 322

def self.version(major, minor, patch)
  result = ::CZMQ::FFI.zsys_version(major, minor, patch)
  result
end

.vprintf(format, argptr) ⇒ ::FFI::Pointer

Format a string with a va_list argument, returning a freshly allocated buffer. If there was insufficient memory, returns NULL. Free the returned string using zstr_free().

Parameters:

  • format (String, #to_s, nil)
  • argptr (::FFI::Pointer, #to_ptr)

Returns:

  • (::FFI::Pointer)


346
347
348
349
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 346

def self.vprintf(format, argptr)
  result = ::CZMQ::FFI.zsys_vprintf(format, argptr)
  result
end

.warning(format, *args) ⇒ void

This method returns an undefined value.

Log warning condition - high priority

Parameters:



805
806
807
808
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 805

def self.warning(format, *args)
  result = ::CZMQ::FFI.zsys_warning(format, *args)
  result
end

Instance Method Details

#__ptr::FFI::Pointer Also known as: to_ptr

Return internal pointer

Returns:

  • (::FFI::Pointer)

Raises:



47
48
49
50
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 47

def __ptr
  raise DestroyedError unless @ptr
  @ptr
end

#__ptr_give_ref::FFI::MemoryPointer

Note:

This detaches the current instance from the native object and thus makes it unusable.

Nullify internal pointer and return pointer pointer.

Returns:

  • (::FFI::MemoryPointer)

    the pointer pointing to a pointer pointing to the native object

Raises:



58
59
60
61
62
63
64
65
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 58

def __ptr_give_ref
  raise DestroyedError unless @ptr
  ptr_ptr = ::FFI::MemoryPointer.new :pointer
  ptr_ptr.write_pointer @ptr
  __undef_finalizer if @finalizer
  @ptr = nil
  ptr_ptr
end

#__undef_finalizervoid

Note:

Only use this if you need to and can guarantee that the native object will be freed by other means.

This method returns an undefined value.

Undefines the finalizer for this object.



70
71
72
73
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 70

def __undef_finalizer
  ObjectSpace.undefine_finalizer self
  @finalizer = nil
end

#null?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 42

def null?
  !@ptr or @ptr.null?
end