private DNSRecord.Address getDNS4AddressRecord(boolean unique, int ttl) { if (this.getInetAddress() instanceof Inet4Address) { return new DNSRecord.IPv4Address(this.getName(), DNSRecordClass.CLASS_IN, unique, ttl, this.getInetAddress()); } return null; }
/** * {@inheritDoc} */ @Override public boolean advanceState(DNSTask task) { return this._localHost.advanceState(task); }
/** * {@inheritDoc} */ @Override public void associateWithTask(DNSTask task, DNSState state) { this._localHost.associateWithTask(task, state); }
DNSRecord.Pointer getDNSReverseAddressRecord(DNSRecordType type, boolean unique, int ttl) { switch (type) { case TYPE_A: return this.getDNS4ReverseAddressRecord(unique, ttl); case TYPE_A6: case TYPE_AAAA: return this.getDNS6ReverseAddressRecord(unique, ttl); default: } return null; }
DNSRecord.Address getDNSAddressRecord(DNSRecordType type, boolean unique, int ttl) { switch (type) { case TYPE_A: return this.getDNS4AddressRecord(unique, ttl); case TYPE_A6: case TYPE_AAAA: return this.getDNS6AddressRecord(unique, ttl); default: } return null; }
@Override public void addAnswers(JmDNSImpl jmDNSImpl, Set<DNSRecord> answers) { String loname = this.getName().toLowerCase(); if (jmDNSImpl.getLocalHost().getName().equalsIgnoreCase(loname)) { // type = DNSConstants.TYPE_A; answers.addAll(jmDNSImpl.getLocalHost().answers(this.isUnique(), DNSConstants.DNS_TTL)); return; } // Service type request if (jmDNSImpl.getServiceTypes().containsKey(loname)) { DNSQuestion question = new Pointer(this.getName(), DNSRecordType.TYPE_PTR, this.getRecordClass(), this.isUnique()); question.addAnswers(jmDNSImpl, answers); return; } this.addAnswersForServiceInfo(jmDNSImpl, answers, (ServiceInfoImpl) jmDNSImpl.getServices().get(loname)); }
/** * {@inheritDoc} */ @Override public String getHostName() { return _localHost.getName(); }
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); } } }
logger.log(Level.WARNING, "Could not intialize the host network interface on " + address + "because of an error: " + e.getMessage(), e); addr = loopbackAddress(); aName = ((jmdnsName != null) && (jmdnsName.length() > 0) ? jmdnsName : "computer"); localhost = new HostInfo(addr, aName, dns); return localhost;
Inet4Address getInet4Address() { if (this.getInetAddress() instanceof Inet4Address) { return (Inet4Address) _address; } return null; }
/** * {@inheritDoc} */ @Override public boolean closeState() { return this._localHost.closeState(); }
/** * {@inheritDoc} */ @Override public boolean cancelState() { return this._localHost.cancelState(); }
@Override public void addAnswers(JmDNSImpl jmDNSImpl, Set<DNSRecord> answers) { String loname = this.getName().toLowerCase(); if (jmDNSImpl.getLocalHost().getName().equalsIgnoreCase(loname)) { // type = DNSConstants.TYPE_A; answers.addAll(jmDNSImpl.getLocalHost().answers(this.isUnique(), DNSConstants.DNS_TTL)); return; } // Service type request if (jmDNSImpl.getServiceTypes().containsKey(loname)) { DNSQuestion question = new Pointer(this.getName(), DNSRecordType.TYPE_PTR, this.getRecordClass(), this.isUnique()); question.addAnswers(jmDNSImpl, answers); return; } this.addAnswersForServiceInfo(jmDNSImpl, answers, (ServiceInfoImpl) jmDNSImpl.getServices().get(loname)); }
DNSRecord.Address getDNSAddressRecord(DNSRecordType type, boolean unique, int ttl) { switch (type) { case TYPE_A: return this.getDNS4AddressRecord(unique, ttl); case TYPE_A6: case TYPE_AAAA: return this.getDNS6AddressRecord(unique, ttl); default: } return null; }
/** * {@inheritDoc} */ @Override public String getHostName() { return _localHost.getName(); }
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); } } }
DNSRecord.Pointer getDNSReverseAddressRecord(DNSRecordType type, boolean unique, int ttl) { switch (type) { case TYPE_A: return this.getDNS4ReverseAddressRecord(unique, ttl); case TYPE_A6: case TYPE_AAAA: return this.getDNS6ReverseAddressRecord(unique, ttl); default: } return null; }
logger.log(Level.WARNING, "Could not intialize the host network interface on " + address + "because of an error: " + e.getMessage(), e); addr = loopbackAddress(); aName = ((jmdnsName != null) && (jmdnsName.length() > 0) ? jmdnsName : "computer"); localhost = new HostInfo(addr, aName, dns); return localhost;
Inet4Address getInet4Address() { if (this.getInetAddress() instanceof Inet4Address) { return (Inet4Address) _address; } return null; }
/** * {@inheritDoc} */ @Override public boolean closeState() { return this._localHost.closeState(); }