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

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

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

Message.getRcode介绍

暂无

代码示例

代码示例来源:origin: posicks/mdnsjava

switch (m.getRcode())

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

static void
doAXFR(Message response) throws IOException {
  System.out.println("; java dig 0.0 <> " + name + " axfr");
  if (response.isSigned()) {
    System.out.print(";; TSIG ");
    if (response.isVerified())
      System.out.println("ok");
    else
      System.out.println("failed");
  }

  if (response.getRcode() != Rcode.NOERROR) {
    System.out.println(response);
    return;
  }

  Record [] records = response.getSectionArray(Section.ANSWER);
  for (int i = 0; i < records.length; i++)
    System.out.println(records[i]);

  System.out.print(";; done (");
  System.out.print(response.getHeader().getCount(Section.ANSWER));
  System.out.print(" records, ");
  System.out.print(response.getHeader().getCount(Section.ADDITIONAL));
  System.out.println(" additional)");
}

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

/**
 * Converts the Message to a String.
 */
public String
toString() {
  StringBuffer sb = new StringBuffer();
  OPTRecord opt = getOPT();
  if (opt != null)
    sb.append(header.toStringWithRcode(getRcode()) + "\n");
  else
    sb.append(header + "\n");
  if (isSigned()) {
    sb.append(";; TSIG ");
    if (isVerified())
      sb.append("ok");
    else
      sb.append("invalid");
    sb.append('\n');
  }
  for (int i = 0; i < 4; i++) {
    if (header.getOpcode() != Opcode.UPDATE)
      sb.append(";; " + Section.longString(i) + ":\n");
    else
      sb.append(";; " + Section.updString(i) + ":\n");
    sb.append(sectionToString(i) + "\n");
  }
  sb.append(";; Message size: " + numBytes() + " bytes");
  return sb.toString();
}

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

/**
 * Converts the Message to a String.
 */
public String
toString() {
  StringBuffer sb = new StringBuffer();
  OPTRecord opt = getOPT();
  if (opt != null)
    sb.append(header.toStringWithRcode(getRcode()) + "\n");
  else
    sb.append(header + "\n");
  if (isSigned()) {
    sb.append(";; TSIG ");
    if (isVerified())
      sb.append("ok");
    else
      sb.append("invalid");
    sb.append('\n');
  }
  for (int i = 0; i < 4; i++) {
    if (header.getOpcode() != Opcode.UPDATE)
      sb.append(";; " + Section.longString(i) + ":\n");
    else
      sb.append(";; " + Section.updString(i) + ":\n");
    sb.append(sectionToString(i) + "\n");
  }
  sb.append(";; Message size: " + numBytes() + " bytes");
  return sb.toString();
}

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

/**
 * Converts the Message to a String.
 */
public String
toString() {
  StringBuffer sb = new StringBuffer();
  OPTRecord opt = getOPT();
  if (opt != null)
    sb.append(header.toStringWithRcode(getRcode()) + "\n");
  else
    sb.append(header + "\n");
  if (isSigned()) {
    sb.append(";; TSIG ");
    if (isVerified())
      sb.append("ok");
    else
      sb.append("invalid");
    sb.append('\n');
  }
  for (int i = 0; i < 4; i++) {
    if (header.getOpcode() != Opcode.UPDATE)
      sb.append(";; " + Section.longString(i) + ":\n");
    else
      sb.append(";; " + Section.updString(i) + ":\n");
    sb.append(sectionToString(i) + "\n");
  }
  sb.append(";; Message size: " + numBytes() + " bytes");
  return sb.toString();
}

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

/**
 * Converts the Message to a String.
 */
public String
toString() {
  StringBuffer sb = new StringBuffer();
  OPTRecord opt = getOPT();
  if (opt != null)
    sb.append(header.toStringWithRcode(getRcode()) + "\n");
  else
    sb.append(header + "\n");
  if (isSigned()) {
    sb.append(";; TSIG ");
    if (isVerified())
      sb.append("ok");
    else
      sb.append("invalid");
    sb.append('\n');
  }
  for (int i = 0; i < 4; i++) {
    if (header.getOpcode() != Opcode.UPDATE)
      sb.append(";; " + Section.longString(i) + ":\n");
    else
      sb.append(";; " + Section.updString(i) + ":\n");
    sb.append(sectionToString(i) + "\n");
  }
  sb.append(";; Message size: " + numBytes() + " bytes");
  return sb.toString();
}

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

if (response.getRcode() == Rcode.NOERROR || response.getRcode() == Rcode.NXDOMAIN)

代码示例来源:origin: posicks/mdnsjava

public void receiveMessage(final Object id, final Message message)
  int rcode = message.getRcode();
  int opcode = header.getOpcode();

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

if (response.getRcode() == Rcode.NOERROR || response.getRcode() == Rcode.NXDOMAIN)

代码示例来源:origin: posicks/mdnsjava

public void receiveMessage(final Object id, final Message message)
  int rcode = message.getRcode();
  Header header = message.getHeader();
  int opcode = header.getOpcode();

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-registry

