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.
-
#mac ⇒ String
Return the current interface MAC address as a printable string.
-
#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 42 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 35 def self.create_finalizer_for(ptr) ptr_ptr = ::FFI::MemoryPointer.new :pointer Proc.new do 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
79 80 81 82 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 79 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
49 50 51 52 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 49 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.
60 61 62 63 64 65 66 67 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 60 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.
72 73 74 75 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 72 def __undef_finalizer ObjectSpace.undefine_finalizer self @finalizer = nil end |
#address ⇒ String
Return the current interface IP address as a printable string
137 138 139 140 141 142 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 137 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
147 148 149 150 151 152 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 147 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
87 88 89 90 91 92 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 87 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
117 118 119 120 121 122 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 117 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
207 208 209 210 211 212 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 207 def is_ipv6() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_is_ipv6(self_p) result end |
#mac ⇒ String
Return the current interface MAC address as a printable string
167 168 169 170 171 172 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 167 def mac() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_mac(self_p) result end |
#netmask ⇒ String
Return the current interface network mask as a printable string
157 158 159 160 161 162 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 157 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
127 128 129 130 131 132 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 127 def next() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_next(self_p) result end |
#null? ⇒ Boolean
44 45 46 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 44 def null? !@ptr or @ptr.null? end |
#print ⇒ void
This method returns an undefined value.
Return the list of interfaces.
177 178 179 180 181 182 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 177 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
97 98 99 100 101 102 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 97 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
197 198 199 200 201 202 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 197 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
107 108 109 110 111 112 |
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 107 def size() raise DestroyedError unless @ptr self_p = @ptr result = ::CZMQ::FFI.ziflist_size(self_p) result end |