Class: Gem::Resolv::DNS::Resource::CAA

Inherits:
Gem::Resolv::DNS::Resource show all
Defined in:
lib/rubygems/vendor/resolv/lib/resolv.rb

Overview

CAA resource record defined in RFC 8659

These records identify certificate authority allowed to issue certificates for the given domain.

Constant Summary collapse

TypeValue =
257

Constants inherited from Gem::Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes, ClassValue

Instance Attribute Summary collapse

Attributes inherited from Gem::Resolv::DNS::Resource

#ttl

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gem::Resolv::DNS::Resource

#==, #eql?, get_class, #hash

Constructor Details

#initialize(flags, tag, value) ⇒ CAA

Creates a new CAA for flags, tag and value.



2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2566

def initialize(flags, tag, value)
  unless (0..255) === flags
    raise ArgumentError.new('flags must be an Integer between 0 and 255')
  end
  unless (1..15) === tag.bytesize
    raise ArgumentError.new('length of tag must be between 1 and 15')
  end

  @flags = flags
  @tag = tag
  @value = value
end

Instance Attribute Details

#flagsObject (readonly)

Flags for this proprty:

  • Bit 0 : 0 = not critical, 1 = critical



2583
2584
2585
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2583

def flags
  @flags
end

#tagObject (readonly)

Property tag (“issue”, “issuewild”, “iodef”…).



2588
2589
2590
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2588

def tag
  @tag
end

#valueObject (readonly)

Property value.



2593
2594
2595
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2593

def value
  @value
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:



2608
2609
2610
2611
2612
2613
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2608

def self.decode_rdata(msg) # :nodoc:
  flags, = msg.get_unpack('C')
  tag = msg.get_string
  value = msg.get_bytes
  self.new flags, tag, value
end

Instance Method Details

#critical?Boolean

Whether the critical flag is set on this property.

Returns:

  • (Boolean)


2598
2599
2600
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2598

def critical?
  flags & 0x80 != 0
end

#encode_rdata(msg) ⇒ Object

:nodoc:



2602
2603
2604
2605
2606
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2602

def encode_rdata(msg) # :nodoc:
  msg.put_pack('C', @flags)
  msg.put_string(@tag)
  msg.put_bytes(@value)
end