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

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

本文整理了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

  1. /**
  2. * Converts a Message object to a raw DNS wire format byte array.
  3. * @param msg The message to convert.
  4. * @return A byte array representing the raw DNS wire format of the message.
  5. */
  6. protected byte[] toBytes(Message msg)
  7. {
  8. return msg.toWire();
  9. }
  10. }

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

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

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

  1. /**
  2. * Generates a TSIG record with a specific error for a message and adds it
  3. * to the message.
  4. * @param m The message
  5. * @param error The error
  6. * @param old If this message is a response, the TSIG from the request
  7. */
  8. public void
  9. apply(Message m, int error, TSIGRecord old) {
  10. Record r = generate(m, m.toWire(), error, old);
  11. m.addRecord(r, Section.ADDITIONAL);
  12. m.tsigState = Message.TSIG_SIGNED;
  13. }

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

  1. /**
  2. * Generates a TSIG record with a specific error for a message and adds it
  3. * to the message.
  4. * @param m The message
  5. * @param error The error
  6. * @param old If this message is a response, the TSIG from the request
  7. */
  8. public void
  9. apply(Message m, int error, TSIGRecord old) {
  10. Record r = generate(m, m.toWire(), error, old);
  11. m.addRecord(r, Section.ADDITIONAL);
  12. m.tsigState = Message.TSIG_SIGNED;
  13. }

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

  1. /**
  2. * Generates a TSIG record with a specific error for a message and adds it
  3. * to the message.
  4. * @param m The message
  5. * @param error The error
  6. * @param old If this message is a response, the TSIG from the request
  7. */
  8. public void
  9. apply(Message m, int error, TSIGRecord old) {
  10. Record r = generate(m, m.toWire(), error, old);
  11. m.addRecord(r, Section.ADDITIONAL);
  12. m.tsigState = Message.TSIG_SIGNED;
  13. }

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

  1. /**
  2. * Generates a TSIG record with a specific error for a message and adds it
  3. * to the message.
  4. * @param m The message
  5. * @param error The error
  6. * @param old If this message is a response, the TSIG from the request
  7. */
  8. public void
  9. apply(Message m, int error, TSIGRecord old) {
  10. Record r = generate(m, m.toWire(), error, old);
  11. m.addRecord(r, Section.ADDITIONAL);
  12. m.tsigState = Message.TSIG_SIGNED;
  13. }

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

  1. /**
  2. * Returns an array containing the wire format representation of the Message.
  3. */
  4. public byte []
  5. toWire() {
  6. DNSOutput out = new DNSOutput();
  7. toWire(out);
  8. size = out.current();
  9. return out.toByteArray();
  10. }

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

  1. /**
  2. * Returns an array containing the wire format representation of the Message.
  3. */
  4. public byte []
  5. toWire() {
  6. DNSOutput out = new DNSOutput();
  7. toWire(out);
  8. size = out.current();
  9. return out.toByteArray();
  10. }

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

  1. /**
  2. * Returns an array containing the wire format representation of the Message.
  3. */
  4. public byte []
  5. toWire() {
  6. DNSOutput out = new DNSOutput();
  7. toWire(out);
  8. size = out.current();
  9. return out.toByteArray();
  10. }

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

  1. /**
  2. * Returns an array containing the wire format representation of the Message.
  3. */
  4. public byte []
  5. toWire() {
  6. DNSOutput out = new DNSOutput();
  7. toWire(out);
  8. size = out.current();
  9. return out.toByteArray();
  10. }

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

  1. .payloadBuilder(
  2. new UnknownPacket.Builder()
  3. .rawData(message.toWire())
  4. );

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

  1. @Test
  2. public void testNoQueryDnsQuery() throws Exception {
  3. Message message = new Message();
  4. UdpPacket.Builder payLoadBuilder = new UdpPacket.Builder()
  5. .srcPort(UdpPort.DOMAIN)
  6. .dstPort(UdpPort.DOMAIN)
  7. .srcAddr(InetAddress.getByAddress(new byte[]{8, 8, 4, 4}))
  8. .dstAddr(InetAddress.getByAddress(new byte[]{8, 8, 8, 8}))
  9. .correctChecksumAtBuild(true)
  10. .correctLengthAtBuild(true)
  11. .payloadBuilder(
  12. new UnknownPacket.Builder()
  13. .rawData(message.toWire())
  14. );
  15. IpPacket ipOutPacket = new IpV4Packet.Builder()
  16. .version(IpVersion.IPV4)
  17. .tos(IpV4Rfc791Tos.newInstance((byte) 0))
  18. .protocol(IpNumber.UDP)
  19. .srcAddr((Inet4Address) Inet4Address.getByAddress(new byte[]{8, 8, 4, 4}))
  20. .dstAddr((Inet4Address) Inet4Address.getByAddress(new byte[]{8, 8, 8, 8}))
  21. .correctChecksumAtBuild(true)
  22. .correctLengthAtBuild(true)
  23. .payloadBuilder(payLoadBuilder)
  24. .build();
  25. dnsPacketProxy.handleDnsRequest(ipOutPacket.getRawData());
  26. assertNull(mockEventLoop.lastResponse);
  27. assertNull(mockEventLoop.lastOutgoing);
  28. dnsPacketProxy.handleDnsRequest(ipOutPacket.getRawData());
  29. }

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

  1. byte[] buildErrorMessage(final Header header, final int rcode, final Record question) {
  2. final Message response = new Message();
  3. response.setHeader(header);
  4. for (int i = 0; i < 4; i++)
  5. response.removeAllRecords(i);
  6. if (rcode == Rcode.SERVFAIL)
  7. response.addRecord(question, Section.QUESTION);
  8. header.setRcode(rcode);
  9. return response.toWire();
  10. }

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

  1. /**
  2. * Creates a byte array containing the concatenation of the fields of the
  3. * SIG(0) record and the message to be signed. This does not perform
  4. * a cryptographic digest.
  5. * @param sig The SIG record used to sign the rrset.
  6. * @param msg The message to be signed.
  7. * @param previous If this is a response, the signature from the query.
  8. * @return The data to be cryptographically signed.
  9. */
  10. public static byte []
  11. digestMessage(SIGRecord sig, Message msg, byte [] previous) {
  12. DNSOutput out = new DNSOutput();
  13. digestSIG(out, sig);
  14. if (previous != null)
  15. out.writeByteArray(previous);
  16. msg.toWire(out);
  17. return out.toByteArray();
  18. }

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

  1. byte []
  2. buildErrorMessage(Header header, int rcode, Record question) {
  3. Message response = new Message();
  4. response.setHeader(header);
  5. for (int i = 0; i < 4; i++)
  6. response.removeAllRecords(i);
  7. if (rcode == Rcode.SERVFAIL)
  8. response.addRecord(question, Section.QUESTION);
  9. header.setRcode(rcode);
  10. return response.toWire();
  11. }

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

  1. private byte[] buildErrorMessage(Header header, int rcode, Record question) {
  2. Message response = new Message();
  3. response.setHeader(header);
  4. for (int i = 0; i < 4; i++) {
  5. response.removeAllRecords(i);
  6. }
  7. if (rcode == Rcode.SERVFAIL) {
  8. response.addRecord(question, Section.QUESTION);
  9. }
  10. header.setRcode(rcode);
  11. return response.toWire();
  12. }

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

  1. /**
  2. * Creates a byte array containing the concatenation of the fields of the
  3. * SIG(0) record and the message to be signed. This does not perform
  4. * a cryptographic digest.
  5. * @param sig The SIG record used to sign the rrset.
  6. * @param msg The message to be signed.
  7. * @param previous If this is a response, the signature from the query.
  8. * @return The data to be cryptographically signed.
  9. */
  10. public static byte []
  11. digestMessage(SIGRecord sig, Message msg, byte [] previous) {
  12. DNSOutput out = new DNSOutput();
  13. digestSIG(out, sig);
  14. if (previous != null)
  15. out.writeByteArray(previous);
  16. msg.toWire(out);
  17. return out.toByteArray();
  18. }

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

  1. byte[] buildErrorMessage(Header header, int rcode, Record question) {
  2. final Message response = new Message();
  3. response.setHeader(header);
  4. for (int i = 0; i < 4; i++) {
  5. response.removeAllRecords(i);
  6. }
  7. if (rcode == Rcode.SERVFAIL) {
  8. response.addRecord(question, Section.QUESTION);
  9. }
  10. header.setRcode(rcode);
  11. return response.toWire();
  12. }

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

  1. .payloadBuilder(
  2. new UnknownPacket.Builder()
  3. .rawData(message.toWire())
  4. );

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

  1. .payloadBuilder(
  2. new UnknownPacket.Builder()
  3. .rawData(message.toWire())
  4. );

相关文章