public CacheRRset(Record rec, int cred, long maxttl) { super(); this.credibility = cred; this.expire = limitExpire(rec.getTTL(), maxttl); addRR(rec); }
public CacheRRset(Record rec, int cred, long maxttl) { super(); this.credibility = cred; this.expire = limitExpire(rec.getTTL(), maxttl); addRR(rec); }
/** Returns the ttl of the records */ public synchronized long getTTL() { return first().getTTL(); }
/** Returns the ttl of the records */ public synchronized long getTTL() { return first().getTTL(); }
/** Returns the ttl of the records */ public synchronized long getTTL() { return first().getTTL(); }
public CacheRRset(Record rec, int cred, long maxttl) { super(); this.credibility = cred; this.expire = limitExpire(rec.getTTL(), maxttl); addRR(rec); }
public CacheRRset(Record rec, int cred, long maxttl) { super(); this.credibility = cred; this.expire = limitExpire(rec.getTTL(), maxttl); addRR(rec); }
/** Returns the ttl of the records */ public synchronized long getTTL() { return first().getTTL(); }
/** Adds a Record to an RRset */ public synchronized void addRR(Record r) { if (rrs.size() == 0) { safeAddRR(r); return; } Record first = first(); if (!r.sameRRset(first)) throw new IllegalArgumentException("record does not match " + "rrset"); if (r.getTTL() != first.getTTL()) { if (r.getTTL() > first.getTTL()) { r = r.cloneRecord(); r.setTTL(first.getTTL()); } else { for (int i = 0; i < rrs.size(); i++) { Record tmp = (Record) rrs.get(i); tmp = tmp.cloneRecord(); tmp.setTTL(r.getTTL()); rrs.set(i, tmp); } } } if (!rrs.contains(r)) safeAddRR(r); }
/** Adds a Record to an RRset */ public synchronized void addRR(Record r) { if (rrs.size() == 0) { safeAddRR(r); return; } Record first = first(); if (!r.sameRRset(first)) throw new IllegalArgumentException("record does not match " + "rrset"); if (r.getTTL() != first.getTTL()) { if (r.getTTL() > first.getTTL()) { r = r.cloneRecord(); r.setTTL(first.getTTL()); } else { for (int i = 0; i < rrs.size(); i++) { Record tmp = (Record) rrs.get(i); tmp = tmp.cloneRecord(); tmp.setTTL(r.getTTL()); rrs.set(i, tmp); } } } if (!rrs.contains(r)) safeAddRR(r); }
/** Adds a Record to an RRset */ public synchronized void addRR(Record r) { if (rrs.size() == 0) { safeAddRR(r); return; } Record first = first(); if (!r.sameRRset(first)) throw new IllegalArgumentException("record does not match " + "rrset"); if (r.getTTL() != first.getTTL()) { if (r.getTTL() > first.getTTL()) { r = r.cloneRecord(); r.setTTL(first.getTTL()); } else { for (int i = 0; i < rrs.size(); i++) { Record tmp = (Record) rrs.get(i); tmp = tmp.cloneRecord(); tmp.setTTL(r.getTTL()); rrs.set(i, tmp); } } } if (!rrs.contains(r)) safeAddRR(r); }
/** Adds a Record to an RRset */ public synchronized void addRR(Record r) { if (rrs.size() == 0) { safeAddRR(r); return; } Record first = first(); if (!r.sameRRset(first)) throw new IllegalArgumentException("record does not match " + "rrset"); if (r.getTTL() != first.getTTL()) { if (r.getTTL() > first.getTTL()) { r = r.cloneRecord(); r.setTTL(first.getTTL()); } else { for (int i = 0; i < rrs.size(); i++) { Record tmp = (Record) rrs.get(i); tmp = tmp.cloneRecord(); tmp.setTTL(r.getTTL()); rrs.set(i, tmp); } } } if (!rrs.contains(r)) safeAddRR(r); }
public static String toString(Record record) { if (record == null) { return null; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(record.getName()); stringBuilder.append(" "); stringBuilder.append(record.getTTL()); stringBuilder.append(" "); stringBuilder.append(DClass.string(record.getDClass())); stringBuilder.append(" "); stringBuilder.append(Type.string(record.getType())); String rdata = record.rdataToString(); if (!rdata.equals("")) { stringBuilder.append(" "); stringBuilder.append(rdata); } return stringBuilder.toString(); }
public DBRecord(Record record, Name origin, long zoneTTL) { this.name = record.getName().relativize(origin).toString(); this.type = Type.string(record.getType()); this.dclass = DClass.string(record.getDClass()); this.content = record.rdataToString(); if(record.getTTL() == zoneTTL){ this.ttl = null; }else{ this.ttl = record.getTTL(); } }
public void receiveRecord(final Object id, final Record record) { if (record.getTTL() > 0) { if (record.getType() == Type.PTR) { String value = ((PTRRecord) record).getTarget().toString(); if (!value.endsWith(".")) { value += "."; } // Check if domain is already in the list, add if not, otherwise manipulate booleans. try { domains.add(new Domain(new Name(value))); } catch (TextParseException e) { e.printStackTrace(System.err); } } } } });
assertNotEquals(0, responseMsg.getSectionArray(Section.AUTHORITY).length); assertTrue(responseMsg.getSectionArray(Section.AUTHORITY)[0] instanceof SOARecord); assertTrue(responseMsg.getSectionArray(Section.AUTHORITY)[0].getTTL() > 0);
@Test public void testRecordTTL() throws Exception { ServiceRecord record = getMarshal().fromBytes("somepath", CONTAINER_RECORD.getBytes()); getRegistryDNS().register( "/registry/users/root/services/org-apache-slider/test1/components/" + "ctr-e50-1451931954322-0016-01-000002", record); // start assessing whether correct records are available Record[] recs = assertDNSQuery( "ctr-e50-1451931954322-0016-01-000002.dev.test."); assertEquals("wrong result", "172.17.0.19", ((ARecord) recs[0]).getAddress().getHostAddress()); assertEquals("wrong ttl", 30L, recs[0].getTTL()); recs = assertDNSQuery("httpd-1.test1.root.dev.test.", 1); assertTrue("not an ARecord", recs[0] instanceof ARecord); assertEquals("wrong ttl", 30L, recs[0].getTTL()); }
/** * Converts a raw wire transfer format of a record to a DNS record. * @param data The raw byte stream of a record in wire transfer format. * @return A DNSRecord converted from the wire format. * @throws IOException */ public static DNSRecord fromWire(byte[] data) throws IOException { Record rec = Record.fromWire(data, Section.ANSWER); DNSRecord retVal = new DNSRecord(); retVal.setDclass(rec.getDClass()); retVal.setName(rec.getName().toString()); retVal.setData(rec.rdataToWireCanonical()); retVal.setTtl(rec.getTTL()); retVal.setType(rec.getType()); return retVal; } }
/** * Converts a raw wire transfer format of a record to a DNS record. * @param data The raw byte stream of a record in wire transfer format. * @return A DNSRecord converted from the wire format. * @throws IOException */ public static DNSRecord fromWire(byte[] data) throws IOException { Record rec = Record.fromWire(data, Section.ANSWER); DNSRecord retVal = new DNSRecord(); retVal.setDclass(rec.getDClass()); retVal.setName(rec.getName().toString()); retVal.setData(rec.rdataToWireCanonical()); retVal.setTtl(rec.getTTL()); retVal.setType(rec.getType()); return retVal; } }
assertNotEquals(0, responseMsg.getSectionArray(Section.AUTHORITY).length); assertTrue(responseMsg.getSectionArray(Section.AUTHORITY)[0] instanceof SOARecord); assertTrue(responseMsg.getSectionArray(Section.AUTHORITY)[0].getTTL() > 0);