Object
DNSSD::Reply is used to return information
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
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
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 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 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
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
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.