Class: DhcpsApi::DHCP_BINARY_DATA

Inherits:
DHCPS_Struct
  • Object
show all
Defined in:
lib/dhcpsapi/data_structures.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DHCPS_Struct

#as_ruby_struct, ruby_struct_attr

Methods included from RubyStructAttrHelpers

#dhcp_client_uid_to_mac, #ip_to_uint32, #mac_address_to_array_of_uint8, #to_string, #to_wchar_string, #uint32_to_ip, #wchar_string_length

Class Method Details

.from_data(data) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/dhcpsapi/data_structures.rb', line 77

def self.from_data(data)
  to_return = new
  to_return[:data_length] = data.size
  to_return[:data] = FFI::MemoryPointer.new(:uint8, data.size)
  to_return[:data].write_array_of_uint8(data)
  to_return
end

Instance Method Details

#data_as_ruby_struct_attrObject



85
86
87
# File 'lib/dhcpsapi/data_structures.rb', line 85

def data_as_ruby_struct_attr
  self[:data].read_array_of_type(:uint8, :read_uint8, self[:data_length])
end