本文整理了Java中org.xbill.DNS.Header.getOpcode()
方法的一些代码示例,展示了Header.getOpcode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.getOpcode()
方法的具体详情如下:
包路径:org.xbill.DNS.Header
类名称:Header
方法名:getOpcode
暂无
代码示例来源: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: 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: 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: 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.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: 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: 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: posicks/mdnsjava
int opcode = header.getOpcode();
代码示例来源:origin: posicks/mdnsjava
headerEqual = (responseHeader.getOpcode() == queryHeader.getOpcode()) &&
(responseHeader.getRcode() == queryHeader.getRcode());
代码示例来源: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: 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: tiandawu/IotXmpp
Message(DNSInput in) throws IOException {
this(new Header(in));
boolean isUpdate = (header.getOpcode() == Opcode.UPDATE);
boolean truncated = header.getFlag(Flags.TC);
try {
代码示例来源:origin: dnsjava/dnsjava
Message(DNSInput in) throws IOException {
this(new Header(in));
boolean isUpdate = (header.getOpcode() == Opcode.UPDATE);
boolean truncated = header.getFlag(Flags.TC);
try {
代码示例来源:origin: posicks/mdnsjava
boolean isUpdate = header.getOpcode() == Opcode.UPDATE;
代码示例来源:origin: posicks/mdnsjava
switch (h.getOpcode())
代码示例来源:origin: posicks/mdnsjava
switch (response.getHeader().getOpcode())
代码示例来源: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
}
}
}
代码示例来源:origin: OpenNMS/opennms
if (header.getRcode() != Rcode.NOERROR)
return errorMessage(query, Rcode.FORMERR);
if (header.getOpcode() != Opcode.QUERY)
return errorMessage(query, Rcode.NOTIMP);
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-registry
return errorMessage(query, Rcode.FORMERR);
if (header.getOpcode() != Opcode.QUERY) {
return errorMessage(query, Rcode.NOTIMP);
内容来源于网络,如有侵权,请联系作者删除!