Class: CZMQ::FFI::Ziflist

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

Overview

Note:

This class is 100% generated using zproject.

List of network interfaces available on system

Defined Under Namespace

Classes: DestroyedError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr, finalize = true) ⇒ Ziflist

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/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

.__newObject



18
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 18

alias :__new :new

.create_finalizer_for(ptr) ⇒ Proc

Parameters:

  • ptr (::FFI::Pointer)

Returns:

  • (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

.newCZMQ::Ziflist

Get a list of network interfaces currently defined on the system

Returns:

  • (CZMQ::Ziflist)


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

.new_ipv6Ziflist

Get a list of network interfaces currently defined on the system Includes IPv6 interfaces

Returns:



188
189
190
191
192
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 188

def self.new_ipv6()
  result = ::CZMQ::FFI.ziflist_new_ipv6()
  result = Ziflist.__new result, true
  result
end

.test(verbose) ⇒ void

This method returns an undefined value.

Self test of this class.

Parameters:

  • verbose (Boolean)


218
219
220
221
222
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 218

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

Instance Method Details

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

Return internal pointer

Returns:

  • (::FFI::Pointer)

Raises:



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

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:



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_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.



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

#addressString

Return the current interface IP address as a printable string

Returns:

  • (String)

Raises:



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

#broadcastString

Return the current interface broadcast address as a printable string

Returns:

  • (String)

Raises:



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

#destroyvoid

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

#firstString

Get first network interface, return NULL if there are none

Returns:

  • (String)

Raises:



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_ipv6Boolean

Return true if the current interface uses IPv6

Returns:

  • (Boolean)

Raises:



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

#macString

Return the current interface MAC address as a printable string

Returns:

  • (String)

Raises:



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

#netmaskString

Return the current interface network mask as a printable string

Returns:

  • (String)

Raises:



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

#nextString

Get next network interface, return NULL if we hit the last one

Returns:

  • (String)

Raises:



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

Returns:

  • (Boolean)


44
45
46
# File 'lib/czmq-ffi-gen/czmq/ffi/ziflist.rb', line 44

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

This method returns an undefined value.

Return the list of interfaces.

Raises:



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

#reloadvoid

This method returns an undefined value.

Reload network interfaces from system

Raises:



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_ipv6void

This method returns an undefined value.

Reload network interfaces from system, including IPv6

Raises:



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

#sizeInteger

Return the number of network interfaces on system

Returns:

  • (Integer)

Raises:



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