コード例 #1
0
ファイル: Zone.java プロジェクト: tylerhyperHD/openintents
  private void fromXFR(ZoneTransferIn xfrin) throws IOException, ZoneTransferException {
    data = new HashMap();
    type = SECONDARY;

    if (!xfrin.isAXFR())
      throw new IllegalArgumentException("zones can only be " + "created from AXFRs");
    origin = xfrin.getName();
    List records = xfrin.run();
    for (Iterator it = records.iterator(); it.hasNext(); ) {
      Record record = (Record) it.next();
      maybeAddRecord(record);
    }
    validate();
  }
コード例 #2
0
 private Message sendAXFR(Message query) throws IOException {
   Name qname = query.getQuestion().getName();
   ZoneTransferIn xfrin = ZoneTransferIn.newAXFR(qname, address, tsig);
   xfrin.setTimeout((int) (getTimeout() / 1000));
   xfrin.setLocalAddress(localAddress);
   try {
     xfrin.run();
   } catch (ZoneTransferException e) {
     throw new WireParseException(e.getMessage());
   }
   List records = xfrin.getAXFR();
   Message response = new Message(query.getHeader().getID());
   response.getHeader().setFlag(Flags.AA);
   response.getHeader().setFlag(Flags.QR);
   response.addRecord(query.getQuestion(), Section.QUESTION);
   Iterator it = records.iterator();
   while (it.hasNext()) response.addRecord((Record) it.next(), Section.ANSWER);
   return response;
 }
コード例 #3
0
ファイル: Zone.java プロジェクト: tylerhyperHD/openintents
 /**
  * Creates a Zone by performing a zone transfer to the specified host.
  *
  * @see ZoneTransferIn
  */
 public Zone(Name zone, int dclass, String remote) throws IOException, ZoneTransferException {
   ZoneTransferIn xfrin = ZoneTransferIn.newAXFR(zone, remote, null);
   xfrin.setDClass(dclass);
   fromXFR(xfrin);
 }