void
checkRR(dns::RRsetPtr rrset, const std::string& exp_name,
- const dns::RRClass& exp_class, const dns::RRType& exp_type,
- unsigned int exp_ttl, dhcp_ddns::NameChangeRequestPtr ncr,
- bool has_rdata) {
+ const dns::RRClass& exp_class, const dns::RRType& exp_type,
+ unsigned int exp_ttl, dhcp_ddns::NameChangeRequestPtr ncr,
+ bool has_rdata) {
// Verify the FQDN/DHCID RR fields.
EXPECT_EQ(exp_name, rrset->getName().toText());
EXPECT_EQ(exp_class.getCode(), rrset->getClass().getCode());
(exp_type == dns::RRType::AAAA())) {
// should have lease rdata
EXPECT_EQ(ncr->getIpAddress(), rdata_it->getCurrent().toText());
- } else if (exp_type == dns::RRType::PTR()) {
+ } else if (exp_type == dns::RRType::PTR()) {
// should have PTR rdata
EXPECT_EQ(ncr->getFqdn(), rdata_it->getCurrent().toText());
} else if (exp_type == dns::RRType::DHCID()) {
return (*rrset_it);
}
-dhcp_ddns::NameChangeRequestPtr makeNcrFromString(const std::string& ncr_str) {
+dhcp_ddns::NameChangeRequestPtr
+makeNcrFromString(const std::string& ncr_str) {
return (dhcp_ddns::NameChangeRequest::fromJSON(ncr_str));
}
-DdnsDomainPtr makeDomain(const std::string& zone_name,
- const std::string& key_name) {
+DdnsDomainPtr
+makeDomain(const std::string& zone_name, const std::string& key_name) {
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
DdnsDomainPtr domain(new DdnsDomain(zone_name, servers, key_name));
return (domain);
}
-DdnsDomainPtr makeDomain(const std::string& zone_name,
- const TSIGKeyInfoPtr &tsig_key_info) {
+DdnsDomainPtr
+makeDomain(const std::string& zone_name, const TSIGKeyInfoPtr &tsig_key_info) {
DdnsDomainPtr domain;
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
std::string key_name;
return (domain);
}
-TSIGKeyInfoPtr makeTSIGKeyInfo(const std::string& key_name,
- const std::string& secret,
- const std::string& algorithm) {
+TSIGKeyInfoPtr
+makeTSIGKeyInfo(const std::string& key_name, const std::string& secret,
+ const std::string& algorithm) {
TSIGKeyInfoPtr key_info;
if (!key_name.empty()) {
if (!secret.empty()) {
}
return (key_info);
-
}
-void addDomainServer(DdnsDomainPtr& domain, const std::string& name,
- const std::string& ip, const size_t port,
- const TSIGKeyInfoPtr &tsig_key_info) {
+void
+addDomainServer(DdnsDomainPtr& domain, const std::string& name,
+ const std::string& ip, const size_t port,
+ const TSIGKeyInfoPtr &tsig_key_info) {
DnsServerInfoPtr server(new DnsServerInfo(name, asiolink::IOAddress(ip),
port, true, tsig_key_info));
domain->getServers()->push_back(server);
}
-// Verifies that the contents of the given transaction's DNS update request
+// Verifies that the contents of the given transaction's DNS update request
// is correct for adding a forward DNS entry
-void checkAddFwdAddressRequest(NameChangeTransaction& tran) {
+void
+checkAddFwdAddressRequest(NameChangeTransaction& tran) {
const D2UpdateMessagePtr& request = tran.getDnsUpdateRequest();
ASSERT_TRUE(request);
ASSERT_NO_THROW(request->toWire(renderer));
}
-// Verifies that the contents of the given transaction's DNS update request
+// Verifies that the contents of the given transaction's DNS update request
// is correct for replacing a forward DNS entry
-void checkReplaceFwdAddressRequest(NameChangeTransaction& tran) {
+void
+checkReplaceFwdAddressRequest(NameChangeTransaction& tran) {
const D2UpdateMessagePtr& request = tran.getDnsUpdateRequest();
ASSERT_TRUE(request);
ASSERT_NO_THROW(request->toWire(renderer));
}
-// Verifies that the contents of the given transaction's DNS update request
+// Verifies that the contents of the given transaction's DNS update request
// is correct for replacing a reverse DNS entry
-void checkReplaceRevPtrsRequest(NameChangeTransaction& tran) {
+void
+checkReplaceRevPtrsRequest(NameChangeTransaction& tran) {
const D2UpdateMessagePtr& request = tran.getDnsUpdateRequest();
ASSERT_TRUE(request);
ASSERT_NO_THROW(request->toWire(renderer));
}
-void checkRemoveFwdAddressRequest(NameChangeTransaction& tran) {
+void
+checkRemoveFwdAddressRequest(NameChangeTransaction& tran) {
const D2UpdateMessagePtr& request = tran.getDnsUpdateRequest();
ASSERT_TRUE(request);
ASSERT_NO_THROW(request->toWire(renderer));
}
-void checkRemoveFwdRRsRequest(NameChangeTransaction& tran) {
+void
+checkRemoveFwdRRsRequest(NameChangeTransaction& tran) {
const D2UpdateMessagePtr& request = tran.getDnsUpdateRequest();
ASSERT_TRUE(request);
ASSERT_NO_THROW(request->toWire(renderer));
}
-void checkRemoveRevPtrsRequest(NameChangeTransaction& tran) {
+void
+checkRemoveRevPtrsRequest(NameChangeTransaction& tran) {
const D2UpdateMessagePtr& request = tran.getDnsUpdateRequest();
ASSERT_TRUE(request);
ASSERT_NO_THROW(request->toWire(renderer));
}
-std::string toHexText(const uint8_t* data, size_t len) {
+std::string
+toHexText(const uint8_t* data, size_t len) {
std::ostringstream stream;
stream << "Data length is: " << len << std::endl;
for (int i = 0; i < len; ++i) {
return (stream.str());
}
-// Verifies that the contents of the given transaction's DNS update request
+// Verifies that the contents of the given transaction's DNS update request
// is correct for replacing a forward DNS entry when not using conflict
// resolution.
-void checkSimpleReplaceFwdAddressRequest(NameChangeTransaction& tran) {
+void
+checkSimpleReplaceFwdAddressRequest(NameChangeTransaction& tran) {
const D2UpdateMessagePtr& request = tran.getDnsUpdateRequest();
ASSERT_TRUE(request);
ASSERT_NO_THROW(request->toWire(renderer));
}
-void checkSimpleRemoveFwdRRsRequest(NameChangeTransaction& tran) {
+void
+checkSimpleRemoveFwdRRsRequest(NameChangeTransaction& tran) {
const D2UpdateMessagePtr& request = tran.getDnsUpdateRequest();
ASSERT_TRUE(request);
ASSERT_NO_THROW(request->toWire(renderer));
}
-// Verifies that the contents of the given transaction's DNS update request
+// Verifies that the contents of the given transaction's DNS update request
// is correct for removing a reverse DNS entry when not using conflict
// resolution.
-void checkSimpleRemoveRevPtrsRequest(NameChangeTransaction& tran) {
+void
+checkSimpleRemoveRevPtrsRequest(NameChangeTransaction& tran) {
const D2UpdateMessagePtr& request = tran.getDnsUpdateRequest();
ASSERT_TRUE(request);
}
// Verifies the current state and next event in a transaction
-void checkContext(NameChangeTransactionPtr trans, const int exp_state,
- const int exp_evt, const std::string& file, int line) {
+void
+checkContext(NameChangeTransactionPtr trans, const int exp_state,
+ const int exp_evt, const std::string& file, int line) {
ASSERT_TRUE(trans);
ASSERT_TRUE(exp_state == trans->getCurrState() && exp_evt == trans->getNextEvent())
<< "expected state: " << trans->getStateLabel(exp_state)
/// requests in a given manner.
class FauxServer {
public:
- enum ResponseMode {
+ /// @brief The types of response generated by the server.
+ enum ResponseMode {
USE_RCODE, // Generate a response with a given RCODE
CORRUPT_RESP, // Generate a corrupt response
INVALID_TSIG // Generate a response with the wrong TSIG key
};
- // Reference to IOService to use for IO processing.
+ /// @brief Reference to IOService to use for IO processing.
asiolink::IOService& io_service_;
- // IP address at which to listen for requests.
+
+ /// @brief IP address at which to listen for requests.
const asiolink::IOAddress& address_;
- // Port on which to listen for requests.
+
+ /// @brief Port on which to listen for requests.
size_t port_;
- // Socket on which listening is done.
+
+ /// @brief Socket on which listening is done.
SocketPtr server_socket_;
- // Stores the end point of requesting client.
+
+ /// @brief Stores the end point of requesting client.
boost::asio::ip::udp::endpoint remote_;
- // Buffer in which received packets are stuffed.
+
+ /// @brief Buffer in which received packets are stuffed.
uint8_t receive_buffer_[TEST_MSG_MAX];
- // Flag which indicates if a receive has been initiated but
- // not yet completed.
+
+ /// @brief Flag which indicates if a receive has been initiated but not yet
+ /// completed.
bool receive_pending_;
- // Indicates if server is in perpetual receive mode. If true once
- // a receive has been completed, a new one will be automatically
- // initiated.
+ /// @brief Flag which indicates if server is in perpetual receive mode.
+ /// If true once a receive has been completed, a new one will be
+ /// automatically initiated.
bool perpetual_receive_;
- // TSIG Key to use to verify requests and sign responses. If its
- // NULL TSIG is not used.
+
+ /// @brief TSIG Key to use to verify requests and sign responses. If it is
+ /// NULL TSIG is not used.
D2TsigKeyPtr tsig_key_;
/// @brief Constructor
asiolink::IntervalTimer timer_;
int run_time_;
- // Constructor
+ /// @brief Constructor
TimedIO();
- // Destructor
+ /// @brief Destructor
virtual ~TimedIO();
/// @brief IO Timer expiration handler
DdnsDomainPtr reverse_domain_;
D2CfgMgrPtr cfg_mgr_;
- /// #brief constants used to specify change directions for a transaction.
+ /// @brief constants used to specify change directions for a transaction.
static const unsigned int FORWARD_CHG; // Only forward change.
static const unsigned int REVERSE_CHG; // Only reverse change.
static const unsigned int FWD_AND_REV_CHG; // Both forward and reverse.
/// be used.
void setupForIPv6Transaction(dhcp_ddns::NameChangeType change_type,
int change_mask, const std::string& key_name);
-
};
/// @brief Macro for calling checkContext() that supplies invocation location
#define CHECK_CONTEXT(a,b,c) checkContext(a,b,c,__FILE__,__LINE__)
-
} // namespace isc::d2
} // namespace isc