org.xbill.DNS.Message.toWire()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中org.xbill.DNS.Message.toWire()方法的一些代码示例,展示了Message.toWire()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.toWire()方法的具体详情如下:
包路径:org.xbill.DNS.Message
类名称:Message
方法名:toWire

Message.toWire介绍

暂无

代码示例

代码示例来源:origin: org.nhind/dns

/**
   * Converts a Message object to a raw DNS wire format byte array.
   * @param msg The message to convert.
   * @return A byte array representing the raw DNS wire format of the message.
   */
  protected byte[] toBytes(Message msg)
  {
    return msg.toWire();
  }
}

代码示例来源:origin: julian-klode/dns66

dnsMsg.getHeader().setRcode(Rcode.NOERROR);
dnsMsg.addRecord(NEGATIVE_CACHE_SOA_RECORD, Section.AUTHORITY);
handleDnsResponse(parsedPacket, dnsMsg.toWire());

代码示例来源:origin: org.littleshoot/dnsjava

/**
 * Generates a TSIG record with a specific error for a message and adds it
 * to the message.
 * @param m The message
 * @param error The error
 * @param old If this message is a response, the TSIG from the request
 */
public void
apply(Message m, int error, TSIGRecord old) {
  Record r = generate(m, m.toWire(), error, old);
  m.addRecord(r, Section.ADDITIONAL);
  m.tsigState = Message.TSIG_SIGNED;
}

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

/**
 * Generates a TSIG record with a specific error for a message and adds it
 * to the message.
 * @param m The message
 * @param error The error
 * @param old If this message is a response, the TSIG from the request
 */
public void
apply(Message m, int error, TSIGRecord old) {
  Record r = generate(m, m.toWire(), error, old);
  m.addRecord(r, Section.ADDITIONAL);
  m.tsigState = Message.TSIG_SIGNED;
}

代码示例来源:origin: tiandawu/IotXmpp

/**
 * Generates a TSIG record with a specific error for a message and adds it
 * to the message.
 * @param m The message
 * @param error The error
 * @param old If this message is a response, the TSIG from the request
 */
public void
apply(Message m, int error, TSIGRecord old) {
  Record r = generate(m, m.toWire(), error, old);
  m.addRecord(r, Section.ADDITIONAL);
  m.tsigState = Message.TSIG_SIGNED;
}

代码示例来源:origin: dnsjava/dnsjava

/**
 * Generates a TSIG record with a specific error for a message and adds it
 * to the message.
 * @param m The message
 * @param error The error
 * @param old If this message is a response, the TSIG from the request
 */
public void
apply(Message m, int error, TSIGRecord old) {
  Record r = generate(m, m.toWire(), error, old);
  m.addRecord(r, Section.ADDITIONAL);
  m.tsigState = Message.TSIG_SIGNED;
}

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

/**
 * Returns an array containing the wire format representation of the Message.
 */
public byte []
toWire() {
  DNSOutput out = new DNSOutput();
  toWire(out);
  size = out.current();
  return out.toByteArray();
}

代码示例来源:origin: org.littleshoot/dnsjava

/**
 * Returns an array containing the wire format representation of the Message.
 */
public byte []
toWire() {
  DNSOutput out = new DNSOutput();
  toWire(out);
  size = out.current();
  return out.toByteArray();
}

代码示例来源:origin: dnsjava/dnsjava

/**
 * Returns an array containing the wire format representation of the Message.
 */
public byte []
toWire() {
  DNSOutput out = new DNSOutput();
  toWire(out);
  size = out.current();
  return out.toByteArray();
}

代码示例来源:origin: tiandawu/IotXmpp

/**
 * Returns an array containing the wire format representation of the Message.
 */
public byte []
toWire() {
  DNSOutput out = new DNSOutput();
  toWire(out);
  size = out.current();
  return out.toByteArray();
}

代码示例来源:origin: julian-klode/dns66

.payloadBuilder(
    new UnknownPacket.Builder()
        .rawData(message.toWire())
);

代码示例来源:origin: julian-klode/dns66

