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

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

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

Header.setOpcode介绍

暂无

代码示例

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

h.setOpcode(Opcode.UPDATE);
for (int index = 0; index < authRecords.size(); index++ )
h.setOpcode(Opcode.QUERY);
h.setFlag(Flags.QR);
for (int index = 0; index < nonauthRecords.size(); index++ )

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

public static Message newQueryResponse(final Record[] records, final int section)
{
  Message message = new Message();
  Header header = message.getHeader();
  
  header.setRcode(Rcode.NOERROR);
  header.setOpcode(Opcode.QUERY);
  header.setFlag(Flags.QR);
  
  for (int index = 0; index < records.length; index++)
  {
    message.addRecord(records[index], section);
  }
  
  return message;
}

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

/**
 * Creates an update message.
 * @param zone The name of the zone being updated.
 * @param dclass The class of the zone being updated.
 */
public
Update(Name zone, int dclass) {
  super();
  if (!zone.isAbsolute())
    throw new RelativeNameException(zone);
  DClass.check(dclass);
    getHeader().setOpcode(Opcode.UPDATE);
  Record soa = Record.newRecord(zone, Type.SOA, DClass.IN);
  addRecord(soa, Section.QUESTION);
  this.origin = zone;
  this.dclass = dclass;
}

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

/**
 * Creates an update message.
 * @param zone The name of the zone being updated.
 * @param dclass The class of the zone being updated.
 */
public
Update(Name zone, int dclass) {
  super();
  if (!zone.isAbsolute())
    throw new RelativeNameException(zone);
  DClass.check(dclass);
    getHeader().setOpcode(Opcode.UPDATE);
  Record soa = Record.newRecord(zone, Type.SOA, DClass.IN);
  addRecord(soa, Section.QUESTION);
  this.origin = zone;
  this.dclass = dclass;
}

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

/**
 * Creates an update message.
 * @param zone The name of the zone being updated.
 * @param dclass The class of the zone being updated.
 */
public
Update(Name zone, int dclass) {
  super();
  if (!zone.isAbsolute())
    throw new RelativeNameException(zone);
  DClass.check(dclass);
    getHeader().setOpcode(Opcode.UPDATE);
  Record soa = Record.newRecord(zone, Type.SOA, DClass.IN);
  addRecord(soa, Section.QUESTION);
  this.origin = zone;
  this.dclass = dclass;
}

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

/**
 * Creates an update message.
 * @param zone The name of the zone being updated.
 * @param dclass The class of the zone being updated.
 */
public
Update(Name zone, int dclass) {
  super();
  if (!zone.isAbsolute())
    throw new RelativeNameException(zone);
  DClass.check(dclass);
    getHeader().setOpcode(Opcode.UPDATE);
  Record soa = Record.newRecord(zone, Type.SOA, DClass.IN);
  addRecord(soa, Section.QUESTION);
  this.origin = zone;
  this.dclass = dclass;
}

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

protected Message convertUpdateToQueryResponse(final Message update)
{
  Message m = new Message();
  Header h = m.getHeader();
  
  h.setOpcode(Opcode.QUERY);
  h.setFlag(Flags.AA);
  h.setFlag(Flags.QR);
  
  Record[] records = update.getSectionArray(Section.UPDATE);
  for (int index = 0; index < records.length; index++ )
  {
    m.addRecord(records[index], Section.ANSWER);
  }
  
  records = update.getSectionArray(Section.ADDITIONAL);
  for (int index = 0; index < records.length; index++ )
  {
    m.addRecord(records[index], Section.ADDITIONAL);
  }
  
  return m;
}

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

header.setOpcode(Opcode.QUERY);
header.setFlag(Flags.QR);

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

private void
sendQuery() throws IOException {
  Record question = Record.newRecord(zname, qtype, dclass);

  Message query = new Message();
  query.getHeader().setOpcode(Opcode.QUERY);
  query.addRecord(question, Section.QUESTION);
  if (qtype == Type.IXFR) {
    Record soa = new SOARecord(zname, dclass, 0, Name.root,
            Name.root, ixfr_serial,
            0, 0, 0, 0);
    query.addRecord(soa, Section.AUTHORITY);
  }
  if (tsig != null) {
    tsig.apply(query, null);
    verifier = new TSIG.StreamVerifier(tsig, query.getTSIG());
  }
  byte [] out = query.toWire(Message.MAXLENGTH);
  client.send(out);
}

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

private void
sendQuery() throws IOException {
  Record question = Record.newRecord(zname, qtype, dclass);

  Message query = new Message();
  query.getHeader().setOpcode(Opcode.QUERY);
  query.addRecord(question, Section.QUESTION);
  if (qtype == Type.IXFR) {
    Record soa = new SOARecord(zname, dclass, 0, Name.root,
            Name.root, ixfr_serial,
            0, 0, 0, 0);
    query.addRecord(soa, Section.AUTHORITY);
  }
  if (tsig != null) {
    tsig.apply(query, null);
    verifier = new TSIG.StreamVerifier(tsig, query.getTSIG());
  }
  byte [] out = query.toWire(Message.MAXLENGTH);
  client.send(out);
}

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

private void
sendQuery() throws IOException {
  Record question = Record.newRecord(zname, qtype, dclass);

  Message query = new Message();
  query.getHeader().setOpcode(Opcode.QUERY);
  query.addRecord(question, Section.QUESTION);
  if (qtype == Type.IXFR) {
    Record soa = new SOARecord(zname, dclass, 0, Name.root,
            Name.root, ixfr_serial,
            0, 0, 0, 0);
    query.addRecord(soa, Section.AUTHORITY);
  }
  if (tsig != null) {
    tsig.apply(query, null);
    verifier = new TSIG.StreamVerifier(tsig, query.getTSIG());
  }
  byte [] out = query.toWire(Message.MAXLENGTH);
  client.send(out);
}

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

private void
sendQuery() throws IOException {
  Record question = Record.newRecord(zname, qtype, dclass);

  Message query = new Message();
  query.getHeader().setOpcode(Opcode.QUERY);
  query.addRecord(question, Section.QUESTION);
  if (qtype == Type.IXFR) {
    Record soa = new SOARecord(zname, dclass, 0, Name.root,
            Name.root, ixfr_serial,
            0, 0, 0, 0);
    query.addRecord(soa, Section.AUTHORITY);
  }
  if (tsig != null) {
    tsig.apply(query, null);
    verifier = new TSIG.StreamVerifier(tsig, query.getTSIG());
  }
  byte [] out = query.toWire(Message.MAXLENGTH);
  client.send(out);
}

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

header.setOpcode(Opcode.QUERY);
header.setFlag(Flags.QR);
header.setOpcode(Opcode.QUERY);
header.setFlag(Flags.QR);

相关文章