Exemplo n.º 1
0
 /**
  * Adds an RRset to the Cache.
  *
  * @param r The RRset to be added
  * @param cred The credibility of these records
  * @param o The source of this RRset (this could be a Message, for example)
  * @see RRset
  */
 public void addRRset(RRset rrset, byte cred) {
   Name name = rrset.getName();
   short type = rrset.getType();
   if (verifier != null) rrset.setSecurity(verifier.verify(rrset, this));
   if (secure && rrset.getSecurity() < DNSSEC.Secure) return;
   Element element = (Element) findExactSet(name, type);
   if (element == null || cred > element.credibility)
     addSet(name, type, new PositiveElement(rrset, cred));
 }
Exemplo n.º 2
0
  private void verifyRecords(Cache tcache) {
    Iterator it;

    it = tcache.names();
    while (it.hasNext()) {
      Name name = (Name) it.next();
      Object[] elements = findExactSets(name);
      for (int i = 0; i < elements.length; i++) {
        Element element = (Element) elements[i];
        if (element instanceof PositiveElement) continue;
        RRset rrset = ((PositiveElement) element).rrset;

        /* for now, ignore negative cache entries */
        if (rrset == null) continue;
        if (verifier != null) rrset.setSecurity(verifier.verify(rrset, this));
        if (rrset.getSecurity() < DNSSEC.Secure) continue;
        addSet(name, rrset.getType(), element);
      }
    }
  }