Commit 27185721 authored by Jelte Jansen's avatar Jelte Jansen

refactor: namespace changes

ISC -> isc
ISC::Data -> isc::data
ISC::CC -> isc::cc


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@407 e5f2f494-b856-4b98-b285-d166d9295462
parent f772eb96
......@@ -42,11 +42,11 @@
using namespace std;
using ISC::Data::Element;
using ISC::Data::ElementPtr;
using ISC::Data::DataDefinition;
using ISC::Data::ParseError;
using ISC::Data::DataDefinitionError;
using isc::data::Element;
using isc::data::ElementPtr;
using isc::data::DataDefinition;
using isc::data::ParseError;
using isc::data::DataDefinitionError;
void
CommandSession::read_data_definition(const std::string& filename) {
......@@ -73,11 +73,11 @@ CommandSession::read_data_definition(const std::string& filename) {
CommandSession::CommandSession(std::string module_name,
std::string spec_file_name,
ISC::Data::ElementPtr(*config_handler)(ISC::Data::ElementPtr new_config),
ISC::Data::ElementPtr(*command_handler)(ISC::Data::ElementPtr command)
isc::data::ElementPtr(*config_handler)(isc::data::ElementPtr new_config),
isc::data::ElementPtr(*command_handler)(isc::data::ElementPtr command)
) :
module_name_(module_name),
session_(ISC::CC::Session())
session_(isc::cc::Session())
{
config_handler_ = config_handler;
command_handler_ = command_handler;
......
......@@ -34,8 +34,8 @@ public:
* definition.
*/
CommandSession(std::string module_name, std::string spec_file_name,
ISC::Data::ElementPtr(*config_handler)(ISC::Data::ElementPtr new_config) = NULL,
ISC::Data::ElementPtr(*command_handler)(ISC::Data::ElementPtr command) = NULL
isc::data::ElementPtr(*config_handler)(isc::data::ElementPtr new_config) = NULL,
isc::data::ElementPtr(*command_handler)(isc::data::ElementPtr command) = NULL
);
int getSocket();
......@@ -56,7 +56,7 @@ public:
* 100000 zones, where the whole list is passed every time a single
* thing changes)
*/
void set_config_handler(ISC::Data::ElementPtr(*config_handler)(ISC::Data::ElementPtr new_config)) { config_handler_ = config_handler; };
void set_config_handler(isc::data::ElementPtr(*config_handler)(isc::data::ElementPtr new_config)) { config_handler_ = config_handler; };
/**
* Set a command handler; the function that is passed takes an
......@@ -68,18 +68,18 @@ public:
*
* This protocol is very likely to change.
*/
void set_command_handler(ISC::Data::ElementPtr(*command_handler)(ISC::Data::ElementPtr command)) { command_handler_ = command_handler; };
void set_command_handler(isc::data::ElementPtr(*command_handler)(isc::data::ElementPtr command)) { command_handler_ = command_handler; };
private:
void read_data_definition(const std::string& filename);
std::string module_name_;
ISC::CC::Session session_;
ISC::Data::DataDefinition data_definition_;
ISC::Data::ElementPtr config_;
isc::cc::Session session_;
isc::data::DataDefinition data_definition_;
isc::data::ElementPtr config_;
ISC::Data::ElementPtr(*config_handler_)(ISC::Data::ElementPtr new_config);
ISC::Data::ElementPtr(*command_handler_)(ISC::Data::ElementPtr command);
isc::data::ElementPtr(*config_handler_)(isc::data::ElementPtr new_config);
isc::data::ElementPtr(*command_handler_)(isc::data::ElementPtr command);
};
#endif // __CCSESSION_H
......
......@@ -58,13 +58,13 @@ usage() {
exit(1);
}
ISC::Data::ElementPtr
my_config_handler(ISC::Data::ElementPtr config)
isc::data::ElementPtr
my_config_handler(isc::data::ElementPtr config)
{
cout << "[XX] Handle config: " << endl << config->str() << endl;
if (config->contains("zones")) {
plot.clear_zones();
BOOST_FOREACH(ISC::Data::ElementPtr zone_el, config->get("zones")->list_value()) {
BOOST_FOREACH(isc::data::ElementPtr zone_el, config->get("zones")->list_value()) {
plot.serve(zone_el->string_value());
}
}
......@@ -74,29 +74,29 @@ my_config_handler(ISC::Data::ElementPtr config)
}
if (config->contains("a_records")) {
plot.clearARecords();
BOOST_FOREACH(ISC::Data::ElementPtr rel, config->get("a_records")->list_value()) {
BOOST_FOREACH(isc::data::ElementPtr rel, config->get("a_records")->list_value()) {
plot.addARecord(rel->string_value());
}
}
if (config->contains("aaaa_records")) {
plot.clearAAAARecords();
BOOST_FOREACH(ISC::Data::ElementPtr rel, config->get("aaaa_records")->list_value()) {
BOOST_FOREACH(isc::data::ElementPtr rel, config->get("aaaa_records")->list_value()) {
plot.addAAAARecord(rel->string_value());
}
}
if (config->contains("ns_records")) {
plot.clearNSRecords();
BOOST_FOREACH(ISC::Data::ElementPtr rel, config->get("ns_records")->list_value()) {
BOOST_FOREACH(isc::data::ElementPtr rel, config->get("ns_records")->list_value()) {
plot.addNSRecord(rel->string_value());
}
}
return ISC::Data::Element::create_from_string("{ \"result\": [0] }");
return isc::data::Element::create_from_string("{ \"result\": [0] }");
}
ISC::Data::ElementPtr
my_command_handler(ISC::Data::ElementPtr command)
isc::data::ElementPtr
my_command_handler(isc::data::ElementPtr command)
{
ISC::Data::ElementPtr answer = ISC::Data::Element::create_from_string("{ \"result\": [0] }");
isc::data::ElementPtr answer = isc::data::Element::create_from_string("{ \"result\": [0] }");
cout << "[XX] Handle command: " << endl << command->str() << endl;
if (command->get(1)->string_value() == "print_message") {
......
......@@ -40,7 +40,7 @@ using namespace std;
using namespace isc::dns;
using namespace isc::dns::Rdata::IN;
using namespace isc::dns::Rdata::Generic;
using namespace ISC::Data;
using namespace isc::data;
void
ParkingLot::addARecord(std::string data) {
......
......@@ -26,7 +26,7 @@ public:
virtual ~ParkingLot() {}
int getSocket() { return (sock); }
void processMessage();
void command(std::pair<std::string,ISC::Data::ElementPtr>);
void command(std::pair<std::string,isc::data::ElementPtr>);
void serve(std::string zone_name);
void clear_zones() { zones.clear_zones(); };
......
......@@ -10,7 +10,7 @@
#include <boost/algorithm/string.hpp>
using namespace std;
using namespace ISC::Data;
using namespace isc::data;
const unsigned char PROTOCOL_VERSION[4] = { 0x53, 0x6b, 0x61, 0x6e };
......@@ -28,7 +28,7 @@ const unsigned char ITEM_LENGTH_16 = 0x10;
const unsigned char ITEM_LENGTH_8 = 0x20;
const unsigned char ITEM_LENGTH_MASK = 0x30;
std::ostream& operator <<(std::ostream &out, const ISC::Data::ElementPtr& e) {
std::ostream& operator <<(std::ostream &out, const isc::data::ElementPtr& e) {
return out << e->str();
}
......@@ -949,7 +949,7 @@ MapElement::find(const std::string& id, ElementPtr& t) {
}
bool
ISC::Data::is_null(ElementPtr p)
isc::data::is_null(ElementPtr p)
{
return !p;
}
......
......@@ -8,7 +8,7 @@
#include <iostream>
namespace ISC { namespace Data {
namespace isc { namespace data {
// todo: include types and called function in the exception
class TypeError : public std::exception {
......@@ -282,6 +282,6 @@ namespace ISC { namespace Data {
// add a << operator for output streams so we can do
// ElementPtr foo = ...
// cout << "Element: " << foo;
std::ostream& operator <<(std::ostream &out, const ISC::Data::ElementPtr& e);
std::ostream& operator <<(std::ostream &out, const isc::data::ElementPtr& e);
#endif // _ISC_DATA_H
......@@ -7,7 +7,7 @@
// todo: add more context to thrown DataDefinitionErrors?
using namespace ISC::Data;
using namespace isc::data;
// todo: is there a direct way to get a std::string from an enum label?
static std::string
......
......@@ -5,7 +5,7 @@
#include <sstream>
namespace ISC { namespace Data {
namespace isc { namespace data {
class DataDefinitionError : public std::exception {
public:
......
......@@ -20,7 +20,7 @@
#include <data.h>
using namespace ISC::Data;
using namespace isc::data;
TEST(Element, type) {
// this tests checks whether the get_type() function returns the
......
......@@ -7,8 +7,8 @@
#include <sstream>
using namespace std;
using namespace ISC::CC;
using namespace ISC::Data;
using namespace isc::cc;
using namespace isc::data;
#include <sys/types.h>
#include <sys/socket.h>
......
......@@ -9,8 +9,8 @@
#include "data.h"
namespace ISC {
namespace CC {
namespace isc {
namespace cc {
class SessionError : public std::exception {
public:
SessionError(std::string m = "CC Session Error") : msg(m) {}
......@@ -35,28 +35,28 @@ namespace ISC {
void establish();
void disconnect();
void sendmsg(ISC::Data::ElementPtr& msg);
void sendmsg(ISC::Data::ElementPtr& env, ISC::Data::ElementPtr& msg);
bool recvmsg(ISC::Data::ElementPtr& msg,
void sendmsg(isc::data::ElementPtr& msg);
void sendmsg(isc::data::ElementPtr& env, isc::data::ElementPtr& msg);
bool recvmsg(isc::data::ElementPtr& msg,
bool nonblock = true);
bool recvmsg(ISC::Data::ElementPtr& env,
ISC::Data::ElementPtr& msg,
bool recvmsg(isc::data::ElementPtr& env,
isc::data::ElementPtr& msg,
bool nonblock = true);
void subscribe(std::string group,
std::string instance = "*");
void unsubscribe(std::string group,
std::string instance = "*");
unsigned int group_sendmsg(ISC::Data::ElementPtr msg,
unsigned int group_sendmsg(isc::data::ElementPtr msg,
std::string group,
std::string instance = "*",
std::string to = "*");
bool group_recvmsg(ISC::Data::ElementPtr& envelope,
ISC::Data::ElementPtr& msg,
bool group_recvmsg(isc::data::ElementPtr& envelope,
isc::data::ElementPtr& msg,
bool nonblock = true);
unsigned int reply(ISC::Data::ElementPtr& envelope,
ISC::Data::ElementPtr& newmsg);
unsigned int reply(isc::data::ElementPtr& envelope,
isc::data::ElementPtr& newmsg);
};
} // namespace CC
} // namespace ISC
} // namespace cc
} // namespace isc
#endif // _ISC_SESSION_H
......@@ -5,7 +5,7 @@
#include <fstream>
using namespace std;
using namespace ISC::Data;
using namespace isc::data;
int
main(int argc, char **argv) {
......
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