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

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

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

Message.<init>介绍

暂无

代码示例

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

Message dnsMsg;
try {
  dnsMsg = new Message(dnsRawData);
} catch (IOException e) {
  Log.i(TAG, "handleDnsRequest: Discarding non-DNS or invalid packet", e);

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

private Message
parseMessage(byte [] b) throws WireParseException {
  try {
    return new Message(b);
  }
  catch (IOException e) {
    if (e instanceof WireParseException)
      throw (WireParseException) e;
    throw new WireParseException("Error parsing message");
  }
}

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

private Message
parseMessage(byte [] b) throws WireParseException {
  try {
    return new Message(b);
  }
  catch (IOException e) {
    if (e instanceof WireParseException)
      throw (WireParseException) e;
    throw new WireParseException("Error parsing message");
  }
}

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

private Message
parseMessage(byte [] b) throws WireParseException {
  try {
    return new Message(b);
  }
  catch (IOException e) {
    if (e instanceof WireParseException)
      throw (WireParseException) e;
    throw new WireParseException("Error parsing message");
  }
}

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

private Message
parseMessage(byte [] b) throws WireParseException {
  try {
    return new Message(b);
  }
  catch (IOException e) {
    if (e instanceof WireParseException)
      throw (WireParseException) e;
    throw new WireParseException("Error parsing message");
  }
}

代码示例来源:origin: kg.apc/jmeter-plugins-extras-libs

@Override
  public byte[] decode(byte[] buf) {
    Message m;
    try {
      m = new Message(buf);
    } catch (IOException ex) {
      throw new RuntimeException("Cannot decode DNS message: "+JOrphanUtils.baToHexString(buf), ex);
    }
    return m.toString().getBytes();
  }
}

代码示例来源:origin: undera/jmeter-plugins

@Override
  public byte[] decode(byte[] buf) {
    Message m;
    try {
      m = new Message(buf);
    } catch (IOException ex) {
      throw new RuntimeException("Cannot decode DNS message: " + JOrphanUtils.baToHexString(buf), ex);
    }
    return m.toString().getBytes();
  }
}

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

private Message
parseMessage(byte [] b) throws WireParseException {
  try {
    return (new Message(b));
  }
  catch (IOException e) {
    if (Options.check("verbose"))
      e.printStackTrace();
    if (!(e instanceof WireParseException))
      e = new WireParseException("Error parsing message");
    throw (WireParseException) e;
  }
}

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

private Message
parseMessage(byte [] b) throws WireParseException {
  try {
    return (new Message(b));
  }
  catch (IOException e) {
    if (Options.check("verbose"))
      e.printStackTrace();
    if (!(e instanceof WireParseException))
      e = new WireParseException("Error parsing message");
    throw (WireParseException) e;
  }
}

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

public Message
newMessage() {
  Message msg = new Message();
  msg.getHeader().setOpcode(Opcode.UPDATE);
  return msg;
}

代码示例来源:origin: org.littleshoot/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;
}

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

/**
 * 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;
}

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

/**
 * 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;
}

代码示例来源: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

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.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

assertTrue(mockEventLoop.lastResponse.getPayload() instanceof UdpPacket);
Message responseMsg = new Message(mockEventLoop.lastResponse.getPayload().getPayload().getRawData());
assertEquals(NOERROR, responseMsg.getHeader().getRcode());
assertArrayEquals(new Record[] {}, responseMsg.getSectionArray(Section.ANSWER));

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

assertTrue(mockEventLoop.lastResponse.getPayload() instanceof UdpPacket);
Message responseMsg = new Message(mockEventLoop.lastResponse.getPayload().getPayload().getRawData());
assertEquals(NOERROR, responseMsg.getHeader().getRcode());
assertArrayEquals(new Record[] {}, responseMsg.getSectionArray(Section.ANSWER));

相关文章