if( additionals == null ) { additionals = new Vector(); additionals.addElement( host ); }
additionals.addElement( host );
  private DNSOutgoing typePTR( DNSQuestion q, DNSIncoming in,                                InetAddress addr, int port,                                DNSOutgoing out, Vector additionals )     throws IOException   {    registerServiceType( q.name ); // Wait time needed for shared query response.    waitInterval( DNSConstants.SHARED_QUERY_TIME );    // find matching services    for( Enumeration s = services.elements(); s.hasMoreElements(); )     {      ServiceInfo info = (ServiceInfo)s.nextElement();      if( q.name.equalsIgnoreCase( info.type ) )       {        out = addAnswer( in, addr, port, out,                          new DNSRecord.Pointer( info.type, DNSConstants.TYPE_PTR,                                                 DNSConstants.CLASS_IN, DNSConstants.DNS_TTL,                                                 info.name ) );        // additional answers, in case there is room        if( additionals == null )         {          additionals = new Vector();          additionals.addElement( host );        }        additionals.addElement( new DNSRecord.Service( info.name, DNSConstants.TYPE_SRV,                                                        DNSConstants.CLASS_IN | DNSConstants.CLASS_UNIQUE,                                                        DNSConstants.DNS_TTL, info.priority,                                                        info.weight, info.port, host.name ) );        additionals.addElement( new DNSRecord.Text( info.name, DNSConstants.TYPE_TXT,                                                     DNSConstants.CLASS_IN | DNSConstants.CLASS_UNIQUE,                                                     DNSConstants.DNS_TTL, info.text ) );      }    }    if( q.name.equalsIgnoreCase( "_services._mdns._udp.local." ) )     {      for( Enumeration t = serviceTypes.elements(); t.hasMoreElements(); )       {        out = addAnswer( in, addr, port, out,                         new DNSRecord.Pointer( "_services._mdns._udp.local.",                                                 DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN,                                                 DNSConstants.DNS_TTL, (String)t.nextElement() ) );      }    }    return out;  }