Package org.xbill.DNS

Examples of org.xbill.DNS.RRset


  private final void addSOA(Message response, Zone zone) {
    response.addRecord(zone.getSOA(), Section.AUTHORITY);
  }

  private final void addNS(Message response, Zone zone, int flags) {
    RRset nsRecords = zone.getNS();
    addRRset(nsRecords.getName(), response, nsRecords, Section.AUTHORITY, flags);
  }
View Full Code Here


    RRset nsRecords = zone.getNS();
    addRRset(nsRecords.getName(), response, nsRecords, Section.AUTHORITY, flags);
  }

  private void addGlue(Message response, Name name, int flags) {
    RRset a = findExactMatch(name, Type.A, DClass.IN, true);
    if (a == null) {
      return;
    }
    addRRset(name, response, a, Section.ADDITIONAL, flags);
  }
View Full Code Here

          if (iterations == 0) {
            response.getHeader().setFlag(Flags.AA);
          }
        }
      } else if (sr.isDelegation()) {
        RRset nsRecords = sr.getNS();
        addRRset(nsRecords.getName(), response, nsRecords, Section.AUTHORITY, flags);
      } else if (sr.isCNAME()) {
        CNAMERecord cname = sr.getCNAME();
        RRset rrset = new RRset(cname);
        addRRset(name, response, rrset, Section.ANSWER, flags);
        if (zone != null && iterations == 0) {
          response.getHeader().setFlag(Flags.AA);
        }
        rcode = addAnswer(response, cname.getTarget(), type, dclass, iterations + 1, flags);
      } else if (sr.isDNAME()) {
        DNAMERecord dname = sr.getDNAME();
        RRset rrset = new RRset(dname);
        addRRset(name, response, rrset, Section.ANSWER, flags);
        Name newname;
        try {
          newname = name.fromDNAME(dname);
        } catch (NameTooLongException e) {
          return Rcode.YXDOMAIN;
        }
        rrset = new RRset(new CNAMERecord(name, dclass, 0, newname));
        addRRset(name, response, rrset, Section.ANSWER, flags);
        if (zone != null && iterations == 0) {
          response.getHeader().setFlag(Flags.AA);
        }
        rcode = addAnswer(response, newname, type, dclass, iterations + 1, flags);
View Full Code Here

    try {
      DataOutputStream dataOut;
      dataOut = new DataOutputStream(s.getOutputStream());
      int id = query.getHeader().getID();
      while (it.hasNext()) {
        RRset rrset = (RRset) it.next();
        Message response = new Message(id);
        Header header = response.getHeader();
        header.setFlag(Flags.QR);
        header.setFlag(Flags.AA);
        addRRset(rrset.getName(), response, rrset, Section.ANSWER, FLAG_DNSSECOK);
        if (tsig != null) {
          tsig.applyStream(response, qtsig, first);
          qtsig = response.getTSIG();
        }
        first = false;
View Full Code Here

      Iterator<?> iterator = zone.iterator();

      while(iterator.hasNext()){

        RRset rRset = (RRset) iterator.next();

        Iterator<?> rrSetIterator = rRset.rrs();

        while(rrSetIterator.hasNext()){

          Record record = (Record) rrSetIterator.next();
View Full Code Here

                response.getHeader().setFlag(Flags.AA);

            rcode = Rcode.NXDOMAIN;

        } else if (sr.isDelegation()) {
            RRset nsRecords = sr.getNS();
            addRRset(nsRecords.getName(), response, nsRecords,
                    Section.AUTHORITY, flags);
        } else if (sr.isCNAME()) {
            CNAMERecord cname = sr.getCNAME();
            RRset rrset = new RRset(cname);
            addRRset(name, response, rrset, Section.ANSWER, flags);
            if (iterations == 0)
                response.getHeader().setFlag(Flags.AA);
            rcode = addAnswer(response, cname.getTarget(), type, dclass,
                    iterations + 1, flags);
        } else if (sr.isDNAME()) {
            DNAMERecord dname = sr.getDNAME();
            RRset rrset = new RRset(dname);
            addRRset(name, response, rrset, Section.ANSWER, flags);
            Name newname;
            try {
                newname = name.fromDNAME(dname);
            } catch (NameTooLongException e) {
                return Rcode.YXDOMAIN;
            }
            rrset = new RRset(new CNAMERecord(name, dclass, 0, newname));
            addRRset(name, response, rrset, Section.ANSWER, flags);
            if (iterations == 0)
                response.getHeader().setFlag(Flags.AA);
            rcode = addAnswer(response, newname, type, dclass, iterations + 1,
                    flags);
        } else if (sr.isSuccessful()) {
            RRset[] rrsets = sr.answers();
            for (int i = 0; i < rrsets.length; i++)
                addRRset(name, response, rrsets[i], Section.ANSWER, flags);

            RRset findNSRecords = findNSRecords();
            addRRset(findNSRecords.getName(), response, findNSRecords,
                    Section.AUTHORITY, flags);

            if (iterations == 0)
                response.getHeader().setFlag(Flags.AA);
        }
View Full Code Here

            }
        }
    }

    private void addGlue(Message response, Name name, int flags) {
        RRset a = findARecord(name);
        if (a == null)
            return;
        addRRset(name, response, a, Section.ADDITIONAL, flags);
    }
View Full Code Here

    ARecord m_a1, m_a2;
    SIGRecord m_s1, m_s2;

    public void setUp() throws TextParseException, UnknownHostException
    {
  m_rs = new RRset();
  m_name = Name.fromString("this.is.a.test.");
  m_name2 = Name.fromString("this.is.another.test.");
  m_ttl = 0xABCDL;
  m_a1 = new ARecord(m_name, DClass.IN, m_ttl,
         InetAddress.getByName("192.169.232.11"));
View Full Code Here

  m_rs.addRR(m_a1);
  m_rs.addRR(m_a2);
  m_rs.addRR(m_s1);
  m_rs.addRR(m_s2);

  RRset rs2 = new RRset( m_rs );

  assertEquals(2, rs2.size());
  assertEquals(m_a1, rs2.first());
  Iterator itr = rs2.rrs();
  assertEquals(m_a1, itr.next());
  assertEquals(m_a2, itr.next());
  assertFalse(itr.hasNext());
 
  itr = rs2.sigs();
  assertTrue(itr.hasNext());
  assertEquals(m_s1, itr.next());
  assertTrue(itr.hasNext());
  assertEquals(m_s2, itr.next());
  assertFalse(itr.hasNext());
View Full Code Here

            }
        }
    }

    private void addGlue(Message response, Name name, int flags) {
        RRset a = findARecord(name);
        if (a == null)
            return;
        addRRset(name, response, a, Section.ADDITIONAL, flags);
    }
View Full Code Here

TOP

Related Classes of org.xbill.DNS.RRset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.