void
Counters::incRequest(const MessageAttributes& msgattrs) {
// protocols carrying request
- if (msgattrs.req_ip_version_ == AF_INET) {
+ if (msgattrs.getRequestIPVersion() == AF_INET) {
server_msg_counter_.inc(MSG_REQUEST_IPV4);
- } else if (msgattrs.req_ip_version_ == AF_INET6) {
+ } else if (msgattrs.getRequestIPVersion() == AF_INET6) {
server_msg_counter_.inc(MSG_REQUEST_IPV6);
}
- if (msgattrs.req_transport_protocol_ == IPPROTO_UDP) {
+ if (msgattrs.getRequestTransportProtocol() == IPPROTO_UDP) {
server_msg_counter_.inc(MSG_REQUEST_UDP);
- } else if (msgattrs.req_transport_protocol_ == IPPROTO_TCP) {
+ } else if (msgattrs.getRequestTransportProtocol() == IPPROTO_TCP) {
server_msg_counter_.inc(MSG_REQUEST_TCP);
}
// request TSIG
- if (msgattrs.req_is_tsig_) {
+ if (msgattrs.getRequestSigTSIG()) {
server_msg_counter_.inc(MSG_REQUEST_TSIG);
}
- if (msgattrs.req_is_sig0_) {
+ if (msgattrs.getRequestSigSIG0()) {
server_msg_counter_.inc(MSG_REQUEST_SIG0);
}
- if (msgattrs.req_is_badsig_) {
+ if (msgattrs.getRequestSigBadSig()) {
server_msg_counter_.inc(MSG_REQUEST_BADSIG);
// If signature validation is failed, no other query attributes are
// reliable. Skip processing of the rest of query counters.
}
// request EDNS
- if (msgattrs.req_is_edns_0_) {
+ if (msgattrs.getRequestEDNS0()) {
server_msg_counter_.inc(MSG_REQUEST_EDNS0);
}
- if (msgattrs.req_is_edns_badver_) {
+ if (msgattrs.getRequestEDNSBadVer()) {
server_msg_counter_.inc(MSG_REQUEST_BADEDNSVER);
}
// request DNSSEC
- if (msgattrs.req_is_dnssec_ok_) {
+ if (msgattrs.getRequestDO()) {
server_msg_counter_.inc(MSG_REQUEST_DNSSEC_OK);
}
// OPCODE
- server_msg_counter_.inc(opcode_to_msgcounter[msgattrs.req_opcode_]);
+ server_msg_counter_.inc(opcode_to_msgcounter[msgattrs.getRequestOpCode()]);
}
void
server_msg_counter_.inc(MSG_RESPONSE);
// response truncated
- if (msgattrs.res_is_truncated_) {
+ if (msgattrs.getResponseTruncated()) {
server_msg_counter_.inc(MSG_RESPONSE_TRUNCATED);
}
}
// response TSIG
- if (msgattrs.req_is_tsig_) {
+ if (msgattrs.getRequestSigTSIG()) {
// assume response is TSIG signed if request is TSIG signed
server_msg_counter_.inc(MSG_RESPONSE_TSIG);
}
///
/// This class holds some attributes related to a DNS message
/// for statistics data collection.
-///
-/// This class does not have getter methods since it exposes private members
-/// to \c Counters directly.
class MessageAttributes {
-friend class Counters;
private:
// request attributes
int req_ip_version_; // IP version
reset();
};
+ /// \brief Get request opcode.
+ /// \return opcode of a request
+ /// \throw None
+ int getRequestOpCode() const {
+ return (req_opcode_);
+ };
+
/// \brief Set request opcode.
/// \throw None
void setRequestOpCode(const int opcode) {
req_opcode_ = opcode;
};
+ /// \brief Get IP version carrying a request.
+ /// \return IP version carrying a request
+ /// \throw None
+ int getRequestIPVersion() const {
+ return (req_ip_version_);
+ };
+
/// \brief Set IP version carrying a request.
/// \throw None
void setRequestIPVersion(const int ip_version) {
req_ip_version_ = ip_version;
};
+ /// \brief Get transport protocol carrying a request.
+ /// \return Transport protocol carrying a request
+ /// \throw None
+ int getRequestTransportProtocol() const {
+ return (req_transport_protocol_);
+ };
+
/// \brief Set transport protocol carrying a request.
/// \throw None
void setRequestTransportProtocol(const int transport_protocol) {
req_transport_protocol_ = transport_protocol;
};
+ /// \brief Get request is EDNS version 0.
+ /// \return true if EDNS version 0
+ /// \throw None
+ bool getRequestEDNS0() const {
+ return (req_is_edns_0_);
+ };
+
+ /// \brief Get request is EDNS version other than 0.
+ /// \return true if EDNS version other than 0
+ /// \throw None
+ bool getRequestEDNSBadVer() const {
+ return (req_is_edns_badver_);
+ };
+
/// \brief Set request EDNS attributes.
/// \throw None
void setRequestEDNS(const bool is_edns_0, const bool is_edns_badver) {
req_is_edns_badver_ = is_edns_badver;
};
- /// \brief Set request DO bit.
+ /// \brief Get request DNSSEC OK (DO) bit.
+ /// \return true if DNSSEC OK bit is set
+ /// \throw None
+ bool getRequestDO() const {
+ return (req_is_dnssec_ok_);
+ };
+
+ /// \brief Set request DNSSEC OK (DO) bit.
/// \throw None
void setRequestDO(const bool is_dnssec_ok) {
req_is_dnssec_ok_ = is_dnssec_ok;
};
+ /// \brief Get request TSIG signed and verified.
+ /// \return true if request is TSIG signed and verified
+ /// \throw None
+ bool getRequestSigTSIG() const {
+ return (req_is_tsig_);
+ };
+
+ /// \brief Get request SIG(0) signed and verified.
+ /// \return true if request is SIG(0) signed and verified
+ /// \throw None
+ bool getRequestSigSIG0() const {
+ return (req_is_sig0_);
+ };
+
+ /// \brief Get request signature is bad.
+ /// \return true if request signature is bad
+ /// \throw None
+ bool getRequestSigBadSig() const {
+ return (req_is_badsig_);
+ };
+
/// \brief Set request TSIG attributes.
/// \throw None
void setRequestSig(const bool is_tsig, const bool is_sig0,
req_is_badsig_ = is_badsig;
};
+ /// \brief Get if the response is truncated.
+ /// \return true if the response is truncated
+ /// \throw None
+ bool getResponseTruncated() const {
+ return (res_is_truncated_);
+ };
+
/// \brief Set if the response is truncated.
/// \throw None
void setResponseTruncated(const bool is_truncated) {