本文整理了Java中org.xbill.DNS.Header.getID()
方法的一些代码示例,展示了Header.getID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.getID()
方法的具体详情如下:
包路径:org.xbill.DNS.Header
类名称:Header
方法名:getID
暂无
代码示例来源: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
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: posicks/mdnsjava
resolverListenerDispatcher.receiveMessage(message.getHeader().getID(), message);
} catch (IOException e)
代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi
void
toWire(DNSOutput out) {
out.writeU16(getID());
out.writeU16(flags);
for (int i = 0; i < counts.length; i++)
out.writeU16(counts[i]);
}
代码示例来源:origin: org.littleshoot/dnsjava
void
toWire(DNSOutput out) {
out.writeU16(getID());
out.writeU16(flags);
for (int i = 0; i < counts.length; i++)
out.writeU16(counts[i]);
}
代码示例来源:origin: dnsjava/dnsjava
void
toWire(DNSOutput out) {
out.writeU16(getID());
out.writeU16(flags);
for (int i = 0; i < counts.length; i++)
out.writeU16(counts[i]);
}
代码示例来源:origin: tiandawu/IotXmpp
void
toWire(DNSOutput out) {
out.writeU16(getID());
out.writeU16(flags);
for (int i = 0; i < counts.length; i++)
out.writeU16(counts[i]);
}
代码示例来源:origin: org.echocat.jomon.net/common
final DataOutputStream dataOut;
dataOut = new DataOutputStream(s.getOutputStream());
final int id = query.getHeader().getID();
while (it.hasNext()) {
final RRset rrset = (RRset) it.next();
代码示例来源:origin: dnsjava/dnsjava
DataOutputStream dataOut;
dataOut = new DataOutputStream(s.getOutputStream());
int id = query.getHeader().getID();
while (it.hasNext()) {
RRset rrset = (RRset) it.next();
代码示例来源:origin: dnsjava/dnsjava
signature, m.getHeader().getID(),
Rcode.NOERROR, other);
m.addRecord(r, Section.ADDITIONAL);
代码示例来源:origin: org.littleshoot/dnsjava
private Message
sendAXFR(Message query) throws IOException {
Name qname = query.getQuestion().getName();
ZoneTransferIn xfrin = ZoneTransferIn.newAXFR(qname, address, tsig);
xfrin.setTimeout((int)(getTimeout() / 1000));
xfrin.setLocalAddress(localAddress);
try {
xfrin.run();
}
catch (ZoneTransferException e) {
throw new WireParseException(e.getMessage());
}
List records = xfrin.getAXFR();
Message response = new Message(query.getHeader().getID());
response.getHeader().setFlag(Flags.AA);
response.getHeader().setFlag(Flags.QR);
response.addRecord(query.getQuestion(), Section.QUESTION);
Iterator it = records.iterator();
while (it.hasNext())
response.addRecord((Record)it.next(), Section.ANSWER);
return response;
}
代码示例来源:origin: dnsjava/dnsjava
private Message
sendAXFR(Message query) throws IOException {
Name qname = query.getQuestion().getName();
ZoneTransferIn xfrin = ZoneTransferIn.newAXFR(qname, address, tsig);
xfrin.setTimeout((int)(getTimeout() / 1000));
xfrin.setLocalAddress(localAddress);
try {
xfrin.run();
}
catch (ZoneTransferException e) {
throw new WireParseException(e.getMessage());
}
List records = xfrin.getAXFR();
Message response = new Message(query.getHeader().getID());
response.getHeader().setFlag(Flags.AA);
response.getHeader().setFlag(Flags.QR);
response.addRecord(query.getQuestion(), Section.QUESTION);
Iterator it = records.iterator();
while (it.hasNext())
response.addRecord((Record)it.next(), Section.ANSWER);
return response;
}
代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi
private Message
sendAXFR(Message query) throws IOException {
Name qname = query.getQuestion().getName();
ZoneTransferIn xfrin = ZoneTransferIn.newAXFR(qname, address, tsig);
xfrin.setTimeout((int)(getTimeout() / 1000));
xfrin.setLocalAddress(localAddress);
try {
xfrin.run();
}
catch (ZoneTransferException e) {
throw new WireParseException(e.getMessage());
}
List records = xfrin.getAXFR();
Message response = new Message(query.getHeader().getID());
response.getHeader().setFlag(Flags.AA);
response.getHeader().setFlag(Flags.QR);
response.addRecord(query.getQuestion(), Section.QUESTION);
Iterator it = records.iterator();
while (it.hasNext())
response.addRecord((Record)it.next(), Section.ANSWER);
return response;
}
代码示例来源:origin: tiandawu/IotXmpp
private Message
sendAXFR(Message query) throws IOException {
Name qname = query.getQuestion().getName();
ZoneTransferIn xfrin = ZoneTransferIn.newAXFR(qname, address, tsig);
xfrin.setTimeout((int)(getTimeout() / 1000));
xfrin.setLocalAddress(localAddress);
try {
xfrin.run();
}
catch (ZoneTransferException e) {
throw new WireParseException(e.getMessage());
}
List records = xfrin.getAXFR();
Message response = new Message(query.getHeader().getID());
response.getHeader().setFlag(Flags.AA);
response.getHeader().setFlag(Flags.QR);
response.addRecord(query.getQuestion(), Section.QUESTION);
Iterator it = records.iterator();
while (it.hasNext())
response.addRecord((Record)it.next(), Section.ANSWER);
return response;
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-registry
/**
* Create a query to forward to the primary DNS server (if configured).
* NOTE: Experimental
*
* @param query the inbound query.
* @return the query to forward to the primary server.
* @throws NameTooLongException
* @throws TextParseException if query creation fails.
*/
private Message createPrimaryQuery(Message query)
throws NameTooLongException, TextParseException {
Name name = query.getQuestion().getName();
if (name.labels() > 0 && name.labels() <= 2) {
// short relative or absolute name. this code may not be necessary -
// OS resolution utilities probably append the search paths defined
// in resolv.conf prior to the lookup
int id = query.getHeader().getID();
String queryName = name.getLabelString(0);
Name qualifiedName = Name.concatenate(Name.fromString(queryName),
Name.fromString(domainName));
LOG.info("Received query {}. Forwarding query {}", name, qualifiedName);
Record question = Record.newRecord(qualifiedName,
query.getQuestion().getType(),
query.getQuestion().getDClass());
query = Message.newQuery(question);
query.getHeader().setID(id);
}
return query;
}
代码示例来源:origin: org.littleshoot/dnsjava
signature, m.getHeader().getID(),
Rcode.NOERROR, other);
m.addRecord(r, Section.ADDITIONAL);
代码示例来源:origin: tiandawu/IotXmpp
signature, m.getHeader().getID(),
Rcode.NOERROR, other);
m.addRecord(r, Section.ADDITIONAL);
代码示例来源:origin: RIPE-NCC/hadoop-pcap
@Override
protected void processPacketPayload(Packet packet, byte[] payload) {
String protocol = (String)packet.get(Packet.PROTOCOL);
if (!PcapReader.PROTOCOL_UDP.equals(protocol) && !PcapReader.PROTOCOL_TCP.equals(protocol))
return;
DnsPacket dnsPacket = (DnsPacket)packet;
if (DNS_PORT == (Integer)packet.get(Packet.SRC_PORT) || DNS_PORT == (Integer)packet.get(Packet.DST_PORT)) {
if (PROTOCOL_TCP.equals(protocol) &&
payload.length > 2) // TODO Support DNS responses with multiple messages (as used for XFRs)
payload = Arrays.copyOfRange(payload, 2, payload.length); // First two bytes denote the size of the DNS message, ignore them
try {
Message msg = new Message(payload);
Header header = msg.getHeader();
dnsPacket.put(DnsPacket.QUERYID, header.getID());
dnsPacket.put(DnsPacket.FLAGS, header.printFlags());
dnsPacket.put(DnsPacket.QR, header.getFlag(Flags.QR));
dnsPacket.put(DnsPacket.OPCODE, Opcode.string(header.getOpcode()));
dnsPacket.put(DnsPacket.RCODE, Rcode.string(header.getRcode()));
dnsPacket.put(DnsPacket.QUESTION, convertRecordToString(msg.getQuestion()));
dnsPacket.put(DnsPacket.QNAME, convertRecordOwnerToString(msg.getQuestion()));
dnsPacket.put(DnsPacket.QTYPE, convertRecordTypeToInt(msg.getQuestion()));
dnsPacket.put(DnsPacket.ANSWER, convertRecordsToStrings(msg.getSectionArray(Section.ANSWER)));
dnsPacket.put(DnsPacket.AUTHORITY, convertRecordsToStrings(msg.getSectionArray(Section.AUTHORITY)));
dnsPacket.put(DnsPacket.ADDITIONAL, convertRecordsToStrings(msg.getSectionArray(Section.ADDITIONAL)));
} catch (Exception e) {
// If we cannot decode a DNS packet we ignore it
}
}
}
内容来源于网络,如有侵权,请联系作者删除!