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

.newCZMQ::Ziflist

Get a list of network interfaces currently defined on the system

Returns:

  • (CZMQ::Ziflist)


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

.new_ipv6Ziflist

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

Returns:



177
178
179
180
181
# 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

.test(verbose) ⇒ void

This method returns an undefined value.

Self test of this class.

Parameters:

  • verbose (Boolean)


207
208
209
210
211
# 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

Instance Method Details

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

Return internal pointer

Returns:

  • (::FFI::Pointer)

Raises:



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

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:



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



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

#addressString

Return the current interface IP address as a printable string

Returns:

  • (String)

Raises:



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

#broadcastString

Return the current interface broadcast address as a printable string

Returns:

  • (String)

Raises:



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

#destroyvoid

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

#firstString

Get first network interface, return NULL if there are none

Returns:

  • (String)

Raises:



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_ipv6Boolean

Return true if the current interface uses IPv6

Returns:

  • (Boolean)

Raises:



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

#netmaskString

Return the current interface network mask as a printable string

Returns:

  • (String)

Raises:



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

#nextString

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

Returns:

  • (String)

Raises:



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

Returns:

  • (Boolean)


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

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

This method returns an undefined value.

Return the list of interfaces.

Raises:



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

#reloadvoid

This method returns an undefined value.

Reload network interfaces from system

Raises:



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_ipv6void

This method returns an undefined value.

Reload network interfaces from system, including IPv6

Raises:



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

#sizeInteger

Return the number of network interfaces on system

Returns:

  • (Integer)

Raises:



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