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

x33g5p2x  于2022-01-20 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(130)

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

Header.getCount介绍

暂无

代码示例

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

/**
 * Returns the TSIG record from the ADDITIONAL section, if one is present.
 * @see TSIGRecord
 * @see TSIG
 * @see Section
 */
public TSIGRecord
getTSIG() {
  int count = header.getCount(Section.ADDITIONAL);
  if (count == 0)
    return null;
  List l = sections[Section.ADDITIONAL];
  Record rec = (Record) l.get(count - 1);
  if (rec.type !=  Type.TSIG)
    return null;
  return (TSIGRecord) rec;
}

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

/**
 * Returns the TSIG record from the ADDITIONAL section, if one is present.
 * @see TSIGRecord
 * @see TSIG
 * @see Section
 */
public TSIGRecord
getTSIG() {
  int count = header.getCount(Section.ADDITIONAL);
  if (count == 0)
    return null;
  List l = sections[Section.ADDITIONAL];
  Record rec = (Record) l.get(count - 1);
  if (rec.type !=  Type.TSIG)
    return null;
  return (TSIGRecord) rec;
}

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

/**
 * Returns the TSIG record from the ADDITIONAL section, if one is present.
 * @see TSIGRecord
 * @see TSIG
 * @see Section
 */
public TSIGRecord
getTSIG() {
  int count = header.getCount(Section.ADDITIONAL);
  if (count == 0)
    return null;
  List l = sections[Section.ADDITIONAL];
  Record rec = (Record) l.get(count - 1);
  if (rec.type !=  Type.TSIG)
    return null;
  return (TSIGRecord) rec;
}

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

/**
 * Returns the TSIG record from the ADDITIONAL section, if one is present.
 * @see TSIGRecord
 * @see TSIG
 * @see Section
 */
public TSIGRecord
getTSIG() {
  int count = header.getCount(Section.ADDITIONAL);
  if (count == 0)
    return null;
  List l = sections[Section.ADDITIONAL];
  Record rec = (Record) l.get(count - 1);
  if (rec.type !=  Type.TSIG)
    return null;
  return (TSIGRecord) rec;
}

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

String
toStringWithRcode(int newrcode) {
  StringBuffer sb = new StringBuffer();

  sb.append(";; ->>HEADER<<- "); 
  sb.append("opcode: " + Opcode.string(getOpcode()));
  sb.append(", status: " + Rcode.string(newrcode));
  sb.append(", id: " + getID());
  sb.append("\n");

  sb.append(";; flags: " + printFlags());
  sb.append("; ");
  for (int i = 0; i < 4; i++)
    sb.append(Section.string(i) + ": " + getCount(i) + " ");
  return sb.toString();
}

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

String
toStringWithRcode(int newrcode) {
  StringBuffer sb = new StringBuffer();

  sb.append(";; ->>HEADER<<- "); 
  sb.append("opcode: " + Opcode.string(getOpcode()));
  sb.append(", status: " + Rcode.string(newrcode));
  sb.append(", id: " + getID());
  sb.append("\n");

  sb.append(";; flags: " + printFlags());
  sb.append("; ");
  for (int i = 0; i < 4; i++)
    sb.append(Section.string(i) + ": " + getCount(i) + " ");
  return sb.toString();
}

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

String
toStringWithRcode(int newrcode) {
  StringBuffer sb = new StringBuffer();

  sb.append(";; ->>HEADER<<- "); 
  sb.append("opcode: " + Opcode.string(getOpcode()));
  sb.append(", status: " + Rcode.string(newrcode));
  sb.append(", id: " + getID());
  sb.append("\n");

  sb.append(";; flags: " + printFlags());
  sb.append("; ");
  for (int i = 0; i < 4; i++)
    sb.append(Section.string(i) + ": " + getCount(i) + " ");
  return sb.toString();
}

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

