MESSAGE(STATUS "Generating makefile for the Client...")
FILE(GLOB project_SRCS *.cpp *.hpp *.h)
-FILE(GLOB common_SRCS ${COMMON_FOLDER}/epoll/*.hpp ${COMMON_FOLDER}/epoll/*.cpp
+FILE(GLOB common_SRCS ${COMMON_FOLDER}/ipc/epoll/*.hpp ${COMMON_FOLDER}/ipc/epoll/*.cpp
${COMMON_FOLDER}/ipc/*.hpp ${COMMON_FOLDER}/ipc/*.cpp
${COMMON_FOLDER}/ipc/internals/*.hpp ${COMMON_FOLDER}/ipc/internals/*.cpp
${COMMON_FOLDER}/utils/*.hpp ${COMMON_FOLDER}/utils/*.cpp
mClient.reset(new ipc::Client(mDispatcher.getPoll(), HOST_IPC_SOCKET));
mClient->start();
}
-epoll::ThreadDispatcher& HostIPCConnection::getDispatcher()
+ipc::epoll::ThreadDispatcher& HostIPCConnection::getDispatcher()
{
return mDispatcher;
}
#define VASUM_CLIENT_HOST_IPC_CONNECTION_HPP
#include <api/messages.hpp>
-#include <epoll/thread-dispatcher.hpp>
+#include <ipc/epoll/thread-dispatcher.hpp>
#include <ipc/client.hpp>
#include <functional>
typedef std::function<void(const vasum::api::Notification&)> NotificationCallback;
void createSystem();
void create(const std::string& address);
- epoll::ThreadDispatcher& getDispatcher();
+ ipc::epoll::ThreadDispatcher& getDispatcher();
void callGetZoneIds(vasum::api::ZoneIds& argOut);
void callGetActiveZoneId(vasum::api::ZoneId& argOut);
void unsubscribe(const SubscriptionId& id);
private:
- epoll::ThreadDispatcher mDispatcher;
+ ipc::epoll::ThreadDispatcher mDispatcher;
std::unique_ptr<ipc::Client> mClient;
};
#include "vasum-client-impl.hpp"
#include "utils.hpp"
#include "exception.hpp"
+#include "utils/exception.hpp"
#include "host-ipc-connection.hpp"
#include "logger/logger.hpp"
#include <boost/algorithm/string/classification.hpp>
using namespace std;
+using namespace utils;
using namespace vasum;
namespace {
});
}
-epoll::EventPoll& Client::getEventPoll() noexcept
+ipc::epoll::EventPoll& Client::getEventPoll() noexcept
{
return mHostClient.getDispatcher().getPoll();
}
*/
VsmStatus createSystem() noexcept;
- vasum::epoll::EventPoll& getEventPoll() noexcept;
+ ipc::epoll::EventPoll& getEventPoll() noexcept;
/**
* Create client.
VasumException(const std::string& error) : std::runtime_error(error) {}
};
-/**
- * Return string describing error number
- * it is wrapper for strerror_r
- */
-std::string getSystemErrorMessage();
-std::string getSystemErrorMessage(int err);
-
} // namespace vasum
#include "ipc/internals/socket.hpp"
#include "ipc/exception.hpp"
-namespace vasum {
namespace ipc {
Client::Client(epoll::EventPoll& eventPoll, const std::string& socketPath)
}
} // namespace ipc
-} // namespace vasum
#include <string>
-namespace vasum {
namespace ipc {
/**
}
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_CLIENT_HPP
*/
#include "config.hpp"
-#include "epoll/event-poll.hpp"
+#include "ipc/epoll/event-poll.hpp"
#include "utils/fd-utils.hpp"
#include "utils/exception.hpp"
#include "logger/logger.hpp"
#include <string.h>
#include <assert.h>
-namespace vasum {
+using namespace vasum;
+using namespace utils;
+
+namespace ipc {
namespace epoll {
EventPoll::EventPoll()
}
} // namespace epoll
-} // namespace vasum
+} // namespace ipc
#ifndef COMMON_EPOLL_EVENT_POLL_HPP
#define COMMON_EPOLL_EVENT_POLL_HPP
-#include "epoll/events.hpp"
+#include "ipc/epoll/events.hpp"
#include <functional>
#include <mutex>
#include <unordered_map>
#include <memory>
-namespace vasum {
+namespace ipc {
namespace epoll {
class EventPoll {
} // namespace epoll
-} // namespace vasum
+} // namespace ipc
#endif // COMMON_EPOLL_EVENT_POLL_HPP
*/
#include "config.hpp"
-#include "epoll/events.hpp"
+#include "ipc/epoll/events.hpp"
#include <sstream>
-namespace vasum {
+namespace ipc {
namespace epoll {
namespace {
}
} // namespace epoll
-} // namespace vasum
+} // namespace ipc
#include <string>
#include <sys/epoll.h> // for EPOLL* constatnts
-namespace vasum {
+namespace ipc {
namespace epoll {
typedef unsigned int Events; ///< bitmask of EPOLL* constants
std::string eventsToString(Events events);
} // namespace epoll
-} // namespace vasum
+} // namespace ipc
#endif // COMMON_EPOLL_EVENTS_HPP
*/
#include "config.hpp"
-#include "epoll/glib-dispatcher.hpp"
+#include "ipc/epoll/glib-dispatcher.hpp"
#include "utils/callback-wrapper.hpp"
-namespace vasum {
+namespace ipc {
namespace epoll {
GlibDispatcher::GlibDispatcher()
}
} // namespace epoll
-} // namespace vasum
+} // namespace ipc
#ifndef COMMON_EPOLL_GLIB_DISPATCHER_HPP
#define COMMON_EPOLL_GLIB_DISPATCHER_HPP
-#include "epoll/event-poll.hpp"
+#include "ipc/epoll/event-poll.hpp"
#include "utils/callback-guard.hpp"
#include <gio/gio.h>
-namespace vasum {
+namespace ipc {
namespace epoll {
/**
} // namespace epoll
-} // namespace vasum
+} // namespace ipc
#endif // COMMON_UTILS_GLIB_DISPATCHER_HPP
*/
#include "config.hpp"
-#include "epoll/thread-dispatcher.hpp"
+#include "ipc/epoll/thread-dispatcher.hpp"
-namespace vasum {
+namespace ipc {
namespace epoll {
ThreadDispatcher::ThreadDispatcher()
}
} // namespace epoll
-} // namespace vasum
+} // namespace ipc
#ifndef COMMON_EPOLL_THREAD_DISPATCHER_HPP
#define COMMON_EPOLL_THREAD_DISPATCHER_HPP
-#include "epoll/event-poll.hpp"
+#include "ipc/epoll/event-poll.hpp"
#include "utils/eventfd.hpp"
#include <thread>
#include <atomic>
-namespace vasum {
+namespace ipc {
namespace epoll {
/**
};
} // namespace epoll
-} // namespace vasum
+} // namespace ipc
#endif // COMMON_EPOLL_THREAD_DISPATCHER_HPP
#include "base-exception.hpp"
-namespace vasum {
namespace ipc {
/**
* Base class for exceptions in IPC
*/
-struct IPCException: public VasumException {
+struct IPCException: public vasum::VasumException {
IPCException(const std::string& message)
: VasumException(message) {}
};
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_EXCEPTION_HPP
#include "ipc/internals/acceptor.hpp"
#include "logger/logger.hpp"
-namespace vasum {
namespace ipc {
Acceptor::Acceptor(const std::string& socketPath, const NewConnectionCallback& newConnectionCallback)
}
} // namespace ipc
-} // namespace vasum
#include <string>
-namespace vasum {
namespace ipc {
/**
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_ACCEPTOR_HPP
#include "ipc/types.hpp"
#include "ipc/internals/socket.hpp"
-namespace vasum {
namespace ipc {
class AddPeerRequest {
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_ADD_PEER_REQUEST_HPP
#include <mutex>
#include <queue>
-namespace vasum {
namespace ipc {
}
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_EVENT_QUEUE_HPP
#include <condition_variable>
-namespace vasum {
namespace ipc {
class FinishRequest {
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_FINISH_REQUEST_HPP
#include "config/manager.hpp"
#include <utility>
-namespace vasum {
namespace ipc {
class MethodRequest {
}
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_METHOD_REQUEST_HPP
#include <sys/socket.h>
#include <limits>
-namespace vasum {
+using namespace utils;
+
namespace ipc {
#define IGNORE_EXCEPTIONS(expr) \
}
} // namespace ipc
-} // namespace vasum
#include <unordered_map>
#include <utility>
-namespace vasum {
namespace ipc {
const unsigned int DEFAULT_MAX_NUMBER_OF_PEERS = 500;
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_PROCESSOR_HPP
#include <condition_variable>
-namespace vasum {
namespace ipc {
class RemovePeerRequest {
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_REMOVE_PEER_REQUEST_HPP
#include <mutex>
#include <algorithm>
-namespace vasum {
namespace ipc {
/**
return true;
}
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_MESSAGE_QUEUE_HPP
#include <exception>
#include <memory>
-namespace vasum {
namespace ipc {
class ResultBuilder {
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_RESULT_BUILDER_HPP
#include "ipc/types.hpp"
#include "logger/logger-scope.hpp"
-namespace vasum {
namespace ipc {
class SendResultRequest {
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_SEND_RESULT_REQUEST_HPP
#include "config/manager.hpp"
#include "logger/logger-scope.hpp"
-namespace vasum {
namespace ipc {
class SignalRequest {
}
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_SIGNAL_REQUEST_HPP
#include "ipc/exception.hpp"
#include "ipc/internals/socket.hpp"
#include "utils/fd-utils.hpp"
+#include "utils/exception.hpp"
#include "logger/logger.hpp"
#include <systemd/sd-daemon.h>
#include <cerrno>
#include <cstring>
+using namespace utils;
-namespace vasum {
namespace ipc {
namespace {
}
} // namespace ipc
-} // namespace vasum
#include <mutex>
#include <memory>
-namespace vasum {
namespace ipc {
/**
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_INTERNALS_SOCKET_HPP
#include <algorithm>
-namespace vasum {
namespace ipc {
namespace {
}
} // namespace ipc
-} // namespace vasum
#include <list>
-namespace vasum {
namespace ipc {
/**
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_IPC_GSOURCE_HPP
#include "ipc/method-result.hpp"
#include "ipc/internals/processor.hpp"
-namespace vasum {
namespace ipc {
MethodResult::MethodResult(Processor& processor,
}
} // namespace ipc
-} // namespace vasum
#include "logger/logger.hpp"
#include <memory>
-namespace vasum {
namespace ipc {
class Processor;
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_METHOD_RESULT_HPP
#include <exception>
#include <memory>
-namespace vasum {
namespace ipc {
template<typename Data>
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_RESULT_HPP
using namespace std::placeholders;
-namespace vasum {
namespace ipc {
Service::Service(epoll::EventPoll& eventPoll,
} // namespace ipc
-} // namespace vasum
#include <string>
-namespace vasum {
namespace ipc {
}
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_SERVICE_HPP
#include <atomic>
-namespace vasum {
namespace ipc {
namespace {
} // namespace ipc
-} // namespace vasum
#include <memory>
#include <string>
-namespace vasum {
namespace ipc {
typedef int FileDescriptor;
};
} // namespace ipc
-} // namespace vasum
#endif // COMMON_IPC_TYPES_HPP
#include "config.hpp"
#include "netlink.hpp"
#include "utils.hpp"
-#include "base-exception.hpp"
+#include "utils/exception.hpp"
#include "utils/make-clean.hpp"
#include "utils/environment.hpp"
#define PAGE_SIZE 4096
#endif
+using namespace utils;
using namespace vasum;
namespace {
#include <vector>
-namespace vasum {
namespace utils {
template<typename T>
typedef CArrayBuilder<const char*> CStringArrayBuilder;
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_C_ARRAY_HPP
#include <cassert>
-namespace vasum {
namespace utils {
// Reference counting class like shared_ptr but with the ability to wait for it.
}
} // namespace utils
-} // namespace vasum
#include <memory>
-namespace vasum {
namespace utils {
/**
};
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_CALLBACK_GUARD_HPP
#include "callback-guard.hpp"
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_CALLBACK_WRAPPER_HPP
#include <unordered_map>
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_COUNTING_MAP_HPP
#include "utils/environment.hpp"
#include "utils/execute.hpp"
+#include "utils/exception.hpp"
#include "utils/make-clean.hpp"
#include "base-exception.hpp"
#include "logger/logger.hpp"
#endif
-using namespace vasum::utils;
+using namespace utils;
namespace {
} // namespace
-namespace vasum {
namespace utils {
int fds[2];
int ret = socketpair(PF_LOCAL, SOCK_RAW, 0, fds);
if (ret == -1) {
- LOGE("Can't create socket pair: " << vasum::getSystemErrorMessage());
+ LOGE("Can't create socket pair: " << getSystemErrorMessage());
return -1;
}
bool success = executeAndWait([&, fds, nsPid, ns]() {
}
} // namespace utils
-} // namespace vasum
#include <sys/types.h>
-namespace vasum {
namespace utils {
int passNemaspacedFd(int nsPid, int ns, const std::function<int()>& fdFactory);
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_ENVIRONMENT_HPP
#include <cstring>
#include <cstdint>
-namespace vasum {
+using namespace vasum;
+
namespace utils {
EventFD::EventFD()
} // namespace utils
-} // namespace vasum
#ifndef COMMON_UTILS_EVENTFD_HPP
#define COMMON_UTILS_EVENTFD_HPP
-namespace vasum {
namespace utils {
class EventFD {
};
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_EVENTFD_HPP
/**
* @file
* @author Mateusz Malicki (m.malicki2@samsung.com)
- * @brief Vasum base exception implementation
+ * @brief Utils base exception helper implementation
*/
-#include "base-exception.hpp"
+#include "utils/exception.hpp"
#include <string>
#include <cstring>
#include <cerrno>
-namespace vasum {
+namespace utils {
const int ERROR_MESSAGE_BUFFER_CAPACITY = 256;
return strerror_r(err, buf, sizeof(buf));
}
-} // namespace vasum
+} // namespace utils
#include "base-exception.hpp"
-namespace vasum {
+namespace utils {
/**
* Base class for exceptions in utils
*/
-struct UtilsException: public VasumException {
+struct UtilsException: public vasum::VasumException {
- UtilsException(const std::string& error) : VasumException(error) {}
+ UtilsException(const std::string& error) : vasum::VasumException(error) {}
};
+/**
+ * Return string describing error number
+ * it is wrapper for strerror_r
+ */
+std::string getSystemErrorMessage();
+std::string getSystemErrorMessage(int err);
-} // namespace vasum
+} // namespace utils
#endif // COMMON_UTILS_EXCEPTION_HPP
*/
#include "config.hpp"
-#include "base-exception.hpp"
+#include "utils/exception.hpp"
#include "utils/execute.hpp"
#include "logger/logger.hpp"
#include <unistd.h>
#include <sys/wait.h>
-namespace vasum {
namespace utils {
namespace {
pid_t pid = fork();
if (pid == -1) {
- LOGE("Fork failed: " << vasum::getSystemErrorMessage());
+ LOGE("Fork failed: " << getSystemErrorMessage());
return false;
}
if (pid == 0) {
}
} // namespace utils
-} // namespace vasum
#include <sys/types.h>
#include <functional>
-namespace vasum {
namespace utils {
/**
bool waitPid(pid_t pid, int& status);
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_EXECUTE_HPP
namespace fs = boost::filesystem;
namespace chr = std::chrono;
-namespace vasum {
+using namespace vasum;
+
namespace utils {
namespace {
}
} // namespace utils
-} // namespace vasum
#include <cstddef>
-namespace vasum {
namespace utils {
/**
unsigned int getFDNumber();
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_FD_HPP
#include <unistd.h>
#include <stdexcept>
+using namespace vasum;
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#include <string>
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_FILE_WAIT_HPP
namespace fs = boost::filesystem;
-namespace vasum {
+using namespace vasum;
+
namespace utils {
}
} // namespace utils
-} // namespace vasum
#include <boost/filesystem.hpp>
-namespace vasum {
namespace utils {
/**
bool createLink(const std::string& src, const std::string& dest);
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_FS_HPP
#include <cassert>
#include <glib-object.h>
-namespace vasum {
namespace utils {
namespace {
} // namespace utils
-} // namespace vasum
#include <glib.h>
-namespace vasum {
namespace utils {
};
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_GLIB_LOOP_HPP
#include <glib-object.h>
-namespace vasum {
namespace utils {
namespace {
} // namespace utils
-} // namespace vasum
#include "utils/callback-guard.hpp"
-namespace vasum {
namespace utils {
typedef std::function<void()> VoidCallback;
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_GLIB_UTILS_HPP
#include "utils/img.hpp"
#include "utils/fs.hpp"
#include "utils/paths.hpp"
-#include "base-exception.hpp"
+#include "utils/exception.hpp"
#include <sys/mount.h>
#include <fcntl.h>
#include <linux/loop.h>
-namespace vasum {
namespace utils {
namespace {
}
} // namespace utils
-} // namespace vasum
#ifndef COMMON_UTILS_IMG_HPP
#define COMMON_UTILS_IMG_HPP
-namespace vasum {
namespace utils {
/**
bool copyImageContents(const std::string& img, const std::string& dst);
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_IMG_HPP
#include <fcntl.h>
#include <errno.h>
-namespace vasum {
namespace utils {
namespace {
} // namespace utils
-} // namespace vasum
#define COMMON_UTILS_INITCTL_HPP
-namespace vasum {
namespace utils {
enum RunLevel : int {
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_INITCTL_HPP
#include <cassert>
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#include <condition_variable>
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_LATCH_HPP
#include <algorithm>
#include <type_traits>
-namespace vasum {
namespace utils {
template<class T>
}
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_MAKE_CLEAN_HPP
#include <algorithm>
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_PATHS_HPP
#include "logger/logger.hpp"
#include "logger/formatter.hpp"
-namespace vasum {
namespace utils {
namespace {
}
} // namespace utils
-} // namespace vasum
#endif // ENABLE_SAME_THREAD_GUARD
#include <cassert>
#endif
-namespace vasum {
namespace utils {
/**
};
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_SAME_THREAD_GUARD_HPP
#include "scoped-gerror.hpp"
-namespace vasum {
namespace utils {
ScopedGError::ScopedGError()
}
} // namespace utils
-} // namespace vasum
#include <iostream>
#include <gio/gio.h>
-namespace vasum{
namespace utils {
class ScopedGError {
};
} // namespace utils
-} // namespace vasum
#endif // COMMON_SCOPED_GERROR_HPP
#include <cstring>
#include <csignal>
-namespace vasum {
namespace utils {
void signalBlock(const int signalToBlock)
}
} // namespace utils
-} // namespace vasum
#ifndef COMMON_UTILS_SIGNAL_HPP
#define COMMON_UTILS_SIGNAL_HPP
-namespace vasum {
namespace utils {
void signalBlock(const int signalsToBlock);
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_SIGNAL_HPP
#include <cxxabi.h>
#include <stdexcept>
-namespace vasum {
namespace utils {
std::string getTypeName(const std::type_info& ti)
}
} // namespace utils
-} // namespace vasum
#include <string>
#include <typeinfo>
-namespace vasum {
namespace utils {
std::string getTypeName(const std::type_info& ti);
}
} // namespace utils
-} // namespace vasum
#endif // COMMON_TYPE_INFO_HPP
#include <mutex>
#include <condition_variable>
-namespace vasum {
namespace utils {
template <typename T>
}
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_VALUE_LATCH_H
#include "config.hpp"
#include "utils/vt.hpp"
#include "logger/logger.hpp"
-#include "base-exception.hpp"
+#include "utils/exception.hpp"
#include <fcntl.h>
#include <sys/ioctl.h>
} // namespace
-namespace vasum {
namespace utils {
bool activateVT(const int& vt)
}
} // namespace utils
-} // namespace vasum
#ifndef COMMON_UTILS_VT_HPP
#define COMMON_UTILS_VT_HPP
-namespace vasum {
namespace utils {
bool activateVT(const int& vt);
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_VT_HPP
#include <cassert>
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#include <functional>
#include <memory>
-namespace vasum {
namespace utils {
/**
};
} // namespace utils
-} // namespace vasum
#endif // COMMON_UTILS_WORKER_HPP
#include "utils/glib-utils.hpp"
#include "logger/logger.hpp"
-using namespace vasum::utils;
+using namespace utils;
namespace dbus {
: nameAcquired(acquired), nameLost(lost) {}
};
- vasum::utils::CallbackGuard mGuard;
+ utils::CallbackGuard mGuard;
GDBusConnection* mConnection;
guint mNameId;
#define SERVER_HOST_IPC_CONNECTION_HPP
#include "api/messages.hpp"
-#include "epoll/thread-dispatcher.hpp"
+#include "ipc/epoll/thread-dispatcher.hpp"
#include "ipc/service.hpp"
#include "ipc-callback-wrapper.hpp"
void sendNotification(const api::Notification& notification);
private:
- epoll::ThreadDispatcher mDispatcher;
+ ipc::epoll::ThreadDispatcher mDispatcher;
std::unique_ptr<ipc::Service> mService;
};
namespace api {
namespace ipc {
-const vasum::ipc::MethodID METHOD_GET_ZONE_ID_LIST = 2;
-const vasum::ipc::MethodID METHOD_GET_ACTIVE_ZONE_ID = 3;
-const vasum::ipc::MethodID METHOD_GET_ZONE_INFO = 4;
-const vasum::ipc::MethodID METHOD_SET_NETDEV_ATTRS = 5;
-const vasum::ipc::MethodID METHOD_GET_NETDEV_ATTRS = 6;
-const vasum::ipc::MethodID METHOD_GET_NETDEV_LIST = 7;
-const vasum::ipc::MethodID METHOD_CREATE_NETDEV_VETH = 8;
-const vasum::ipc::MethodID METHOD_CREATE_NETDEV_MACVLAN = 9;
-const vasum::ipc::MethodID METHOD_CREATE_NETDEV_PHYS = 10;
-const vasum::ipc::MethodID METHOD_DELETE_NETDEV_IP_ADDRESS = 11;
-const vasum::ipc::MethodID METHOD_DESTROY_NETDEV = 12;
-const vasum::ipc::MethodID METHOD_DECLARE_FILE = 13;
-const vasum::ipc::MethodID METHOD_DECLARE_MOUNT = 14;
-const vasum::ipc::MethodID METHOD_DECLARE_LINK = 15;
-const vasum::ipc::MethodID METHOD_GET_DECLARATIONS = 16;
-const vasum::ipc::MethodID METHOD_REMOVE_DECLARATION = 17;
-const vasum::ipc::MethodID METHOD_SET_ACTIVE_ZONE = 18;
-const vasum::ipc::MethodID METHOD_CREATE_ZONE = 19;
-const vasum::ipc::MethodID METHOD_DESTROY_ZONE = 20;
-const vasum::ipc::MethodID METHOD_SHUTDOWN_ZONE = 21;
-const vasum::ipc::MethodID METHOD_START_ZONE = 22;
-const vasum::ipc::MethodID METHOD_LOCK_ZONE = 23;
-const vasum::ipc::MethodID METHOD_UNLOCK_ZONE = 24;
-const vasum::ipc::MethodID METHOD_GRANT_DEVICE = 25;
-const vasum::ipc::MethodID METHOD_REVOKE_DEVICE = 26;
+const ::ipc::MethodID METHOD_GET_ZONE_ID_LIST = 2;
+const ::ipc::MethodID METHOD_GET_ACTIVE_ZONE_ID = 3;
+const ::ipc::MethodID METHOD_GET_ZONE_INFO = 4;
+const ::ipc::MethodID METHOD_SET_NETDEV_ATTRS = 5;
+const ::ipc::MethodID METHOD_GET_NETDEV_ATTRS = 6;
+const ::ipc::MethodID METHOD_GET_NETDEV_LIST = 7;
+const ::ipc::MethodID METHOD_CREATE_NETDEV_VETH = 8;
+const ::ipc::MethodID METHOD_CREATE_NETDEV_MACVLAN = 9;
+const ::ipc::MethodID METHOD_CREATE_NETDEV_PHYS = 10;
+const ::ipc::MethodID METHOD_DELETE_NETDEV_IP_ADDRESS = 11;
+const ::ipc::MethodID METHOD_DESTROY_NETDEV = 12;
+const ::ipc::MethodID METHOD_DECLARE_FILE = 13;
+const ::ipc::MethodID METHOD_DECLARE_MOUNT = 14;
+const ::ipc::MethodID METHOD_DECLARE_LINK = 15;
+const ::ipc::MethodID METHOD_GET_DECLARATIONS = 16;
+const ::ipc::MethodID METHOD_REMOVE_DECLARATION = 17;
+const ::ipc::MethodID METHOD_SET_ACTIVE_ZONE = 18;
+const ::ipc::MethodID METHOD_CREATE_ZONE = 19;
+const ::ipc::MethodID METHOD_DESTROY_ZONE = 20;
+const ::ipc::MethodID METHOD_SHUTDOWN_ZONE = 21;
+const ::ipc::MethodID METHOD_START_ZONE = 22;
+const ::ipc::MethodID METHOD_LOCK_ZONE = 23;
+const ::ipc::MethodID METHOD_UNLOCK_ZONE = 24;
+const ::ipc::MethodID METHOD_GRANT_DEVICE = 25;
+const ::ipc::MethodID METHOD_REVOKE_DEVICE = 26;
-const vasum::ipc::MethodID METHOD_NOTIFY_ACTIVE_ZONE = 100;
-const vasum::ipc::MethodID METHOD_FILE_MOVE_REQUEST = 101;
-const vasum::ipc::MethodID SIGNAL_NOTIFICATION = 102;
-const vasum::ipc::MethodID SIGNAL_SWITCH_TO_DEFAULT = 103;
+const ::ipc::MethodID METHOD_NOTIFY_ACTIVE_ZONE = 100;
+const ::ipc::MethodID METHOD_FILE_MOVE_REQUEST = 101;
+const ::ipc::MethodID SIGNAL_NOTIFICATION = 102;
+const ::ipc::MethodID SIGNAL_SWITCH_TO_DEFAULT = 103;
const std::string FILE_MOVE_DESTINATION_NOT_FOUND = "FILE_MOVE_DESTINATION_NOT_FOUND";
const std::string FILE_MOVE_WRONG_DESTINATION = "FILE_MOVE_WRONG_DESTINATION";
#include <vector>
#include <functional>
-using namespace vasum::utils;
+using namespace utils;
namespace fs = boost::filesystem;
namespace vasum {
#include "netdev.hpp"
#include "netlink/netlink-message.hpp"
#include "utils/make-clean.hpp"
+#include "utils/exception.hpp"
#include "utils.hpp"
#include "exception.hpp"
#endif
using namespace std;
-using namespace vasum;
+using namespace utils;
using namespace vasum::netlink;
namespace vasum {
#include "utils/environment.hpp"
#include "utils/fs.hpp"
#include "utils/signal.hpp"
+#include "utils/exception.hpp"
#include <csignal>
#include <cerrno>
extern char** environ;
+using namespace utils;
+
namespace vasum {
namespace fs = boost::filesystem;
+using namespace utils;
+
namespace vasum {
ZoneProvision::ZoneProvision(const std::string& rootPath,
#include <utility>
using namespace vasum;
-using namespace vasum::utils;
+using namespace utils;
namespace {
namespace {
+using namespace utils;
using namespace config;
const std::string UT_PATH = "/tmp/ut-config/";
const int TOLERANCE = 1;
struct Fixture {
- vasum::utils::ScopedDir mUTDirGuard;
+ ScopedDir mUTDirGuard;
Fixture() : mUTDirGuard(UT_PATH) {}
};
namespace {
+using namespace utils;
using namespace config;
const std::string UT_PATH = "/tmp/ut-config/";
struct Fixture {
- vasum::utils::ScopedDir mUTDirGuard;
+ ScopedDir mUTDirGuard;
std::string dbPath;
std::string dbPrefix;
#include <boost/filesystem.hpp>
using namespace config;
-using namespace vasum::utils;
+using namespace utils;
namespace fs = boost::filesystem;
namespace {
const std::string UT_PATH = "/tmp/ut-config/";
struct Fixture {
- vasum::utils::ScopedDir mUTDirGuard;
+ ScopedDir mUTDirGuard;
std::string dbPath;
KVStore c;
BOOST_AUTO_TEST_SUITE(DbusSuite)
+using namespace utils;
using namespace vasum;
-using namespace vasum::utils;
using namespace dbus;
namespace {
#include "config.hpp"
#include "ut.hpp"
-#include "epoll/event-poll.hpp"
+#include "ipc/epoll/event-poll.hpp"
#include "logger/logger.hpp"
#include "ipc/internals/socket.hpp"
#include "utils/value-latch.hpp"
#include "utils/glib-loop.hpp"
-#include "epoll/glib-dispatcher.hpp"
-#include "epoll/thread-dispatcher.hpp"
+#include "ipc/epoll/glib-dispatcher.hpp"
+#include "ipc/epoll/thread-dispatcher.hpp"
using namespace vasum;
-using namespace vasum::utils;
-using namespace vasum::epoll;
-using namespace vasum::ipc;
+using namespace utils;
+using namespace ipc;
+using namespace ipc::epoll;
namespace {
#include "ipc/client.hpp"
#include "ipc/types.hpp"
#include "ipc/result.hpp"
-#include "epoll/thread-dispatcher.hpp"
-#include "epoll/glib-dispatcher.hpp"
+#include "ipc/epoll/thread-dispatcher.hpp"
+#include "ipc/epoll/glib-dispatcher.hpp"
#include "utils/glib-loop.hpp"
#include "utils/latch.hpp"
#include "utils/value-latch.hpp"
#include <future>
using namespace vasum;
-using namespace vasum::ipc;
-using namespace vasum::epoll;
-using namespace vasum::utils;
+using namespace ipc;
+using namespace epoll;
+using namespace utils;
using namespace std::placeholders;
// Timeout for sending one message
#include <socket-test.hpp>
-using namespace vasum::ipc;
+using namespace ipc;
BOOST_AUTO_TEST_SUITE(SocketSuite)
using namespace vasum;
-using namespace vasum::utils;
+using namespace utils;
namespace {
#include <string>
#include <future>
+using namespace utils;
+using namespace vasum;
+using namespace config;
+
+
namespace {
const std::string CONFIG_DIR = VSM_TEST_CONFIG_INSTALL_DIR "/server/ut-server";
const bool AS_ROOT = true;
struct Fixture {
- vasum::utils::ScopedDir mZonesPathGuard;
+ utils::ScopedDir mZonesPathGuard;
Fixture()
: mZonesPathGuard(ZONES_PATH)
void prepare()
{
- vasum::utils::ScopedGlibLoop loop;
- vasum::ZonesManager manager(TEST_CONFIG_PATH);
+ ScopedGlibLoop loop;
+ ZonesManager manager(TEST_CONFIG_PATH);
manager.createZone("zone1", TEMPLATE_NAME);
manager.createZone("zone2", TEMPLATE_NAME);
manager.restoreAll();
BOOST_FIXTURE_TEST_SUITE(ServerSuite, Fixture)
-using namespace vasum;
-using namespace config;
-
BOOST_AUTO_TEST_CASE(ConstructorDestructor)
{
std::unique_ptr<Server> s;
#include <fcntl.h>
using namespace vasum;
+using namespace utils;
using namespace config;
namespace fs = boost::filesystem;
#include <linux/if_bridge.h>
#include <linux/if.h>
+using namespace utils;
using namespace vasum;
using namespace vasum::netdev;
using namespace config;
const std::string ZONE_NETDEV = "netdevtest01";
struct Fixture {
- utils::ScopedGlibLoop mLoop;
- utils::ScopedDir mZonesPathGuard;
- utils::ScopedDir mRunGuard;
+ ScopedGlibLoop mLoop;
+ ScopedDir mZonesPathGuard;
+ ScopedDir mRunGuard;
std::string mBridgeName;
Fixture()
#endif //DBUS_CONNECTION
#include "host-ipc-definitions.hpp"
#include <api/messages.hpp>
-#include <epoll/thread-dispatcher.hpp>
+#include <ipc/epoll/thread-dispatcher.hpp>
#include <ipc/client.hpp>
#include "exception.hpp"
using namespace vasum;
using namespace config;
-using namespace vasum::utils;
+using namespace utils;
#ifdef DBUS_CONNECTION
using namespace dbus;
#endif //DBUS_CONNECTION
}
private:
- epoll::ThreadDispatcher mDispatcher;
+ ipc::epoll::ThreadDispatcher mDispatcher;
ipc::Client mClient;
};
} // namespace
struct Fixture {
- vasum::utils::ScopedGlibLoop mLoop;
+ ScopedGlibLoop mLoop;
- utils::ScopedDir mZonesPathGuard;
- utils::ScopedDir mRunGuard;
+ ScopedDir mZonesPathGuard;
+ ScopedDir mRunGuard;
Fixture()
: mZonesPathGuard(ZONES_PATH)
#include <memory>
using namespace vasum::socket_test;
-using namespace vasum::ipc;
+using namespace ipc;
using namespace logger;
// NOTE this is a single-usage program, only meant to test vasum::ipc::Socket module.
#include <stdexcept>
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#include <sys/types.h>
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#endif // UNIT_TESTS_UTILS_SCOPED_DAEMON_HPP
#include <boost/filesystem.hpp>
-namespace vasum {
namespace utils {
namespace fs = boost::filesystem;
}
} // namespace utils
-} // namespace vasum
#include <string>
-namespace vasum {
namespace utils {
} // namespace utils
-} // namespace vasum
#endif // UNIT_TESTS_UTILS_SCOPED_DIR_HPP
#include <future>
#include <thread>
-
BOOST_AUTO_TEST_SUITE(CallbackGuardSuite)
-using namespace vasum::utils;
+using namespace utils;
const int unsigned TIMEOUT = 1000;
BOOST_AUTO_TEST_SUITE(CountingMapSuite)
-using namespace vasum::utils;
+using namespace utils;
BOOST_AUTO_TEST_CASE(Counting)
{
#include <sys/mount.h>
#include <boost/filesystem.hpp>
-using namespace vasum;
-using namespace vasum::utils;
+using namespace utils;
namespace {
BOOST_AUTO_TEST_SUITE(GlibLoopSuite)
-using namespace vasum;
-using namespace vasum::utils;
+using namespace utils;
namespace {
BOOST_AUTO_TEST_SUITE(UtilsPathsSuite)
-using namespace vasum::utils;
+using namespace utils;
BOOST_AUTO_TEST_CASE(CreateFilePath)
{
BOOST_AUTO_TEST_SUITE(SameThreadGuardSuite)
-using namespace vasum::utils;
+using namespace utils;
BOOST_AUTO_TEST_CASE(Simple)
{
BOOST_AUTO_TEST_SUITE(ValueLatchSuite)
-using namespace vasum::utils;
+using namespace utils;
namespace
{
ValueLatch<int> testLatch;
BOOST_REQUIRE_EXCEPTION(testLatch.get(EXPECTED_TIMEOUT),
- vasum::UtilsException,
+ UtilsException,
WhatEquals("Timeout occured"));
}
testLatch.set(3);
BOOST_REQUIRE_EXCEPTION(testLatch.set(2),
- vasum::UtilsException,
+ UtilsException,
WhatEquals("Cannot set value multiple times"));
}
testLatch.set(3);
testLatch.get(TIMEOUT);
BOOST_REQUIRE_EXCEPTION(testLatch.get(EXPECTED_TIMEOUT),
- vasum::UtilsException,
+ UtilsException,
WhatEquals("Timeout occured"));
}
#include <thread>
#include <atomic>
-BOOST_AUTO_TEST_SUITE(WorkerSuite)
+using namespace utils;
-using namespace vasum::utils;
+BOOST_AUTO_TEST_SUITE(WorkerSuite)
const int unsigned TIMEOUT = 1000;