class CZMQ::FFI::Ziflist
List of network interfaces available on system @note This class is 100% generated using zproject.
Public Class Methods
@param ptr [::FFI::Pointer] @return [Proc]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 35 def self.create_finalizer_for(ptr) Proc.new do ptr_ptr = ::FFI::MemoryPointer.new :pointer ptr_ptr.write_pointer ptr ::CZMQ::FFI.ziflist_destroy ptr_ptr end end
Attaches the pointer ptr to this instance and defines a finalizer for it if necessary. @param ptr [::FFI::Pointer] @param finalize [Boolean]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.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
Get a list of network interfaces currently defined on the system @return [CZMQ::Ziflist]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 78 def self.new() ptr = ::CZMQ::FFI.ziflist_new() __new ptr end
Get a list of network interfaces currently defined on the system Includes IPv6 interfaces
@return [Ziflist]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 177 def self.new_ipv6() result = ::CZMQ::FFI.ziflist_new_ipv6() result = Ziflist.__new result, true result end
Self test of this class.
@param verbose [Boolean] @return [void]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 207 def self.test(verbose) verbose = !(0==verbose||!verbose) # boolean result = ::CZMQ::FFI.ziflist_test(verbose) result end
Public Instance Methods
Return internal pointer @return [::FFI::Pointer]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 48 def __ptr raise DestroyedError unless @ptr @ptr end
Nullify internal pointer and return pointer pointer. @note This detaches the current instance from the native object
and thus makes it unusable.
@return [::FFI::MemoryPointer] the pointer pointing to a pointer
pointing to the native object
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 59 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
Undefines the finalizer for this object. @note Only use this if you need to and can guarantee that the native
object will be freed by other means.
@return [void]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 71 def __undef_finalizer ObjectSpace.undefine_finalizer self @finalizer = nil end
Return the current interface IP address as a printable string
@return [String]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 136 def address() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_address(self_p) result end
Return the current interface broadcast address as a printable string
@return [String]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 146 def broadcast() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_broadcast(self_p) result end
Destroy a ziflist instance
@return [void]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 86 def destroy() return unless @ptr self_p = __ptr_give_ref result = ::CZMQ::FFI.ziflist_destroy(self_p) result end
Get first network interface, return NULL if there are none
@return [String]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 116 def first() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_first(self_p) result end
Return true if the current interface uses IPv6
@return [Boolean]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 196 def is_ipv6() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_is_ipv6(self_p) result end
Return the current interface network mask as a printable string
@return [String]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 156 def netmask() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_netmask(self_p) result end
Get next network interface, return NULL if we hit the last one
@return [String]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 126 def next() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_next(self_p) result end
@return [Boolean]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 43 def null? !@ptr or @ptr.null? end
Return the list of interfaces.
@return [void]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 166 def print() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_print(self_p) result end
Reload network interfaces from system
@return [void]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 96 def reload() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_reload(self_p) result end
Reload network interfaces from system, including IPv6
@return [void]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 186 def reload_ipv6() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_reload_ipv6(self_p) result end
Return the number of network interfaces on system
@return [Integer]
# File lib/czmq-ffi-gen/czmq/ffi/ziflist.rb, line 106 def size() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_size(self_p) result end