Sha256: aec9c69d8ad232f63c91af6983e29936eb9647faccd603661f173c88cb743ab6

Contents?: true

Size: 1.63 KB

Versions: 27

Compression:

Stored size: 1.63 KB

Contents

module Pio
  class Dhcp
    # Dhcp Field Read Methods.
    module FieldUtil
      def message_type
        get_tlv_field(53)
      end

      def server_identifier
        get_tlv_field(54)
      end

      def client_identifier
        get_tlv_field(61)
      end

      def renewal_time_value
        get_tlv_field(58)
      end

      def rebinding_time_value
        get_tlv_field(59)
      end

      def ip_address_lease_time
        get_tlv_field(51)
      end

      def requested_ip_address
        get_tlv_field(50)
      end

      def parameters_list
        get_tlv_field(55)
      end

      def subnet_mask
        get_tlv_field(1)
      end

      def hw_addr_type
        dhcp.hw_addr_type
      end

      def hw_addr_len
        dhcp.hw_addr_len
      end

      def hops
        dhcp.hops
      end

      def transaction_id
        dhcp.transaction_id
      end

      def seconds
        dhcp.seconds
      end

      def bootp_flags
        dhcp.bootp_flags
      end

      def client_ip_address
        dhcp.client_ip_address
      end

      def your_ip_address
        dhcp.your_ip_address
      end

      def next_server_ip_address
        dhcp.next_server_ip_address
      end

      def relay_agent_ip_address
        dhcp.relay_agent_ip_address
      end

      def client_mac_address
        dhcp.client_mac_address
      end

      private

      def get_tlv(tlv_type)
        tlv = dhcp.optional_tlvs.find do |each|
          each['tlv_type'] == tlv_type
        end
        tlv['tlv_value'] if tlv
      end

      def get_tlv_field(tlv_type)
        tlv = get_tlv(tlv_type)
        tlv.snapshot if tlv
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
pio-0.30.1 lib/pio/dhcp/field_util.rb
pio-0.30.0 lib/pio/dhcp/field_util.rb
pio-0.29.0 lib/pio/dhcp/field_util.rb
pio-0.28.1 lib/pio/dhcp/field_util.rb
pio-0.28.0 lib/pio/dhcp/field_util.rb
pio-0.27.2 lib/pio/dhcp/field_util.rb
pio-0.27.1 lib/pio/dhcp/field_util.rb
pio-0.27.0 lib/pio/dhcp/field_util.rb
pio-0.26.0 lib/pio/dhcp/field_util.rb
pio-0.25.0 lib/pio/dhcp/field_util.rb
pio-0.24.2 lib/pio/dhcp/field_util.rb
pio-0.24.1 lib/pio/dhcp/field_util.rb
pio-0.24.0 lib/pio/dhcp/field_util.rb
pio-0.23.1 lib/pio/dhcp/field_util.rb
pio-0.23.0 lib/pio/dhcp/field_util.rb
pio-0.22.0 lib/pio/dhcp/field_util.rb
pio-0.21.1 lib/pio/dhcp/field_util.rb
pio-0.21.0 lib/pio/dhcp/field_util.rb
pio-0.20.1 lib/pio/dhcp/field_util.rb
pio-0.20.0 lib/pio/dhcp/field_util.rb