protected void addAnswersForServiceInfo(JmDNSImpl jmDNSImpl, Set<DNSRecord> answers, ServiceInfoImpl info) { if ((info != null) && info.isAnnounced()) { if (this.getName().equalsIgnoreCase(info.getQualifiedName()) || this.getName().equalsIgnoreCase(info.getType())) { answers.addAll(jmDNSImpl.getLocalHost().answers(DNSRecordClass.UNIQUE, DNSConstants.DNS_TTL)); answers.addAll(info.answers(DNSRecordClass.UNIQUE, DNSConstants.DNS_TTL, jmDNSImpl.getLocalHost())); } if (logger.isLoggable(Level.FINER)) { logger.finer(jmDNSImpl.getName() + " DNSQuestion(" + this.getName() + ").addAnswersForServiceInfo(): info: " + info + "\n" + answers); } } }
protected void addAnswersForServiceInfo(JmDNSImpl jmDNSImpl, Set<DNSRecord> answers, ServiceInfoImpl info) { if ((info != null) && info.isAnnounced()) { if (this.getName().equalsIgnoreCase(info.getQualifiedName()) || this.getName().equalsIgnoreCase(info.getType())) { answers.addAll(jmDNSImpl.getLocalHost().answers(DNSRecordClass.UNIQUE, DNSConstants.DNS_TTL)); answers.addAll(info.answers(DNSRecordClass.UNIQUE, DNSConstants.DNS_TTL, jmDNSImpl.getLocalHost())); } if (logger.isLoggable(Level.FINER)) { logger.finer(jmDNSImpl.getName() + " DNSQuestion(" + this.getName() + ").addAnswersForServiceInfo(): info: " + info + "\n" + answers); } } }
protected void addAnswersForServiceInfo(JmDNSImpl jmDNSImpl, Set<DNSRecord> answers, ServiceInfoImpl info) { if ((info != null) && info.isAnnounced()) { if (this.getName().equalsIgnoreCase(info.getQualifiedName()) || this.getName().equalsIgnoreCase(info.getType())) { answers.addAll(jmDNSImpl.getLocalHost().answers(DNSRecordClass.UNIQUE, DNSConstants.DNS_TTL)); answers.addAll(info.answers(DNSRecordClass.UNIQUE, DNSConstants.DNS_TTL, jmDNSImpl.getLocalHost())); } if (logger.isLoggable(Level.FINER)) { logger.finer(jmDNSImpl.getName() + " DNSQuestion(" + this.getName() + ").addAnswersForServiceInfo(): info: " + info + "\n" + answers); } } }
protected void addAnswersForServiceInfo(JmDNSImpl jmDNSImpl, Set<DNSRecord> answers, ServiceInfoImpl info) { if ((info != null) && info.isAnnounced()) { if (this.getName().equalsIgnoreCase(info.getQualifiedName()) || this.getName().equalsIgnoreCase(info.getType()) || this.getName().equalsIgnoreCase(info.getTypeWithSubtype())) { answers.addAll(jmDNSImpl.getLocalHost().answers(this.getRecordClass(), DNSRecordClass.UNIQUE, DNSConstants.DNS_TTL)); answers.addAll(info.answers(this.getRecordClass(), DNSRecordClass.UNIQUE, DNSConstants.DNS_TTL, jmDNSImpl.getLocalHost())); } logger.debug("{} DNSQuestion({}).addAnswersForServiceInfo(): info: {}\n{}", jmDNSImpl.getName(), this.getName(), info, answers); } }
/** * Check if this question is answered by a given DNS record. */ boolean answeredBy(DNSEntry rec) { return this.isSameRecordClass(rec) && this.isSameType(rec) && this.getName().equals(rec.getName()); }
/** * Check if this question is answered by a given DNS record. */ boolean answeredBy(DNSEntry rec) { return this.isSameRecordClass(rec) && this.isSameType(rec) && this.getName().equals(rec.getName()); }
/** * Check if this question is answered by a given DNS record. */ boolean answeredBy(DNSEntry rec) { return this.isSameRecordClass(rec) && this.isSameType(rec) && this.getName().equals(rec.getName()); }
/** * Check if this question is answered by a given DNS record. */ boolean answeredBy(DNSEntry rec) { return this.isSameRecordClass(rec) && this.isSameType(rec) && this.getName().equals(rec.getName()); }
/** * Add a listener for a question. The listener will receive updates of answers to the question as they arrive, or from the cache if they are already available. * * @param listener * DSN listener * @param question * DNS query */ public void addListener(DNSListener listener, DNSQuestion question) { final long now = System.currentTimeMillis(); // add the new listener _listeners.add(listener); // report existing matched records if (question != null) { for (DNSEntry dnsEntry : this.getCache().getDNSEntryList(question.getName().toLowerCase())) { if (question.answeredBy(dnsEntry) && !dnsEntry.isExpired(now)) { listener.updateRecord(this.getCache(), now, dnsEntry); } } } }
/** * Add a listener for a question. The listener will receive updates of answers to the question as they arrive, or from the cache if they are already available. * * @param listener * DSN listener * @param question * DNS query */ public void addListener(DNSListener listener, DNSQuestion question) { final long now = System.currentTimeMillis(); // add the new listener _listeners.add(listener); // report existing matched records if (question != null) { for (DNSEntry dnsEntry : this.getCache().getDNSEntryList(question.getName().toLowerCase())) { if (question.answeredBy(dnsEntry) && !dnsEntry.isExpired(now)) { listener.updateRecord(this.getCache(), now, dnsEntry); } } } }
/** * Add a listener for a question. The listener will receive updates of answers to the question as they arrive, or from the cache if they are already available. * * @param listener * DSN listener * @param question * DNS query */ public void addListener(DNSListener listener, DNSQuestion question) { final long now = System.currentTimeMillis(); // add the new listener _listeners.add(listener); // report existing matched records if (question != null) { for (DNSEntry dnsEntry : this.getCache().getDNSEntryList(question.getName().toLowerCase())) { if (question.answeredBy(dnsEntry) && !dnsEntry.isExpired(now)) { listener.updateRecord(this.getCache(), now, dnsEntry); } } } }
/** * Add a listener for a question. The listener will receive updates of answers to the question as they arrive, or from the cache if they are already available. * * @param listener * DSN listener * @param question * DNS query */ public void addListener(DNSListener listener, DNSQuestion question) { final long now = System.currentTimeMillis(); // add the new listener _listeners.add(listener); // report existing matched records if (question != null) { Collection<? extends DNSEntry> entryList = this.getCache().getDNSEntryList(question.getName().toLowerCase()); if (entryList != null) { synchronized (entryList) { for (DNSEntry dnsEntry : entryList) { if (question.answeredBy(dnsEntry) && !dnsEntry.isExpired(now)) { listener.updateRecord(this.getCache(), now, dnsEntry); } } } } } }
void writeQuestion(DNSQuestion question) { writeName(question.getName()); writeShort(question.getRecordType().indexValue()); writeShort(question.getRecordClass().indexValue()); }
void writeQuestion(DNSQuestion question) { writeName(question.getName()); writeShort(question.getRecordType().indexValue()); writeShort(question.getRecordClass().indexValue()); }
void writeQuestion(DNSQuestion question) { writeName(question.getName()); writeShort(question.getRecordType().indexValue()); writeShort(question.getRecordClass().indexValue()); }
void writeQuestion(DNSQuestion question) { writeName(question.getName()); writeShort(question.getRecordType().indexValue()); writeShort(question.getRecordClass().indexValue()); }