class Net::DNS::RR::SRV

Attributes

host[R]
port[R]
priority[R]
weight[R]

Public Instance Methods

value() click to toggle source

Gets the standardized value for this record, represented by the value of port, priority, weight, and host.

Returns a String.

# File lib/net/dns/rr/srv.rb, line 20
def value
  "#{port} #{priority} #{weight} #{host}"
end

Private Instance Methods

build_pack() click to toggle source
# File lib/net/dns/rr/srv.rb, line 26
def build_pack
  @srv_pack = [@port, @priority, @weight].pack("n n n")
  @srv_pack += pack_name(@host)
  @rdlength = @srv_pack.size
end
get_data() click to toggle source
# File lib/net/dns/rr/srv.rb, line 57
def get_data
  @srv_pack
end
get_inspect() click to toggle source
# File lib/net/dns/rr/srv.rb, line 53
def get_inspect
  value
end
set_type() click to toggle source
# File lib/net/dns/rr/srv.rb, line 49
def set_type
  @type = Net::DNS::RR::Types.new("SRV")
end
subclass_new_from_binary(data,offset) click to toggle source
# File lib/net/dns/rr/srv.rb, line 32
def subclass_new_from_binary(data,offset)
  off_end = offset + @rdlength
  @priority, @weight, @port = data.unpack("@#{offset} n n n")
  offset+=6

  @host=[]
  while offset < off_end
    len = data.unpack("@#{offset} C")[0]
    offset += 1
    str = data[offset..offset+len-1]
    offset += len
    @host << str
  end
  @host=@host.join(".")
  offset
end