本文整理了Java中org.xbill.DNS.Header.setFlag()
方法的一些代码示例,展示了Header.setFlag()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.setFlag()
方法的具体详情如下:
包路径:org.xbill.DNS.Header
类名称:Header
方法名:setFlag
暂无
代码示例来源:origin: julian-klode/dns66
} else {
Log.i(TAG, "handleDnsRequest: DNS Name " + dnsQueryName + " Blocked!");
dnsMsg.getHeader().setFlag(Flags.QR);
dnsMsg.getHeader().setRcode(Rcode.NOERROR);
dnsMsg.addRecord(NEGATIVE_CACHE_SOA_RECORD, Section.AUTHORITY);
代码示例来源:origin: dnsjava/dnsjava
/**
* Sets a flag to the supplied value
* @see Flags
*/
public void
setFlag(int bit) {
checkFlag(bit);
flags = setFlag(flags, bit, true);
}
代码示例来源:origin: dnsjava/dnsjava
/**
* Sets a flag to the supplied value
* @see Flags
*/
public void
unsetFlag(int bit) {
checkFlag(bit);
flags = setFlag(flags, bit, false);
}
代码示例来源:origin: posicks/mdnsjava
/**
* {@inheritDoc}
*/
protected void writeResponse(final Message message)
throws IOException
{
if (mdnsVerbose)
{
logger.logp(Level.INFO, getClass().getName(), "writeResponse", "Writing Response to " + multicastAddress.getHostAddress() + ":" + port);
}
Header header = message.getHeader();
header.setFlag(Flags.AA);
header.setFlag(Flags.QR);
header.setRcode(0);
writeMessageToWire(message/* , true */);
}
代码示例来源: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: undera/jmeter-plugins
protected byte[] getMessageBytes(String data) {
Message msg = new Message();
String recs[] = data.split(NL);
for (String rec : recs) {
if (rec.length() <= 3) {
Header head = msg.getHeader();
int val = Integer.parseInt(rec.trim());
if (val < 0) {
head.unsetFlag(-val);
} else {
head.setFlag(val);
}
msg.setHeader(head);
} else {
msg.addRecord(getRecord(rec.trim()), Section.QUESTION);
}
}
return msg.toWire();
}
代码示例来源:origin: kg.apc/jmeter-plugins-extras-libs
protected byte[] getMessageBytes(String data) {
Message msg = new Message();
String recs[] = data.split(NL);
for (String rec : recs) {
if (rec.length() <= 3) {
Header head = msg.getHeader();
int val = Integer.parseInt(rec.trim());
if (val < 0) {
head.unsetFlag(-val);
} else {
head.setFlag(val);
}
msg.setHeader(head);
} else {
msg.addRecord(getRecord(rec.trim()), Section.QUESTION);
}
}
return msg.toWire();
}
代码示例来源:origin: OpenNMS/opennms
final Message response = new Message(id);
final Header header = response.getHeader();
header.setFlag(Flags.QR);
header.setFlag(Flags.AA);
addRRset(rrset.getName(), response, rrset, Section.ANSWER, FLAG_DNSSECOK);
if (tsig != null) {
代码示例来源:origin: org.echocat.jomon.net/common
final Message response = new Message(id);
final Header header = response.getHeader();
header.setFlag(Flags.QR);
header.setFlag(Flags.AA);
addRRset(rrset.getName(), response, rrset,
Section.ANSWER, FLAG_DNSSECOK);
代码示例来源:origin: dnsjava/dnsjava
Message response = new Message(id);
Header header = response.getHeader();
header.setFlag(Flags.QR);
header.setFlag(Flags.AA);
addRRset(rrset.getName(), response, rrset,
Section.ANSWER, FLAG_DNSSECOK);
代码示例来源: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
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: org.nhind/dns
/**
* Processes a DNS error condition and creates an appropriate DNS response.
* @param request The original DNS request.
* @param error The error condition that occured.
* @return A response to the DNS request.
*/
protected Message processError(Message request, DNSError<?> error)
{
Message errorResponse = null;
try
{
Header respHeader = new Header(request.toWire());
Message response = new Message();
response.setHeader(respHeader);
for (int i = 0; i < 4; i++)
response.removeAllRecords(i);
response.addRecord(request.getQuestion(), Section.QUESTION);
response.getHeader().setFlag(Flags.QR);
if (request.getHeader().getFlag(Flags.RD))
response.getHeader().setFlag(Flags.RD);
respHeader.setRcode(Integer.parseInt(error.getError().toString()));
return response;
}
catch (IOException e) {}
return errorResponse;
}
代码示例来源: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: 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: 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;
}
内容来源于网络,如有侵权,请联系作者删除!