(based on the seeming intent), indentation.
const isc::asiolink::SimpleCallback* checkin = NULL,
const DNSLookup* lookup = NULL,
const DNSAnswer* answer = NULL);
+
/// \brief Constructor
/// \param io_service the asio::io_service to work with
- /// \param fd the file descriptor of opened UDP socket
+ /// \param fd the file descriptor of opened TCP socket
/// \param v6 the socket in fd is ipv6 one (if false, it is ipv4)
/// \param checkin the callbackprovider for non-DNS events
/// \param lookup the callbackprovider for DNS lookup events
using namespace asio;
namespace {
-const char* server_ip = "::1";
+const char* const server_ip = "::1";
const int server_port = 5553;
-const char* server_port_str = "5553";
+const char* const server_port_str = "5553";
//message client send to udp server, which isn't dns package
//just for simple testing
-const std::string query_message("BIND10 is awesome");
+const char* const query_message = "BIND10 is awesome";
// \brief provide capacity to derived class the ability
// to stop DNSServer at certern point
class UDPClient : public SimpleClient {
public:
- //After 1 seconds without feedback client will stop wait
+ //After 1 second without feedback client will stop wait
static const unsigned int server_time_out = 1;
UDPClient(asio::io_service& service, const ip::udp::endpoint& server) :
uint16_t data_to_send_len_;
};
-// \brief provide the context which including two client and
-// two server, udp client will only communicate with udp server, same for tcp client
+// \brief provide the context which including two clients and
+// two servers, UDP client will only communicate with UDP server, same for TCP
+// client
//
-// This is only the active part of the test. We run the test case twice, once for each
-// type of initialization (once when giving it the address and port, once when giving
-// the file descriptor), to ensure it works both ways exactly the same.
+// This is only the active part of the test. We run the test case twice, once
+// for each type of initialization (once when giving it the address and port,
+// once when giving the file descriptor), to ensure it works both ways exactly
+// the same.
class DNSServerTestBase : public::testing::Test {
protected:
void TearDown() {
stopper->setServerToStop(server);
(*server)();
client->sendDataThenWaitForFeedback(query_message);
- // Since thread hasn't been introduced into the tool box, using signal
- // to make sure run function will eventually return even server stop
- // failed
+ // Since thread hasn't been introduced into the tool box, using
+ // signal to make sure run function will eventually return even
+ // server stop failed
void (*prev_handler)(int) =
std::signal(SIGALRM, DNSServerTestBase::stopIOService);
alarm(io_service_time_out);
/// The constructor. It just creates new internal state object
/// and lets it handle the initialization.
UDPServer::UDPServer(io_service& io_service, const ip::address& addr,
- const uint16_t port, SimpleCallback* checkin, DNSLookup* lookup,
- DNSAnswer* answer) :
+ const uint16_t port, SimpleCallback* checkin,
+ DNSLookup* lookup, DNSAnswer* answer) :
data_(new Data(io_service, addr, port, checkin, lookup, answer))
{ }
UDPServer::UDPServer(io_service& io_service, int fd, bool v6,
- SimpleCallback* checkin, DNSLookup* lookup, DNSAnswer* answer) :
+ SimpleCallback* checkin, DNSLookup* lookup,
+ DNSAnswer* answer) :
data_(new Data(io_service, fd, v6, checkin, lookup, answer))
{ }
isc::asiolink::SimpleCallback* checkin = NULL,
DNSLookup* lookup = NULL,
DNSAnswer* answer = NULL);
+
/// \brief Constructor
/// \param io_service the asio::io_service to work with
/// \param fd the file descriptor of opened UDP socket
/// \param lookup the callbackprovider for DNS lookup events
/// \param answer the callbackprovider for DNS answer events
UDPServer(asio::io_service& io_service, int fd, bool v6,
- isc::asiolink::SimpleCallback* checkin = NULL,
- DNSLookup* lookup = NULL, DNSAnswer* answer = NULL);
+ isc::asiolink::SimpleCallback* checkin = NULL,
+ DNSLookup* lookup = NULL, DNSAnswer* answer = NULL);
/// \brief The function operator
void operator()(asio::error_code ec = asio::error_code(),