# -*- coding: binary -*-
##
#
# Net::DNS::RR::CNAME
# $Id: CNAME.rb,v 1.7 2006/07/28 07:33:36 bluemonk Exp $
module Net
module DNS
class RR
#------------------------------------------------------------
# RR type CNAME
class CNAME < RR
attr_reader :cname
private
def check_name(name)
unless name =~ /(\w\.?)+\s*$/ and name =~ /[a-zA-Z]/
raise RRArgumentError, "Canonical Name not valid: #{name}"
end
name
def build_pack
@cname_pack = pack_name(@cname)
@rdlength = @cname_pack.size
def set_type
@type = Net::DNS::RR::Types.new("CNAME")
def get_data
@cname_pack
def get_inspect
"#@cname"
def subclass_new_from_hash(args)
if args.has_key? :cname
@cname = check_name args[:cname]
else
raise RRArgumentError, ":cname field is mandatory but missing"
def subclass_new_from_string(str)
@cname = check_name(str)
def subclass_new_from_binary(data,offset)
@cname,offset = dn_expand(data,offset)
return offset
end # class CNAME
end # class RR
end # module DNS
end # module Net