@Test
public void testNoQueryDnsQuery() throws Exception {
  Message message = new Message();
  UdpPacket.Builder payLoadBuilder = new UdpPacket.Builder()
      .srcPort(UdpPort.DOMAIN)
      .dstPort(UdpPort.DOMAIN)
      .srcAddr(InetAddress.getByAddress(new byte[]{8, 8, 4, 4}))
      .dstAddr(InetAddress.getByAddress(new byte[]{8, 8, 8, 8}))
      .correctChecksumAtBuild(true)
      .correctLengthAtBuild(true)
      .payloadBuilder(
          new UnknownPacket.Builder()
              .rawData(message.toWire())
      );
  IpPacket ipOutPacket = new IpV4Packet.Builder()
      .version(IpVersion.IPV4)
      .tos(IpV4Rfc791Tos.newInstance((byte) 0))
      .protocol(IpNumber.UDP)
      .srcAddr((Inet4Address) Inet4Address.getByAddress(new byte[]{8, 8, 4, 4}))
      .dstAddr((Inet4Address) Inet4Address.getByAddress(new byte[]{8, 8, 8, 8}))
      .correctChecksumAtBuild(true)
      .correctLengthAtBuild(true)
      .payloadBuilder(payLoadBuilder)
      .build();
  dnsPacketProxy.handleDnsRequest(ipOutPacket.getRawData());
  assertNull(mockEventLoop.lastResponse);
  assertNull(mockEventLoop.lastOutgoing);
  dnsPacketProxy.handleDnsRequest(ipOutPacket.getRawData());
}

代码示例来源:origin: OpenNMS/opennms

byte[] buildErrorMessage(final Header header, final int rcode, final Record question) {
  final Message response = new Message();
  response.setHeader(header);
  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();
}

代码示例来源:origin: dnsjava/dnsjava

/**
 * Creates a byte array containing the concatenation of the fields of the
 * SIG(0) record and the message to be signed.  This does not perform
 * a cryptographic digest.
 * @param sig The SIG record used to sign the rrset.
 * @param msg The message to be signed.
 * @param previous If this is a response, the signature from the query.
 * @return The data to be cryptographically signed.
 */
public static byte []
digestMessage(SIGRecord sig, Message msg, byte [] previous) {
  DNSOutput out = new DNSOutput();
  digestSIG(out, sig);

  if (previous != null)
    out.writeByteArray(previous);

  msg.toWire(out);
  return out.toByteArray();
}

代码示例来源:origin: dnsjava/dnsjava

byte []
buildErrorMessage(Header header, int rcode, Record question) {
  Message response = new Message();
  response.setHeader(header);
  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();
}

代码示例来源:origin: org.jboss.resteasy/resteasy-eagledns-fork

private byte[] buildErrorMessage(Header header, int rcode, Record question) {
  Message response = new Message();
  response.setHeader(header);
  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();
}

代码示例来源:origin: org.littleshoot/dnsjava

/**
 * Creates a byte array containing the concatenation of the fields of the
 * SIG(0) record and the message to be signed.  This does not perform
 * a cryptographic digest.
 * @param sig The SIG record used to sign the rrset.
 * @param msg The message to be signed.
 * @param previous If this is a response, the signature from the query.
 * @return The data to be cryptographically signed.
 */
public static byte []
digestMessage(SIGRecord sig, Message msg, byte [] previous) {
  DNSOutput out = new DNSOutput();
  digestSIG(out, sig);

  if (previous != null)
    out.writeByteArray(previous);
  
  msg.toWire(out);
  return out.toByteArray();
}

代码示例来源:origin: org.echocat.jomon.net/common

byte[] buildErrorMessage(Header header, int rcode, Record question) {
  final Message response = new Message();
  response.setHeader(header);
  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();
}

代码示例来源:origin: julian-klode/dns66

.payloadBuilder(
    new UnknownPacket.Builder()
        .rawData(message.toWire())
);

代码示例来源:origin: julian-klode/dns66

.payloadBuilder(
    new UnknownPacket.Builder()
        .rawData(message.toWire())
);

相关文章