BIND 10 trac2157_2, updated. 74a034d57525026cb30591f3e89c49be2f2787ec [2157] aligned the case of opcode and rcode
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Nov 28 10:01:21 UTC 2012
The branch, trac2157_2 has been updated
via 74a034d57525026cb30591f3e89c49be2f2787ec (commit)
via 12ca269d63653d1db9280920717554f3d06f885f (commit)
via b65007a6a4dbc4b192f78dece6ba84eb32e0b3bc (commit)
from 8de2a109e5827ed6bac158e8a12c453d90a23f26 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 74a034d57525026cb30591f3e89c49be2f2787ec
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date: Wed Nov 28 18:58:03 2012 +0900
[2157] aligned the case of opcode and rcode
commit 12ca269d63653d1db9280920717554f3d06f885f
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date: Wed Nov 28 18:41:58 2012 +0900
[2157] updated includes
commit b65007a6a4dbc4b192f78dece6ba84eb32e0b3bc
Author: Yoshitaka Aharen <aharen at jprs.co.jp>
Date: Wed Nov 28 18:39:16 2012 +0900
[2157] use isc::dns::Opcode directly
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/auth_srv.cc | 2 +-
src/bin/auth/statistics.cc.pre | 14 +++++++++-----
src/bin/auth/statistics.h | 14 ++++++++------
src/bin/auth/statistics_msg_items.def | 18 +++++++++---------
src/bin/auth/tests/statistics_unittest.cc.pre | 24 ++++++++++++------------
5 files changed, 39 insertions(+), 33 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc
index 74c2984..62626ec 100644
--- a/src/bin/auth/auth_srv.cc
+++ b/src/bin/auth/auth_srv.cc
@@ -575,7 +575,7 @@ AuthSrv::processMessage(const IOMessage& io_message, Message& message,
}
// note: This can only be reliable after TSIG check succeeds.
- impl_->stats_attrs_.setRequestOpCode(opcode.getCode());
+ impl_->stats_attrs_.setRequestOpCode(opcode);
if (opcode == Opcode::NOTIFY()) {
send_answer = impl_->processNotify(io_message, message, buffer,
diff --git a/src/bin/auth/statistics.cc.pre b/src/bin/auth/statistics.cc.pre
index bed965c..584cf4e 100644
--- a/src/bin/auth/statistics.cc.pre
+++ b/src/bin/auth/statistics.cc.pre
@@ -16,10 +16,13 @@
#include <auth/statistics_items.h>
#include <auth/auth_log.h>
+#include <cc/data.h>
+
+#include <dns/message.h>
#include <dns/opcode.h>
#include <dns/rcode.h>
-#include <cc/data.h>
+#include <statistics/counter.h>
#include <algorithm>
#include <cctype>
@@ -80,8 +83,8 @@ namespace statistics {
// Note: opcode in this array must be start with 0 and be sequential
const int opcode_to_msgcounter[] = {
MSG_OPCODE_QUERY, // Opcode = 0: Query
- MSG_OPCODE_IQUERY, // Opcode = 1: Iquery
- MSG_OPCODE_STATUS, // Opcode = 2: STATUS
+ MSG_OPCODE_IQUERY, // Opcode = 1: IQuery
+ MSG_OPCODE_STATUS, // Opcode = 2: Status
MSG_OPCODE_OTHER, // Opcode = 3: (Unassigned)
MSG_OPCODE_NOTIFY, // Opcode = 4: Notify
MSG_OPCODE_UPDATE, // Opcode = 5: Update
@@ -165,7 +168,8 @@ Counters::incRequest(const MessageAttributes& msgattrs) {
}
// OPCODE
- server_msg_counter_.inc(opcode_to_msgcounter[msgattrs.getRequestOpCode()]);
+ server_msg_counter_.inc(
+ opcode_to_msgcounter[msgattrs.getRequestOpCode().getCode()]);
}
void
@@ -205,7 +209,7 @@ Counters::incResponse(const MessageAttributes& msgattrs,
server_msg_counter_.inc(MSG_REQUEST_BADEDNSVER);
}
- if (msgattrs.getRequestOpCode() == Opcode::QUERY_CODE) {
+ if (msgattrs.getRequestOpCode() == Opcode::QUERY()) {
// compound attributes
const unsigned int answer_rrs =
response.getRRCount(Message::SECTION_ANSWER);
diff --git a/src/bin/auth/statistics.h b/src/bin/auth/statistics.h
index 9bcb998..b807a26 100644
--- a/src/bin/auth/statistics.h
+++ b/src/bin/auth/statistics.h
@@ -18,9 +18,9 @@
#include <cc/data.h>
#include <dns/message.h>
+#include <dns/opcode.h>
#include <statistics/counter.h>
-#include <statistics/counter_dict.h>
#include <boost/noncopyable.hpp>
@@ -32,6 +32,8 @@ namespace isc {
namespace auth {
namespace statistics {
+using isc::dns::Opcode;
+
/// \brief DNS Message attributes for statistics.
///
/// This class holds some attributes related to a DNS message
@@ -41,7 +43,7 @@ private:
// request attributes
int req_ip_version_; // IP version
int req_transport_protocol_; // Transport layer protocol
- uint8_t req_opcode_; // OpCode
+ Opcode req_opcode_; // OpCode
enum BitAttributes {
REQ_IS_EDNS_0, // EDNS ver.0
REQ_IS_DNSSEC_OK, // DNSSEC OK (DO) bit is set
@@ -56,20 +58,20 @@ public:
/// \brief The constructor.
///
/// \throw None
- MessageAttributes() {
+ MessageAttributes() : req_opcode_(Opcode::RESERVED15_CODE) {
reset();
}
/// \brief Get request opcode.
/// \return opcode of a request
/// \throw None
- uint8_t getRequestOpCode() const {
+ const Opcode& getRequestOpCode() const {
return (req_opcode_);
}
/// \brief Set request opcode.
/// \throw None
- void setRequestOpCode(const uint8_t opcode) {
+ void setRequestOpCode(const Opcode& opcode) {
req_opcode_ = opcode;
}
@@ -184,7 +186,7 @@ public:
void reset() {
req_ip_version_ = 0;
req_transport_protocol_ = 0;
- req_opcode_ = 0;
+ req_opcode_ = Opcode(Opcode::RESERVED15_CODE);
bit_attributes_.reset();
}
};
diff --git a/src/bin/auth/statistics_msg_items.def b/src/bin/auth/statistics_msg_items.def
index 467ead2..33cbed0 100644
--- a/src/bin/auth/statistics_msg_items.def
+++ b/src/bin/auth/statistics_msg_items.def
@@ -7,15 +7,15 @@ request msg_counter_request Request statistics =
sig0 MSG_REQUEST_SIG0 Number of requests with SIG(0) received by the b10-auth server; currently not implemented in BIND 10.
badsig MSG_REQUEST_BADSIG Number of requests with invalid TSIG or SIG(0) signature received by the b10-auth server.
udp MSG_REQUEST_UDP Number of UDP requests received by the b10-auth server.
- tcp MSG_REQUEST_TCP Number of UDP requests received by the b10-auth server.
+ tcp MSG_REQUEST_TCP Number of TCP requests received by the b10-auth server.
dnssec_ok MSG_REQUEST_DNSSEC_OK Number of requests with "DNSSEC OK" (DO) bit was set received by the b10-auth server.
;
-opcode msg_counter_opcode Opcode statistics =
- query MSG_OPCODE_QUERY Number of Opcode=QUERY requests received by the b10-auth server.
- iquery MSG_OPCODE_IQUERY Number of Opcode=IQUERY requests received by the b10-auth server.
- status MSG_OPCODE_STATUS Number of Opcode=STATUS requests received by the b10-auth server.
- notify MSG_OPCODE_NOTIFY Number of Opcode=NOTIFY requests received by the b10-auth server.
- update MSG_OPCODE_UPDATE Number of Opcode=UPDATE requests received by the b10-auth server.
+opcode msg_counter_opcode OpCode statistics =
+ query MSG_OPCODE_QUERY Number of OpCode=Query requests received by the b10-auth server.
+ iquery MSG_OPCODE_IQUERY Number of OpCode=IQuery requests received by the b10-auth server.
+ status MSG_OPCODE_STATUS Number of OpCode=Status requests received by the b10-auth server.
+ notify MSG_OPCODE_NOTIFY Number of OpCode=Notify requests received by the b10-auth server.
+ update MSG_OPCODE_UPDATE Number of OpCode=Update requests received by the b10-auth server.
other MSG_OPCODE_OTHER Number of requests in other OpCode received by the b10-auth server.
;
responses MSG_RESPONSE Number of responses sent by the b10-auth server.
@@ -25,11 +25,11 @@ response msg_counter_response Response statistics =
tsig MSG_RESPONSE_TSIG Number of responses with TSIG sent by the b10-auth server.
sig0 MSG_RESPONSE_SIG0 Number of responses with SIG(0) sent by the b10-auth server; currently not implemented in BIND 10.
;
-qrysuccess MSG_QRYSUCCESS Number of queries received by the b10-auth server resulted in rcode = NOERROR and the number of answer RR >= 1.
+qrysuccess MSG_QRYSUCCESS Number of queries received by the b10-auth server resulted in rcode = NoError and the number of answer RR >= 1.
qryauthans MSG_QRYAUTHANS Number of queries received by the b10-auth server resulted in authoritative answer.
qrynoauthans MSG_QRYNOAUTHANS Number of queries received by the b10-auth server resulted in non-authoritative answer.
qryreferral MSG_QRYREFERRAL Number of queries received by the b10-auth server resulted in referral answer.
-qrynxrrset MSG_QRYNXRRSET Number of queries received by the b10-auth server resulted in NOERROR but the number of answer RR == 0.
+qrynxrrset MSG_QRYNXRRSET Number of queries received by the b10-auth server resulted in NoError but the number of answer RR == 0.
authqryrej MSG_QRYREJECT Number of authoritative queries rejected by the b10-auth server.
rcode msg_counter_rcode Rcode statistics =
noerror MSG_RCODE_NOERROR Number of requests received by the b10-auth server resulted in RCODE = 0 (NoError).
diff --git a/src/bin/auth/tests/statistics_unittest.cc.pre b/src/bin/auth/tests/statistics_unittest.cc.pre
index 5f5f6ca..d930c09 100644
--- a/src/bin/auth/tests/statistics_unittest.cc.pre
+++ b/src/bin/auth/tests/statistics_unittest.cc.pre
@@ -111,7 +111,7 @@ TEST_F(CountersTest, incrementResponse) {
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::QUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::QUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
@@ -156,7 +156,7 @@ TEST_F(CountersTest, incrementProtocolType) {
msgattrs.setRequestIPVersion(af);
msgattrs.setRequestTransportProtocol(proto);
- msgattrs.setRequestOpCode(Opcode::QUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::QUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
@@ -209,7 +209,7 @@ TEST_F(CountersTest, incrementDO) {
const bool is_dnssec_ok = i & 1;
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::QUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::QUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(is_dnssec_ok);
@@ -252,7 +252,7 @@ TEST_F(CountersTest, incrementEDNS) {
const bool is_edns0 = i & 1;
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::QUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::QUERY());
msgattrs.setRequestEDNS0(is_edns0);
msgattrs.setRequestDO(true);
@@ -314,7 +314,7 @@ TEST_F(CountersTest, incrementTSIG) {
const bool is_badsig = (i == 0 ? i : i+1) & 1;
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::QUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::QUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
msgattrs.setRequestSig(is_tsig, is_sig0, is_badsig);
@@ -373,7 +373,7 @@ TEST_F(CountersTest, incrementOpcode) {
{
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(i);
+ msgattrs.setRequestOpCode(Opcode(i));
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
msgattrs.setRequestSig(false, false, false);
@@ -431,7 +431,7 @@ TEST_F(CountersTest, incrementRcode) {
{
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::IQUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::IQUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
msgattrs.setRequestSig(false, false, false);
@@ -494,7 +494,7 @@ TEST_F(CountersTest, incrementTruncated) {
const bool is_truncated = i & 1;
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::IQUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::IQUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
msgattrs.setRequestSig(false, false, false);
@@ -540,7 +540,7 @@ TEST_F(CountersTest, incrementQryAuthAnsAndNoAuthAns) {
const bool is_aa_set = i & 1;
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::QUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::QUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
msgattrs.setRequestSig(false, false, false);
@@ -580,7 +580,7 @@ TEST_F(CountersTest, incrementQrySuccess) {
// Opcode = QUERY, Rcode = NOERROR, ANCOUNT > 0
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::QUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::QUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
msgattrs.setRequestSig(false, false, false);
@@ -629,7 +629,7 @@ TEST_F(CountersTest, incrementQryReferralAndNxrrset) {
const bool is_aa_set = i & 1;
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::QUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::QUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
msgattrs.setRequestSig(false, false, false);
@@ -672,7 +672,7 @@ TEST_F(CountersTest, incrementAuthQryRej) {
// Opcode = QUERY, Rcode = REFUSED, ANCOUNT = 0 (don't care)
msgattrs.setRequestIPVersion(AF_INET);
msgattrs.setRequestTransportProtocol(IPPROTO_UDP);
- msgattrs.setRequestOpCode(Opcode::QUERY_CODE);
+ msgattrs.setRequestOpCode(Opcode::QUERY());
msgattrs.setRequestEDNS0(true);
msgattrs.setRequestDO(true);
msgattrs.setRequestSig(false, false, false);
More information about the bind10-changes
mailing list