if (record.getName().equalsIgnoreCase(this.getServer())) { final DNSRecord.Address address = (DNSRecord.Address) record; if (address.getAddress() instanceof Inet4Address) { final Inet4Address inet4Address = (Inet4Address) address.getAddress(); if(_ipv4Addresses.add(inet4Address)) { serviceUpdated = true; if (record.getName().equalsIgnoreCase(this.getServer())) { final DNSRecord.Address address = (DNSRecord.Address) record; if (address.getAddress() instanceof Inet6Address) { final Inet6Address inet6Address = (Inet6Address) address.getAddress(); if(_ipv6Addresses.add(inet6Address)) { serviceUpdated = true;
boolean sameName(DNSRecord other) { return this.getName().equalsIgnoreCase(other.getName()); }
case TYPE_A: // IPv4 if (rec.getName().equalsIgnoreCase(this.getServer())) { _ipv4Addresses.add((Inet4Address) ((DNSRecord.Address) rec).getAddress()); serviceUpdated = true; case TYPE_AAAA: // IPv6 if (rec.getName().equalsIgnoreCase(this.getServer())) { _ipv6Addresses.add((Inet6Address) ((DNSRecord.Address) rec).getAddress()); serviceUpdated = true;
case TYPE_A: // IPv4 if (rec.getName().equalsIgnoreCase(this.getServer())) { _ipv4Addresses.add((Inet4Address) ((DNSRecord.Address) rec).getAddress()); serviceUpdated = true; case TYPE_AAAA: // IPv6 if (rec.getName().equalsIgnoreCase(this.getServer())) { _ipv6Addresses.add((Inet6Address) ((DNSRecord.Address) rec).getAddress()); serviceUpdated = true;
case TYPE_A: // IPv4 if (rec.getName().equalsIgnoreCase(this.getServer())) { _ipv4Addresses.add((Inet4Address) ((DNSRecord.Address) rec).getAddress()); serviceUpdated = true; case TYPE_AAAA: // IPv6 if (rec.getName().equalsIgnoreCase(this.getServer())) { _ipv6Addresses.add((Inet6Address) ((DNSRecord.Address) rec).getAddress()); serviceUpdated = true;
final Inet4Address inet4Address = (Inet4Address) address.getAddress(); final Inet6Address inet6Address = (Inet6Address) address.getAddress();
boolean handleQuery(JmDNSImpl dns, long expirationTime) { if (dns.getLocalHost().conflictWithRecord(this)) { DNSRecord.Address localAddress = dns.getLocalHost().getDNSAddressRecord(this.getRecordType(), this.isUnique(), DNSConstants.DNS_TTL); int comparison = this.compareTo(localAddress);
boolean handleQuery(JmDNSImpl dns, long expirationTime) { if (dns.getLocalHost().conflictWithRecord(this)) { DNSRecord.Address localAddress = dns.getLocalHost().getDNSAddressRecord(this.getRecordType(), this.isUnique(), DNSConstants.DNS_TTL); if (localAddress != null) { int comparison = this.compareTo(localAddress);
boolean handleQuery(JmDNSImpl dns, long expirationTime) { if (dns.getLocalHost().conflictWithRecord(this)) { DNSRecord.Address localAddress = dns.getLocalHost().getDNSAddressRecord(this.getRecordType(), this.isUnique(), DNSConstants.DNS_TTL); int comparison = this.compareTo(localAddress);
/** * Does the necessary actions, when this as a query. */ @Override boolean handleQuery(JmDNSImpl dns, long expirationTime) { DNSRecord.Address dnsAddress = dns.getLocalHost().getDNSAddressRecord(this.getRecordType(), this.isUnique(), DNSConstants.DNS_TTL); if (dnsAddress != null) { if (dnsAddress.sameType(this) && dnsAddress.sameName(this) && (!dnsAddress.sameValue(this))) { logger1.finer("handleQuery() Conflicting probe detected. lex compare " + compareTo(dnsAddress)); // Tie-breaker test if (dns.isProbing() && compareTo(dnsAddress) >= 0) { // We lost the tie-break. We have to choose a different name. dns.getLocalHost().incrementHostName(); dns.getCache().clear(); for (ServiceInfo serviceInfo : dns.getServices().values()) { ServiceInfoImpl info = (ServiceInfoImpl) serviceInfo; info.revertState(); } } dns.revertState(); return true; } } return false; }
/** * Does the necessary actions, when this as a response. */ @Override boolean handleResponse(JmDNSImpl dns) { DNSRecord.Address dnsAddress = dns.getLocalHost().getDNSAddressRecord(this.getRecordType(), this.isUnique(), DNSConstants.DNS_TTL); if (dnsAddress != null) { if (dnsAddress.sameType(this) && dnsAddress.sameName(this) && (!dnsAddress.sameValue(this))) { logger1.finer("handleResponse() Denial detected"); if (dns.isProbing()) { dns.getLocalHost().incrementHostName(); dns.getCache().clear(); for (ServiceInfo serviceInfo : dns.getServices().values()) { ServiceInfoImpl info = (ServiceInfoImpl) serviceInfo; info.revertState(); } } dns.revertState(); return true; } } return false; }
@Override boolean sameValue(DNSRecord other) { try { if (!(other instanceof Address)) { return false; } Address address = (Address) other; if ((this.getAddress() == null) && (address.getAddress() != null)) { return false; } return this.getAddress().equals(address.getAddress()); } catch (Exception e) { logger1.info("Failed to compare addresses of DNSRecords", e); return false; } }
boolean sameName(DNSRecord other) { return this.getName().equalsIgnoreCase(other.getName()); }
boolean sameName(DNSRecord other) { return this.getName().equalsIgnoreCase(other.getName()); }
/** * Creates a byte array representation of this record. This is needed for tie-break tests according to draft-cheshire-dnsext-multicastdns-04.txt chapter 9.2. */ @Override protected void toByteArray(DataOutputStream dout) throws IOException { super.toByteArray(dout); byte[] buffer = this.getAddress().getAddress(); for (int i = 0; i < buffer.length; i++) { dout.writeByte(buffer[i]); } }
@Override boolean sameValue(DNSRecord other) { return this.getAddress().equals(((Address) other).getAddress()); }
@Override public ServiceEvent getServiceEvent(JmDNSImpl dns) { ServiceInfo info = this.getServiceInfo(false); ((ServiceInfoImpl) info).setDns(dns); return new ServiceEventImpl(dns, info.getType(), info.getName(), info); }
@Override protected void toString(StringBuilder aLog) { super.toString(aLog); aLog.append(" address: '" + (this.getAddress() != null ? this.getAddress().getHostAddress() : "null") + "'"); }