CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/net/dns/rr/mr.rb
Views: 11784
1
# -*- coding: binary -*-
2
##
3
#
4
# Net::DNS::RR::MR
5
#
6
# $Id: MR.rb,v 1.4 2006/07/28 07:33:36 bluemonk Exp $
7
#
8
##
9
10
module Net
11
module DNS
12
13
class RR
14
15
#------------------------------------------------------------
16
# RR type MR
17
#------------------------------------------------------------
18
class MR < RR
19
attr_reader :newname
20
21
private
22
23
def check_name(name)
24
unless name =~ /(\w\.?)+\s*$/
25
raise RRArgumentError, "Name not valid: #{name.inspect}"
26
end
27
name
28
end
29
30
def build_pack
31
@newname_pack = pack_name(@newname)
32
@rdlength = @newname_pack.size
33
end
34
35
def set_type
36
@type = Net::DNS::RR::Types.new("MR")
37
end
38
39
def get_data
40
@newname_pack
41
end
42
43
def get_inspect
44
"#@newname"
45
end
46
47
def subclass_new_from_hash(args)
48
if args.has_key? :newname
49
@newname = check_name args[:newname]
50
else
51
raise RRArgumentError, ":newname field is mandatory but missing"
52
end
53
end
54
55
def subclass_new_from_string(str)
56
@newname = check_name(str)
57
end
58
59
def subclass_new_from_array(data,offset)
60
@newname = dn_expand(data,offset)
61
return offset
62
end
63
64
end # class MR
65
66
end # class RR
67
end # module DNS
68
end # module Net
69
70