Class: PacketGen::Header::DHCPv6::DUID_LLT

Inherits:
DUID show all
Defined in:
lib/packetgen/header/dhcpv6/duid.rb

Overview

DUID Based on Link-layer Address Plus Time

Author:

  • Sylvain Daubert

Since:

  • 2.5.0

Constant Summary collapse

BASE_TIME =

Base time for time computation

Since:

  • 2.5.0

Time.utc(2000, 1, 1)

Constants inherited from DUID

PacketGen::Header::DHCPv6::DUID::TYPES

Instance Attribute Summary collapse

Attributes inherited from DUID

#body, #type

Instance Method Summary collapse

Methods inherited from DUID

#read

Methods included from Types::Fieldable

#format_inspect, #read, #sz, #to_s, #type_name

Methods inherited from Types::Fields

#[], #[]=, #bits_on, define_bit_fields_on, define_field, define_field_after, define_field_before, #fields, fields, inherited, #initialize, #inspect, #offset_of, #optional?, #optional_fields, #present?, #read, remove_bit_fields_on, remove_field, #sz, #to_h, #to_s, update_field

Constructor Details

This class inherits a constructor from PacketGen::Types::Fields

Instance Attribute Details

#htypeInteger

16-bit hardware protocol type

Returns:

  • (Integer)

76
# File 'lib/packetgen/header/dhcpv6/duid.rb', line 76

define_field :htype, Types::Int16, default: 1

Returns:


83
# File 'lib/packetgen/header/dhcpv6/duid.rb', line 83

define_field :link_addr, Eth::MacAddr

#timeTime

Returns:

  • (Time)

Since:

  • 2.5.0


80
# File 'lib/packetgen/header/dhcpv6/duid.rb', line 80

define_field :time, Types::Int32, default: (Time.now - BASE_TIME).to_i

Instance Method Details

#to_humanString

Get human-readable DUID description

Returns:

  • (String)

Since:

  • 2.5.0


100
101
102
# File 'lib/packetgen/header/dhcpv6/duid.rb', line 100

def to_human
  "DUID_LLT<#{time},#{link_addr}>"
end