Class: CZMQ::FFI::Ziflist
- Inherits:
-
Object
- Object
- CZMQ::FFI::Ziflist
- Defined in:
- lib/czmq-ffi-gen/czmq/ffi/ziflist.rb
Overview
This class is 100% generated using zproject.
List of network interfaces available on system
Defined Under Namespace
Classes: DestroyedError
Class Method Summary collapse
- .__new ⇒ Object
- .create_finalizer_for(ptr) ⇒ Proc
-
.new ⇒ CZMQ::Ziflist
Get a list of network interfaces currently defined on the system.
-
.new_ipv6 ⇒ Ziflist
Get a list of network interfaces currently defined on the system Includes IPv6 interfaces.
-
.test(verbose) ⇒ void
Self test of this class.
Instance Method Summary collapse
-
#__ptr ⇒ ::FFI::Pointer
(also: #to_ptr)
Return internal pointer.
-
#__ptr_give_ref ⇒ ::FFI::MemoryPointer
Nullify internal pointer and return pointer pointer.
-
#__undef_finalizer ⇒ void
Undefines the finalizer for this object.
-
#address ⇒ String
Return the current interface IP address as a printable string.
-
#broadcast ⇒ String
Return the current interface broadcast address as a printable string.
-
#destroy ⇒ void
Destroy a ziflist instance.
-
#first ⇒ String
Get first network interface, return NULL if there are none.
-
#initialize(ptr, finalize = true) ⇒ Ziflist
constructor
Attaches the pointer ptr to this instance and defines a finalizer for it if necessary.
-
#is_ipv6 ⇒ Boolean
Return true if the current interface uses IPv6.
-
#netmask ⇒ String
Return the current interface network mask as a printable string.
-
#next ⇒ String
Get next network interface, return NULL if we hit the last one.
- #null? ⇒ Boolean
-
#print ⇒ void
Return the list of interfaces.
-
#reload ⇒ void
Reload network interfaces from system.
-
#reload_ipv6 ⇒ void
Reload network interfaces from system, including IPv6.
-
#size ⇒ Integer
Return the number of network interfaces on system.
Constructor Details
#initialize(ptr, finalize = true) ⇒ Ziflist
Attaches the pointer ptr to this instance and defines a finalizer for it if necessary.
24 25 26 27 28 29 30 31 32 |
# 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 |
Class Method Details
.__new ⇒ Object
18 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 18 alias :__new :new |
.create_finalizer_for(ptr) ⇒ Proc
35 36 37 38 39 40 41 |
# 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 |
.new ⇒ CZMQ::Ziflist
Get a list of network interfaces currently defined on the system
78 79 80 81 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 78 def self.new() ptr = ::CZMQ::FFI.ziflist_new() __new ptr end |
Instance Method Details
#__ptr ⇒ ::FFI::Pointer Also known as: to_ptr
Return internal pointer
48 49 50 51 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 48 def __ptr raise DestroyedError unless @ptr @ptr end |
#__ptr_give_ref ⇒ ::FFI::MemoryPointer
This detaches the current instance from the native object and thus makes it unusable.
Nullify internal pointer and return pointer pointer.
59 60 61 62 63 64 65 66 |
# 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 |
#__undef_finalizer ⇒ void
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.
71 72 73 74 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 71 def __undef_finalizer ObjectSpace.undefine_finalizer self @finalizer = nil end |
#address ⇒ String
Return the current interface IP address as a printable string
136 137 138 139 140 141 |
# 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 |
#broadcast ⇒ String
Return the current interface broadcast address as a printable string
146 147 148 149 150 151 |
# 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 ⇒ void
This method returns an undefined value.
Destroy a ziflist instance
86 87 88 89 90 91 |
# 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 |
#first ⇒ String
Get first network interface, return NULL if there are none
116 117 118 119 120 121 |
# 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 |
#is_ipv6 ⇒ Boolean
Return true if the current interface uses IPv6
196 197 198 199 200 201 |
# 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 |
#netmask ⇒ String
Return the current interface network mask as a printable string
156 157 158 159 160 161 |
# 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 |
#next ⇒ String
Get next network interface, return NULL if we hit the last one
126 127 128 129 130 131 |
# 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 |
#null? ⇒ Boolean
43 44 45 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 43 def null? !@ptr or @ptr.null? end |
#print ⇒ void
This method returns an undefined value.
Return the list of interfaces.
166 167 168 169 170 171 |
# 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 ⇒ void
This method returns an undefined value.
Reload network interfaces from system
96 97 98 99 100 101 |
# 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_ipv6 ⇒ void
This method returns an undefined value.
Reload network interfaces from system, including IPv6
186 187 188 189 190 191 |
# 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 |
#size ⇒ Integer
Return the number of network interfaces on system
106 107 108 109 110 111 |
# 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 |