String
toStringWithRcode(int newrcode) {
  StringBuffer sb = new StringBuffer();

  sb.append(";; ->>HEADER<<- "); 
  sb.append("opcode: " + Opcode.string(getOpcode()));
  sb.append(", status: " + Rcode.string(newrcode));
  sb.append(", id: " + getID());
  sb.append("\n");

  sb.append(";; flags: " + printFlags());
  sb.append("; ");
  for (int i = 0; i < 4; i++)
    sb.append(Section.string(i) + ": " + getCount(i) + " ");
  return sb.toString();
}

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

if ((responseHeader.getCount(Section.ANSWER) > 0) || (responseHeader.getCount(Section.AUTHORITY) > 0) || (responseHeader.getCount(Section.ADDITIONAL) > 0))

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

Message(DNSInput in) throws IOException {
  this(new Header(in));
  boolean isUpdate = (header.getOpcode() == Opcode.UPDATE);
  boolean truncated = header.getFlag(Flags.TC);
  try {
    for (int i = 0; i < 4; i++) {
      int count = header.getCount(i);
      if (count > 0)
        sections[i] = new ArrayList(count);
      for (int j = 0; j < count; j++) {
        int pos = in.current();
        Record rec = Record.fromWire(in, i, isUpdate);
        sections[i].add(rec);
        if (rec.getType() == Type.TSIG)
          tsigstart = pos;
      }
    }
  } catch (WireParseException e) {
    if (!truncated)
      throw e;
  }
  size = in.current();
}

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

try {
  for (int i = 0; i < 4; i++) {
    int count = header.getCount(i);
    if (count > 0)
      sections[i] = new ArrayList(count);

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

Message(DNSInput in) throws IOException {
  this(new Header(in));
  boolean isUpdate = (header.getOpcode() == Opcode.UPDATE);
  boolean truncated = header.getFlag(Flags.TC);
  try {
    for (int i = 0; i < 4; i++) {
      int count = header.getCount(i);
      if (count > 0)
        sections[i] = new ArrayList(count);
      for (int j = 0; j < count; j++) {
        int pos = in.current();
        Record rec = Record.fromWire(in, i, isUpdate);
        sections[i].add(rec);
        if (rec.getType() == Type.TSIG)
          tsigstart = pos;
        if (rec.getType() == Type.SIG &&
          ((SIGRecord) rec).getTypeCovered() == 0)
          sig0start = pos;
      }
    }
  } catch (WireParseException e) {
    if (!truncated)
      throw e;
  }
  size = in.current();
}

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

try {
  for (int i = 0; i < 4; i++) {
    int count = header.getCount(i);
    if (count > 0)
      sections[i] = new ArrayList(count);

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

int count = response.getHeader().getCount(section);
if (count != Integer.parseInt(expected)) {
  value = new Integer(count).toString();

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

if (skipped != 0 && i != Section.ADDITIONAL) {
    flags = Header.setFlag(flags, Flags.TC, true);
    out.writeU16At(header.getCount(i) - skipped,
          startpos + 4 + 2 * i);
    for (int j = i + 1; j < Section.ADDITIONAL; j++)
    additionalCount = header.getCount(i) - skipped;
  out.writeU16At(flags, startpos + 2);
if (additionalCount != header.getCount(Section.ADDITIONAL))
  out.writeU16At(additionalCount, startpos + 10);

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

void
sendUpdate() throws IOException {
  if (query.getHeader().getCount(Section.UPDATE) == 0) {
    print("Empty update message.  Ignoring.");
    return;
  if (query.getHeader().getCount(Section.ZONE) == 0) {
    Name updzone;
    updzone = zone;

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

if (i != Section.ADDITIONAL)
  newheader.setFlag(Flags.TC);
int count = newheader.getCount(i);
newheader.setCount(i, count - skipped);
for (int j = i + 1; j < 4; j++)

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

newheader = (Header) header.clone();
newheader.setFlag(Flags.TC);
int count = newheader.getCount(i);
newheader.setCount(i, count - skipped);
for (int j = i + 1; j < 4; j++)

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

if (i != Section.ADDITIONAL)
  newheader.setFlag(Flags.TC);
int count = newheader.getCount(i);
newheader.setCount(i, count - skipped);
for (int j = i + 1; j < 4; j++)

相关文章