Commit d7b6c25f authored by Jelte Jansen's avatar Jelte Jansen
Browse files

sync trac327


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac383@3326 e5f2f494-b856-4b98-b285-d166d9295462
parents ba808f12 80eda916
......@@ -78,24 +78,27 @@ public:
OutputBufferPtr buffer);
bool processNotify(const IOMessage& io_message, MessagePtr message,
OutputBufferPtr buffer);
std::string db_file_;
/// Currently non-configurable, but will be.
static const uint16_t DEFAULT_LOCAL_UDPSIZE = 4096;
/// These members are public because AuthSrv accesses them directly.
ModuleCCSession* config_session_;
bool verbose_mode_;
AbstractSession* xfrin_session_;
private:
std::string db_file_;
MetaDataSrc data_sources_;
/// We keep a pointer to the currently running sqlite datasource
/// so that we can specifically remove that one should the database
/// file change
ConstDataSrcPtr cur_datasrc_;
bool verbose_mode_;
AbstractSession* xfrin_session_;
bool xfrout_connected_;
AbstractXfroutClient& xfrout_client_;
/// Currently non-configurable, but will be.
static const uint16_t DEFAULT_LOCAL_UDPSIZE = 4096;
/// Hot spot cache
isc::datasrc::HotCache cache_;
};
......
......@@ -56,12 +56,27 @@ public:
//@}
/// \brief Process an incoming DNS message, then signal 'server' to resume
///
/// A DNS query (or other message) has been received by a \c DNSServer
/// object. Find an answer, then post the \c DNSServer object on the
/// I/O service queue and return. When the server resumes, it can
/// send the reply.
///
/// \param io_message The raw message received
/// \param message Pointer to the \c Message object
/// \param buffer Pointer to an \c OutputBuffer for the resposne
/// \param server Pointer to the \c DNSServer
void processMessage(const asiolink::IOMessage& io_message,
isc::dns::MessagePtr message,
isc::dns::OutputBufferPtr buffer,
asiolink::DNSServer* server);
// \brief Set and get verbose mode
/// \brief Set verbose flag
///
/// \param on The new value of the verbose flag
void setVerbose(bool on);
/// \brief Get the current value of the verbose flag
bool getVerbose() const;
/// \brief Set and get the config session
......
......@@ -57,6 +57,7 @@ namespace {
static bool verbose_mode = false;
// Default port current 5300 for testing purposes
static const string PROGRAM = "Auth";
static const char* DNSPORT = "5300";
......@@ -89,11 +90,13 @@ my_command_handler(const string& command, ConstElementPtr args) {
void
usage() {
cerr << "Usage: b10-auth [-a address] [-p port] [-4|-6] [-nv]" << endl;
cerr << "Usage: b10-auth [-a address] [-p port] [-u user] [-4|-6] [-nv]"
<< endl;
cerr << "\t-a: specify the address to listen on (default: all) " << endl;
cerr << "\t-p: specify the port to listen on (default: 5300)" << endl;
cerr << "\t-p: specify the port to listen on (default: " << DNSPORT << ")"
<< endl;
cerr << "\t-4: listen on all IPv4 addresses (incompatible with -a)" << endl;
cerr << "\t-4: listen on all IPv6 addresses (incompatible with -a)" << endl;
cerr << "\t-6: listen on all IPv6 addresses (incompatible with -a)" << endl;
cerr << "\t-n: do not cache answers in memory" << endl;
cerr << "\t-u: change process UID to the specified user" << endl;
cerr << "\t-v: verbose output" << endl;
......
......@@ -387,11 +387,11 @@ TEST_F(AuthSrvTest, notify) {
// An internal command message should have been created and sent to an
// external module. Check them.
EXPECT_EQ("Zonemgr", notify_session.msg_destination);
EXPECT_EQ("Zonemgr", notify_session.getMessageDest());
EXPECT_EQ("notify",
notify_session.sent_msg->get("command")->get(0)->stringValue());
notify_session.getSentMessage()->get("command")->get(0)->stringValue());
ConstElementPtr notify_args =
notify_session.sent_msg->get("command")->get(1);
notify_session.getSentMessage()->get("command")->get(1);
EXPECT_EQ("example.com.", notify_args->get("zone_name")->stringValue());
EXPECT_EQ(DEFAULT_REMOTE_ADDRESS,
notify_args->get("master")->stringValue());
......@@ -420,7 +420,7 @@ TEST_F(AuthSrvTest, notifyForCHClass) {
// Other conditions should be the same, so simply confirm the RR class is
// set correctly.
ConstElementPtr notify_args =
notify_session.sent_msg->get("command")->get(1);
notify_session.getSentMessage()->get("command")->get(1);
EXPECT_EQ("CH", notify_args->get("zone_class")->stringValue());
}
......
......@@ -45,8 +45,8 @@ public:
"mock session send is disabled for test");
}
sent_msg = msg;
msg_destination = group;
sent_msg_ = msg;
msg_dest_ = group;
return (0);
}
......@@ -83,13 +83,17 @@ public:
virtual void setTimeout(size_t timeout UNUSED_PARAM) {};
virtual size_t getTimeout() const { return 0; };
// The following methods extent AbstractSession to allow testing:
void setMessage(isc::data::ConstElementPtr msg) { msg_ = msg; }
void disableSend() { send_ok_ = false; }
void disableReceive() { receive_ok_ = false; }
isc::data::ConstElementPtr sent_msg;
std::string msg_destination;
isc::data::ConstElementPtr getSentMessage() { return (sent_msg_); }
std::string getMessageDest() { return (msg_dest_); }
private:
isc::data::ConstElementPtr sent_msg_;
std::string msg_dest_;
isc::data::ConstElementPtr msg_;
bool send_ok_;
bool receive_ok_;
......
......@@ -59,6 +59,7 @@ namespace {
static bool verbose_mode = false;
// Default port current 5300 for testing purposes
static const string PROGRAM = "Recurse";
static const char* DNSPORT = "5300";
......@@ -87,14 +88,15 @@ my_command_handler(const string& command, ConstElementPtr args) {
void
usage() {
cerr << "Usage: b10-recurse -f nameserver [-a address] [-p port] "
cerr << "Usage: b10-recurse -f nameserver [-a address] [-p port] [-u user]"
"[-4|-6] [-v]" << endl;
cerr << "\t-f: specify the nameserver to which queries should be forwarded"
<< endl;
cerr << "\t-a: specify the address to listen on (default: all)" << endl;
cerr << "\t-p: specify the port to listen on (default: 5300)" << endl;
cerr << "\t-p: specify the port to listen on (default: " << DNSPORT << ")"
<< endl;
cerr << "\t-4: listen on all IPv4 addresses (incompatible with -a)" << endl;
cerr << "\t-4: listen on all IPv6 addresses (incompatible with -a)" << endl;
cerr << "\t-6: listen on all IPv6 addresses (incompatible with -a)" << endl;
cerr << "\t-u: change process UID to the specified user" << endl;
cerr << "\t-v: verbose output" << endl;
exit(1);
......
......@@ -86,18 +86,19 @@ public:
OutputBufferPtr buffer,
DNSServer* server);
ModuleCCSession* config_session_;
/// Currently non-configurable, but will be.
static const uint16_t DEFAULT_LOCAL_UDPSIZE = 4096;
/// These members are public because Recursor accesses them directly.
ModuleCCSession* config_session_;
bool verbose_mode_;
private:
/// Address of the forward nameserver
const char& forward_;
/// Object to handle upstream queries
RecursiveQuery* rec_query_;
/// Currently non-configurable, but will be.
static const uint16_t DEFAULT_LOCAL_UDPSIZE = 4096;
};
class QuestionInserter {
......
......@@ -48,13 +48,27 @@ public:
//@}
/// \brief Process an incoming DNS message, then signal 'server' to resume
///
/// A DNS query (or other message) has been received by a \c DNSServer
/// object. Find an answer, then post the \c DNSServer object on the
/// I/O service queue and return. When the server resumes, it can
/// send the reply.
///
/// \param io_message The raw message received
/// \param message Pointer to the \c Message object
/// \param buffer Pointer to an \c OutputBuffer for the resposne
/// \param server Pointer to the \c DNSServer
void processMessage(const asiolink::IOMessage& io_message,
isc::dns::MessagePtr message,
isc::dns::OutputBufferPtr buffer,
asiolink::DNSServer* server);
// \brief Set and get verbose mode
/// \brief Set verbose flag
///
/// \param on The new value of the verbose flag
void setVerbose(bool on);
/// \brief Get the current value of the verbose flag
bool getVerbose() const;
/// \brief Set and get the config session
......
......@@ -35,24 +35,12 @@ endif
noinst_PROGRAMS = $(TESTS)
EXTRA_DIST = testdata/badExampleQuery_fromWire
EXTRA_DIST += testdata/badExampleQuery_fromWire.spec
EXTRA_DIST += testdata/example.com
EXTRA_DIST += testdata/examplequery_fromWire
EXTRA_DIST += testdata/examplequery_fromWire.spec
EXTRA_DIST += testdata/example.sqlite3
EXTRA_DIST += testdata/iqueryresponse_fromWire
EXTRA_DIST += testdata/iqueryresponse_fromWire.spec
EXTRA_DIST = testdata/iqueryresponse_fromWire
EXTRA_DIST += testdata/multiquestion_fromWire
EXTRA_DIST += testdata/multiquestion_fromWire.spec
EXTRA_DIST += testdata/queryBadEDNS_fromWire
EXTRA_DIST += testdata/queryBadEDNS_fromWire.spec
EXTRA_DIST += testdata/shortanswer_fromWire
EXTRA_DIST += testdata/shortanswer_fromWire.spec
EXTRA_DIST += testdata/shortmessage_fromWire
EXTRA_DIST += testdata/shortquestion_fromWire
EXTRA_DIST += testdata/shortresponse_fromWire
EXTRA_DIST += testdata/simplequery_fromWire
EXTRA_DIST += testdata/simplequery_fromWire.spec
EXTRA_DIST += testdata/simpleresponse_fromWire
EXTRA_DIST += testdata/simpleresponse_fromWire.spec
......@@ -12,11 +12,12 @@ CLEANFILES = *.gcno *.gcda
# which would make the build fail with -Werror (our default setting).
lib_LTLIBRARIES = libasiolink.la
libasiolink_la_SOURCES = asiolink.cc asiolink.h
libasiolink_la_SOURCES += iosocket.h
libasiolink_la_SOURCES += iosocket.h iomessage.h
libasiolink_la_SOURCES += ioaddress.cc ioaddress.h
libasiolink_la_SOURCES += ioendpoint.cc ioendpoint.h
libasiolink_la_SOURCES += udpdns.cc internal/udpdns.h
libasiolink_la_SOURCES += tcpdns.cc internal/tcpdns.h
libasiolink_la_SOURCES += internal/coroutine.h
# Note: the ordering matters: -Wno-... must follow -Wextra (defined in
# B10_CXXFLAGS)
libasiolink_la_CXXFLAGS = $(AM_CXXFLAGS)
......
......@@ -73,7 +73,7 @@ public:
/// and if it fails the corresponding standard exception will be thrown.
///
/// \return A string representation of the address.
std::string toText() const;
virtual std::string toText() const;
/// \brief Returns the address family.
virtual short getFamily() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment