예제 #1
0
파일: Message.java 프로젝트: lemmy/dnsjava
 /**
  * Creates a new Message with a random Message ID suitable for sending as a query.
  *
  * @param r A record containing the question
  */
 public static Message newQuery(Record r) {
   Message m = new Message();
   m.header.setOpcode(Opcode.QUERY);
   m.header.setFlag(Flags.RD);
   m.addRecord(r, Section.QUESTION);
   return m;
 }
예제 #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
 private void applyEDNS(Message query) {
   if (queryOPT == null || query.getOPT() != null) return;
   query.addRecord(queryOPT, Section.ADDITIONAL);
 }