summaryrefslogtreecommitdiffstats
path: root/src/mad.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mad.cpp')
-rw-r--r--src/mad.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/mad.cpp b/src/mad.cpp
index bbcedcc..62b97f1 100644
--- a/src/mad.cpp
+++ b/src/mad.cpp
@@ -29,26 +29,28 @@
#include <unistd.h>
+using namespace Mad;
-void requestFinished(const Mad::Common::Request<>&) {
- Mad::Common::Logger::log("Identified.");
+
+static void requestFinished(const Mad::Common::Request<>&) {
+ Common::Logger::log("Identified.");
}
int main() {
- Mad::Common::Backends::ConsoleLogger logger;
- Mad::Common::Logger::registerLogger(&logger);
+ Common::Backends::ConsoleLogger logger;
+ Common::Logger::registerLogger(&logger);
- Mad::Net::Connection::init();
+ Net::Connection::init();
- Mad::Common::RequestManager::init(false);
- Mad::Common::RequestManager::getRequestManager()->registerPacketType<Mad::Common::RequestHandlers::StatusRequestHandler>(Mad::Net::Packet::STATUS);
+ Common::RequestManager::init(false);
+ Common::RequestManager::getRequestManager()->registerPacketType<Common::RequestHandlers::StatusRequestHandler>(Net::Packet::STATUS);
- Mad::Common::Backends::SystemBackendProc::useBackend();
+ Common::Backends::SystemBackendProc::useBackend();
- Mad::Net::ClientConnection *connection = new Mad::Net::ClientConnection;
+ Net::ClientConnection *connection = new Net::ClientConnection;
try {
- connection->connect(Mad::Net::IPAddress("127.0.0.1"), true);
+ connection->connect(Net::IPAddress("127.0.0.1"), true);
while(connection->isConnecting()) {
struct pollfd fd = connection->getPollfd();
@@ -57,12 +59,12 @@ int main() {
connection->sendReceive(fd.revents);
}
- Mad::Common::RequestManager::getRequestManager()->registerConnection(connection);
+ Common::RequestManager::getRequestManager()->registerConnection(connection);
//char hostname[256];
//gethostname(hostname, sizeof(hostname));
- //Mad::Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Mad::Common::RequestBase>(new Mad::Daemon::Requests::IdentifyRequest(hostname, sigc::ptr_fun(requestFinished))));
- Mad::Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Mad::Common::RequestBase>(new Mad::Daemon::Requests::IdentifyRequest("test", sigc::ptr_fun(requestFinished))));
+ //Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Daemon::Requests::IdentifyRequest(hostname, sigc::ptr_fun(requestFinished))));
+ Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Daemon::Requests::IdentifyRequest("test", sigc::ptr_fun(requestFinished))));
while(connection->isConnected()) {
struct pollfd fd = connection->getPollfd();
@@ -71,15 +73,15 @@ int main() {
connection->sendReceive(fd.revents);
}
- Mad::Common::RequestManager::getRequestManager()->unregisterConnection(connection);
+ Common::RequestManager::getRequestManager()->unregisterConnection(connection);
}
catch(Mad::Common::Exception &e) {
- Mad::Common::Logger::log(Mad::Common::Logger::CRITICAL, "Connection error: " + e.strerror());
+ Common::Logger::log(Common::Logger::CRITICAL, "Connection error: " + e.strerror());
}
delete connection;
- Mad::Net::Connection::deinit();
+ Net::Connection::deinit();
return 0;
}