class Lib::BOOTP::Packet::HardwareAddressType
Public Class Methods
new(htype=1)
click to toggle source
# File lib/lib/bootp/packet/hardware_address_type.rb, line 18 def initialize(htype=1) raise ArgumentError, "Hardware address type out of range : #{htype}" unless (0..12).include? htype @htype = htype end
unpack(htype)
click to toggle source
# File lib/lib/bootp/packet/hardware_address_type.rb, line 71 def self.unpack(htype) self.new htype.unpack('C').first end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/lib/bootp/packet/hardware_address_type.rb, line 56 def <=>(other) case other when String self.to_s <=> other when Integer self.to_i <=> other else self.to_i <=> other.to_i end end
pack()
click to toggle source
# File lib/lib/bootp/packet/hardware_address_type.rb, line 67 def pack [@htype.to_i].pack('C') end
to_s()
click to toggle source
# File lib/lib/bootp/packet/hardware_address_type.rb, line 23 def to_s case @htype when 0 'Lease Query' when 1 'Ethernet (10Mb)' when 2 'Experimental Ethernet (3Mb)' when 3 'Amateur Radio AX.25' when 4 'Proteon ProNET Token Ring' when 5 'Chaos' when 6 'IEEE 802 Networks' when 7 'ARCNET' when 8 'Hyperchannel' when 9 'Lanstar' when 10 'Autonet Short Address' when 11 'LocalTalk' when 12 'LocalNet (IBM PCNet or SYTEK LocalNET)' else raise ArgumentError, "Hardware address type out of range : #{@htype}" end end