Class: Facter::Resolvers::Solaris::FFI::Arpreq

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/facter/resolvers/solaris/ffi/structs.rb

Overview

Since:

  • 2.0.0

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FFI::Struct

read_list

Class Method Details

.new_for_ioctl(lifreq) ⇒ Object

Since:

  • 2.0.0



34
35
36
37
38
39
40
# File 'lib/facter/resolvers/solaris/ffi/structs.rb', line 34

def self.new_for_ioctl(lifreq)
  arp = Arpreq.new
  arp_addr = SockaddrIn.new(arp[:arp_pa].to_ptr)
  arp_addr[:sin_addr][:s_addr] = SockaddrIn.new(lifreq.lifru_addr.to_ptr).s_addr

  arp
end

Instance Method Details

#sa_data_to_macObject

Since:

  • 2.0.0



28
29
30
31
32
# File 'lib/facter/resolvers/solaris/ffi/structs.rb', line 28

def sa_data_to_mac
  self[:arp_ha][:sa_data].entries[0, 6].map do |s|
    s.to_s(16).rjust(2, '0')
  end.join ':'
end