Parent

DNSSD::Reply

DNSSD::Reply is used to return information

Attributes

flags[R]

Flags for this reply, see DNSSD::Flags

interface[R]

The interface name for this reply

service[R]

The DNSSD::Service that created this reply

Public Class Methods

new(service, flags, interface) click to toggle source

Creates a new reply attached to service with flags on interface index interface

    # File lib/dnssd/reply.rb, line 25
25:   def initialize(service, flags, interface)
26:     @service = service
27:     @flags = DNSSD::Flags.new flags
28:     @interface = if interface then
29:                    interface > 0 ? DNSSD.interface_name(interface) : interface
30:                  end
31:   end

Public Instance Methods

fullname() click to toggle source

The full service domain name, see DNSS::Service#fullname

    # File lib/dnssd/reply.rb, line 36
36:   def fullname
37:     fullname = DNSSD::Service.fullname @name.gsub("\0032", ' '), @type, @domain
38:     fullname << '.' unless fullname =~ /\.$/
39:     fullname
40:   end
interface_name() click to toggle source

Expands the name of the interface including constants

    # File lib/dnssd/reply.rb, line 51
51:   def interface_name
52:     case @interface
53:     when nil                       then 'nil'
54:     when DNSSD::InterfaceAny       then 'any'
55:     when DNSSD::InterfaceLocalOnly then 'local'
56:     when DNSSD::InterfaceUnicast   then 'unicast'
57:     else @interface
58:     end
59:   end
protocol() click to toggle source

Protocol of this service

    # File lib/dnssd/reply.rb, line 64
64:   def protocol
65:     raise TypeError, 'no type on this reply' unless
66:       instance_variable_defined? :@type
67: 
68:     @type.split('.').last.sub '_', ''
69:   end
service_name() click to toggle source

Service name as in Socket.getservbyname

    # File lib/dnssd/reply.rb, line 74
74:   def service_name
75:     raise TypeError, 'no type on this reply' unless
76:       instance_variable_defined? :@type
77: 
78:     @type.split('.').first.sub '_', ''
79:   end
set_fullname(fullname) click to toggle source

Sets #, # and # from fullname

    # File lib/dnssd/reply.rb, line 84
84:   def set_fullname(fullname)
85:     fullname = fullname.gsub(/\\([0-9]{1,3})/) do $1.to_i.chr end
86:     fullname = fullname.scan(/(?:[^\\.]|\\\.)+/).map do |part|
87:       part.gsub "\\.", '.'
88:     end
89: 
90:     @name   = fullname[0]
91:     @type   = fullname[1, 2].join '.'
92:     @domain = fullname[3..1].map { |part| part.sub '.', '\.' }.join('.') + '.'
93:   end
set_names(name, type, domain) click to toggle source

Sets #, # and #

     # File lib/dnssd/reply.rb, line 98
 98:   def set_names(name, type, domain)
 99:     set_fullname [name, type, domain].join('.')
100:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.