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.



2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2552

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



2569
2570
2571
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2569

def flags
  @flags
end

#tagObject (readonly)

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



2574
2575
2576
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2574

def tag
  @tag
end

#valueObject (readonly)

Property value.



2579
2580
2581
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2579

def value
  @value
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:



2594
2595
2596
2597
2598
2599
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2594

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)


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

def critical?
  flags & 0x80 != 0
end

#encode_rdata(msg) ⇒ Object

:nodoc:



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

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