Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/net/dns/rr/txt.rb
Views: 11784
# -*- coding: binary -*-1##2#3# Net::DNS::RR::TXT4#5# $Id: TXT.rb,v 1.4 2006/07/28 07:33:36 bluemonk Exp $6#7##8910module Net11module DNS12class RR1314#------------------------------------------------------------15# RR type TXT16#------------------------------------------------------------17class TXT < RR18attr_reader :txt1920private2122def build_pack23str = ""24@txt.split(" ").each do |txt|25str += [txt.length,txt].pack("C a*")26end27@txt_pack = str28@rdlength = @txt_pack.size29end3031def set_type32@type = Net::DNS::RR::Types.new("TXT")33end3435def get_data36@txt_pack37end3839def subclass_new_from_hash(args)40if args.has_key? :txt41@txt = args[:txt].strip42else43raise RRArgumentError, ":txt field is mandatory but missing"44end45end4647def subclass_new_from_string(str)48@txt = str.strip49end5051def subclass_new_from_binary(data,offset)52off_end = offset + @rdlength53@txt = ""54while offset < off_end55len = data.unpack("@#{offset} C")[0]56offset += 157str = data[offset..offset+len-1]58offset += len59@txt << str << " "60end61return offset62end6364end # class TXT6566end # class RR67end # module DNS68end # module Net697071