@Test
public void testContainerRegistrationPersistanceAbsent() throws Exception {
 ServiceRecord record = marshal.fromBytes("somepath",
   CONTAINER_RECORD_YARN_PERSISTANCE_ABSENT.getBytes());
 registryDNS.register(
   "/registry/users/root/services/org-apache-slider/test1/components/"
     + "ctr-e50-1451931954322-0016-01-000003",
    record);
 Name name =
   Name.fromString("ctr-e50-1451931954322-0016-01-000002.dev.test.");
 Record question = Record.newRecord(name, Type.A, DClass.IN);
 Message query = Message.newQuery(question);
 byte[] responseBytes = registryDNS.generateReply(query, null);
 Message response = new Message(responseBytes);
 assertEquals("Excepting NXDOMAIN as Record must not have regsisterd wrong",
   Rcode.NXDOMAIN, response.getRcode());
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-registry

@Test
public void testNoContainerIP() throws Exception {
 ServiceRecord record = getMarshal().fromBytes("somepath",
   CONTAINER_RECORD_NO_IP.getBytes());
 getRegistryDNS().register(
   "/registry/users/root/services/org-apache-slider/test1/components/"
     + "ctr-e50-1451931954322-0016-01-000002",
   record);
 // start assessing whether correct records are available
 Name name =
   Name.fromString("ctr-e50-1451931954322-0016-01-000002.dev.test.");
 Record question = Record.newRecord(name, Type.A, DClass.IN);
 Message query = Message.newQuery(question);
 byte[] responseBytes = getRegistryDNS().generateReply(query, null);
 Message response = new Message(responseBytes);
 assertEquals("wrong status", Rcode.NXDOMAIN, response.getRcode());
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-registry

@Test
public void testMissingReverseLookup() throws Exception {
 ServiceRecord record = getMarshal().fromBytes("somepath",
   CONTAINER_RECORD.getBytes());
 getRegistryDNS().register(
   "/registry/users/root/services/org-apache-slider/test1/components/"
     + "ctr-e50-1451931954322-0016-01-000002",
   record);
 // start assessing whether correct records are available
 Name name = Name.fromString("19.1.17.172.in-addr.arpa.");
 Record question = Record.newRecord(name, Type.PTR, DClass.IN);
 Message query = Message.newQuery(question);
 OPTRecord optRecord = new OPTRecord(4096, 0, 0, Flags.DO, null);
 query.addRecord(optRecord, Section.ADDITIONAL);
 byte[] responseBytes = getRegistryDNS().generateReply(query, null);
 Message response = new Message(responseBytes);
 assertEquals("Missing record should be: ", Rcode.NXDOMAIN,
   response.getRcode());
}

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

int rcode = response.getRcode();
if (rcode != Rcode.NOERROR) {
  if (qtype == Type.IXFR &&

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

int rcode = response.getRcode();
if (rcode != Rcode.NOERROR) {
  if (qtype == Type.IXFR &&

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

int rcode = response.getRcode();
if (rcode != Rcode.NOERROR) {
  if (qtype == Type.IXFR &&

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

int rcode = response.getRcode();
if (rcode != Rcode.NOERROR) {
  if (qtype == Type.IXFR &&

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-registry

Record[] assertDNSQueryNotNull(String lookup, int type, int answerCount)
  throws IOException {
 Name name = Name.fromString(lookup);
 Record question = Record.newRecord(name, type, DClass.IN);
 Message query = Message.newQuery(question);
 OPTRecord optRecord = new OPTRecord(4096, 0, 0, Flags.DO, null);
 query.addRecord(optRecord, Section.ADDITIONAL);
 byte[] responseBytes = getRegistryDNS().generateReply(query, null);
 Message response = new Message(responseBytes);
 assertEquals("not successful", Rcode.NOERROR, response.getRcode());
 assertNotNull("Null response", response);
 assertEquals("Questions do not match", query.getQuestion(),
   response.getQuestion());
 Record[] recs = response.getSectionArray(Section.ANSWER);
 assertEquals(answerCount, recs.length);
 assertEquals(recs[0].getType(), type);
 return recs;
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-registry

assertEquals("not successful", Rcode.NXDOMAIN, response.getRcode());
assertNotNull("Null response", response);
assertEquals("Questions do not match", query.getQuestion(),

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-registry

Record[] assertDNSQuery(String lookup, int type, int numRecs)
  throws IOException {
 Name name = Name.fromString(lookup);
 Record question = Record.newRecord(name, type, DClass.IN);
 Message query = Message.newQuery(question);
 OPTRecord optRecord = new OPTRecord(4096, 0, 0, Flags.DO, null);
 query.addRecord(optRecord, Section.ADDITIONAL);
 byte[] responseBytes = getRegistryDNS().generateReply(query, null);
 Message response = new Message(responseBytes);
 assertEquals("not successful", Rcode.NOERROR, response.getRcode());
 assertNotNull("Null response", response);
 assertEquals("Questions do not match", query.getQuestion(),
   response.getQuestion());
 Record[] recs = response.getSectionArray(Section.ANSWER);
 assertEquals("wrong number of answer records",
   isSecure() ? numRecs * 2 : numRecs, recs.length);
 if (isSecure()) {
  boolean signed = false;
  for (Record record : recs) {
   signed = record.getType() == Type.RRSIG;
   if (signed) {
    break;
   }
  }
  assertTrue("No signatures found", signed);
 }
 return recs;
}

相关文章