Examples of toWire()


Examples of org.xbill.DNS.Message.toWire()

        DatagramChannel channel2 = TestUtils.getDatagramChannel(conf2.getPort());

        // Ask 2 for A rec
        Message query =  Message.newQuery(
                Record.newRecord(new Name("foo.example.com."), Type.A, DClass.IN));
        channel2.write(ByteBuffer.wrap(query.toWire()));

        // Make sure only 2 replies
        latch.await(2, TimeUnit.SECONDS);

        Thread.sleep(100);
View Full Code Here

Examples of org.xbill.DNS.Message.toWire()

        server.start();

        Record rec = Record.newRecord(new Name("foo.example.com."), Type.A, DClass.IN);
        Message query = Message.newQuery(rec);

        byte[] qdata = query.toWire();
        DatagramPacket packet = new DatagramPacket(qdata, qdata.length, InetAddress.getLocalHost(), 5354);
        DatagramSocket socket = new DatagramSocket();
        socket.send(packet);
        socket.close();
View Full Code Here

Examples of org.xbill.DNS.Message.toWire()

        DatagramChannel channel = TestUtils.getDatagramChannel(conf.getPort());

        Message query =  Message.newQuery(
                Record.newRecord(new Name("foo.example.com."), Type.A, DClass.IN));
        channel.write(ByteBuffer.wrap(query.toWire()));

        Thread.sleep(10);

        ByteBuffer buf = ByteBuffer.allocate(100);
        channel.read(buf);
View Full Code Here

Examples of org.xbill.DNS.Message.toWire()

    @Test
    public void interpretUDPQuery() throws Exception {
        Record rec = Record.newRecord(Name.fromString("foo.example.com."), Type.A, DClass.IN);
        Message query = Message.newQuery(rec);

        byte[] qdata = query.toWire();
        DatagramPacket packet = new DatagramPacket(qdata, qdata.length,
                InetAddress.getLoopbackAddress(), 53);

        Query res = new UDPQuery(packet, null);
        res.interpret();
View Full Code Here

Examples of org.xbill.DNS.Message.toWire()

            OPTRecord opt = new OPTRecord((short) 4096, rcode, (byte) 0,
                    optflags);
            response.addRecord(opt, Section.ADDITIONAL);
        }

        return response.toWire(maxLength);
    }

    byte[] buildErrorMessage(Header header, int rcode, Record question) {
        Message response = new Message();
        response.setHeader(header);
View Full Code Here

Examples of org.xbill.DNS.Message.toWire()

        for (int i = 0; i < 4; i++)
            response.removeAllRecords(i);
        if (rcode == Rcode.SERVFAIL)
            response.addRecord(question, Section.QUESTION);
        header.setRcode(rcode);
        return response.toWire();
    }

    public byte[] formerrMessage(byte[] in) {
        Header header;
        try {
View Full Code Here

Examples of org.xbill.DNS.Message.toWire()

        } else if (checkConnectionTime == MessageCheckResult.CHANGEDE_BUT_USEFUL) {
          // remove unreachable address and save
          if (logger.isDebugEnabled()) {
            logger.debug("update record in cahce " + message);
          }
          cacheManager.setResponseToCache(query, answerInCache.toWire());
          return;
        }
      } catch (IOException e) {
      }
    }
View Full Code Here

Examples of org.xbill.DNS.Message.toWire()

      if (response != null) {
        responser.response(response);
      } else {
                Message query = new Message(
                        inDataPacket.getData());
                forwarder.forward(query.toWire(), query, responser);
      }
    } catch (Throwable e) {

      logger.warn(
          "Error processing UDP connection from "
View Full Code Here

Examples of org.xbill.DNS.Message.toWire()

        if (tsig != null) {
          tsig.applyStream(response, qtsig, first);
          qtsig = response.getTSIG();
        }
        first = false;
        byte[] out = response.toWire();
        dataOut.writeShort(out.length);
        dataOut.write(out);
      }
    } catch (IOException ex) {
      log.warn("AXFR failed", ex);
View Full Code Here

Examples of org.xbill.DNS.Message.toWire()

      OPTRecord opt = new OPTRecord((short) 4096, rcode, (byte) 0, optflags);
      response.addRecord(opt, Section.ADDITIONAL);
    }

    response.setTSIG(tsig, Rcode.NOERROR, queryTSIG);
    return response.toWire(maxLength);
  }

  private byte[] buildErrorMessage(Header header, int rcode, Record question) {
    Message response = new Message();
    response.setHeader(header);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.