Class: Dnsruby::RR::Generic
- Inherits:
-
Dnsruby::RR
- Object
- Dnsruby::RR
- Dnsruby::RR::Generic
- Defined in:
- lib/dnsruby/resource/generic.rb
Overview
Class to store generic RRs (RFC 3597)
Constant Summary
Constants inherited from Dnsruby::RR
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
data for the generic resource record.
Attributes inherited from Dnsruby::RR
#klass, #name, #rdata, #ttl, #type
Class Method Summary collapse
-
.create(type_value, class_value) ⇒ Object
:nodoc:.
-
.decode_rdata(msg) ⇒ Object
:nodoc: all.
Instance Method Summary collapse
-
#encode_rdata(msg, canonical = false) ⇒ Object
:nodoc: all.
-
#from_data(data) ⇒ Object
:nodoc: all.
-
#from_string(data) ⇒ Object
:nodoc: all.
-
#rdata_to_string ⇒ Object
:nodoc: all.
Methods inherited from Dnsruby::RR
#<=>, #==, #clone, #eql?, find_class, #from_hash, get_class, get_num, #hash, implemented_rrs, #init_defaults, new_from_data, new_from_hash, new_from_string, #rdlength, #sameRRset, #to_s
Instance Attribute Details
#data ⇒ Object (readonly)
data for the generic resource record
21 22 23 |
# File 'lib/dnsruby/resource/generic.rb', line 21 def data @data end |
Class Method Details
.create(type_value, class_value) ⇒ Object
:nodoc:
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dnsruby/resource/generic.rb', line 46 def self.create(type_value, class_value) #:nodoc: c = Class.new(Generic) # c.type = type_value # c.klass = class_value c.const_set(:TypeValue, type_value) c.const_set(:ClassValue, class_value) Generic.const_set("Type#{type_value}_Class#{class_value}", c) ClassHash[[type_value, class_value]] = c return c end |
.decode_rdata(msg) ⇒ Object
:nodoc: all
42 43 44 |
# File 'lib/dnsruby/resource/generic.rb', line 42 def self.decode_rdata(msg) #:nodoc: all return self.new(msg.get_bytes) end |
Instance Method Details
#encode_rdata(msg, canonical = false) ⇒ Object
:nodoc: all
38 39 40 |
# File 'lib/dnsruby/resource/generic.rb', line 38 def encode_rdata(msg, canonical=false) #:nodoc: all msg.put_bytes(data) end |
#from_data(data) ⇒ Object
:nodoc: all
23 24 25 |
# File 'lib/dnsruby/resource/generic.rb', line 23 def from_data(data) #:nodoc: all @data = data[0] end |
#from_string(data) ⇒ Object
:nodoc: all
34 35 36 |
# File 'lib/dnsruby/resource/generic.rb', line 34 def from_string(data) #:nodoc: all @data = data end |
#rdata_to_string ⇒ Object
:nodoc: all
27 28 29 30 31 32 |
# File 'lib/dnsruby/resource/generic.rb', line 27 def rdata_to_string #:nodoc: all if (@data!=nil) return "\\# " + @data.length.to_s + " " + @data.unpack("H*")[0] end return "#NO DATA" end |