--- /dev/null
+# This is the official list of ViST authors for copyright purposes.
+# This file is distinct from the CONTRIBUTORS files.
+# See the latter for an explanation.
+#
+# Names should be added to this file as:
+# Name or Organization <email address>
+# The email address is not required for organizations.
+#
+# Please keep the list sorted.
+
+Jaemin Ryu <jm77.ryu@samsung.com>
+Samsung Electronics Co.
+Sangwan Kwon <sangwan.kwon@samsung.com>
#include <bluetooth-api.h>
#include <bluetooth_internal.h>
-#include <vist/policy/sdk/policy-model.h>
-#include <vist/policy/sdk/policy-provider.h>
+#include <vist/policy/sdk/policy-model.hpp>
+#include <vist/policy/sdk/policy-provider.hpp>
#include <memory>
#include <arpa/inet.h>
#include <wifi-manager.h>
-#include <vist/policy/sdk/policy-model.h>
-#include <vist/policy/sdk/policy-provider.h>
+#include <vist/policy/sdk/policy-model.hpp>
+#include <vist/policy/sdk/policy-provider.hpp>
#include <klay/dbus/connection.h>
#include <osquery/sql.h>
#include <osquery/tables.h>
-#include <vist/policy/api.h>
-#include <vist/common/audit/logger.h>
+#include <vist/policy/api.hpp>
+#include <vist/logger.hpp>
namespace osquery {
namespace tables {
#include <osquery/sql.h>
#include <osquery/tables.h>
-#include <vist/policy/api.h>
-#include <vist/common/audit/logger.h>
+#include <vist/policy/api.hpp>
+#include <vist/logger.hpp>
namespace {
#include <gtest/gtest.h>
-#include <vist/policy/api.h>
+#include <vist/policy/api.hpp>
using namespace vist;
-DSCRIPT_INSTALL_DIR="${SCRIPT_INSTALL_DIR}")
ADD_SUBDIRECTORY(client)
-ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY(notification)
ADD_SUBDIRECTORY(policy)
ADD_SUBDIRECTORY(service)
WORLD_READ
WORLD_EXECUTE)
+FILE(GLOB COMMON_TESTS "tests/*.cpp")
+ADD_VIST_TEST(${COMMON_TESTS})
+
ADD_EXECUTABLE(${TARGET_VIST_TEST} main/tests.cpp
${${TARGET_VIST_LIB}_TESTS})
TARGET_LINK_LIBRARIES(${TARGET_VIST_TEST} ${TARGET_VIST_LIB}
* limitations under the License
*/
-#include "query.h"
+#include "query.hpp"
-#include <vist/common/ipc/client.h>
-#include <vist/common/audit/logger.h>
+#include <vist/logger.hpp>
+#include <vist/ipc/client.hpp>
namespace {
const std::string SOCK_ADDR = "/tmp/.vist";
* limitations under the License
*/
-
-/**
- * @file processes.h
- * @brief The scheme of policy
- */
-
-
#pragma once
#include <string>
* limitations under the License
*/
-
-/**
- * @file processes.h
- * @brief The scheme of processes (sync with osquery/tables/spec/x/processes.table)
- */
-
-
#pragma once
#include <string>
* limitations under the License
*/
-
-/**
- * @file time.h
- * @brief The scheme of time (sync with osquery/tables/spec/time.table)
- */
-
-
#pragma once
namespace vist {
#include <gtest/gtest.h>
-#include "../query.h"
+#include <vist/client/query.hpp>
#include <chrono>
#include <thread>
class ClientTests : public testing::Test {};
-TEST_F(ClientTests, query) {
+TEST(ClientTests, query) {
auto rows = Query::Execute("SELECT * FROM policy");
EXPECT_TRUE(rows.size() > 0);
}
-TEST_F(ClientTests, admin_enrollment) {
+TEST(ClientTests, admin_enrollment) {
auto rows = Query::Execute("INSERT INTO policy_admin (name) VALUES ('testAdmin')");
EXPECT_EQ(rows.size(), 0);
#include <gtest/gtest.h>
-#include "../virtual-table.h"
+#include <vist/client/virtual-table.hpp>
-#include "../schema/time.h"
-#include "../schema/policy.h"
-#include "../schema/processes.h"
+#include <vist/client/schema/policy.hpp>
+#include <vist/client/schema/processes.hpp>
+#include <vist/client/schema/time.hpp>
-#include <vist/common/audit/logger.h>
+#include <vist/logger.hpp>
using namespace vist;
using namespace vist::schema;
class VirtualTableTests : public testing::Test {};
-TEST_F(VirtualTableTests, time_row_at) {
+TEST(VirtualTableTests, time_row_at) {
Time result = { -1, -1, -1 };
VirtualRow<Time> time;
EXPECT_NE(result.seconds, -1);
}
-TEST_F(VirtualTableTests, time_row_arry_op) {
+TEST(VirtualTableTests, time_row_arry_op) {
Time result = { -1, -1, -1 };
VirtualRow<Time> time;
EXPECT_NE(result.seconds, -1);
}
-TEST_F(VirtualTableTests, processes_table) {
+TEST(VirtualTableTests, processes_table) {
Processes result;
VirtualTable<Processes> processes;
EXPECT_TRUE(processes.size() > 0);
}
}
-TEST_F(VirtualTableTests, policy_table) {
+TEST(VirtualTableTests, policy_table) {
VirtualTable<Policy> table;
EXPECT_TRUE(table.size() > 0);
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file virtual-table.cpp
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Implementation of virtual object
- */
-
-#include "virtual-table.h"
-#include "query.h"
-#include "schema/time.h"
-#include "schema/policy.h"
-#include "schema/processes.h"
+#include "virtual-table.hpp"
-#include <vist/common/audit/logger.h>
+#include <vist/client/query.hpp>
+#include <vist/client/schema/policy.hpp>
+#include <vist/client/schema/processes.hpp>
+#include <vist/client/schema/time.hpp>
-#include <tsqb.hxx>
+#include <vist/logger.hpp>
+#include <vist/query-builder.hpp>
#include <boost/lexical_cast.hpp>
namespace {
-using namespace tsqb;
+using namespace vist::tsqb;
using namespace vist::schema;
auto time = make_table("time",
+++ /dev/null
-# Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License
-
-FILE(GLOB COMMON_TESTS "tests/*.cpp")
-ADD_VIST_TEST(${COMMON_TESTS})
* limitations under the License
*/
/*
- * @file exception.h
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Enum based exception handling
* @usage
* enum class ErrCode {
* LogicError = 1,
#include <gtest/gtest.h>
-#include "ipc/server.h"
-#include "ipc/client.h"
+#include <vist/ipc/client.hpp>
+#include <vist/ipc/server.hpp>
#include <chrono>
#include <thread>
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#pragma once
-#include <klay/audit/logger.h>
#include <klay/audit/dlog-sink.h>
+#include <klay/audit/logger.h>
#include <memory>
* limitations under the License
*/
-#include "service/vist.h"
+#include <vist/service/vist.hpp>
#include <cstdlib>
#include <stdexcept>
using namespace vist;
-int main() try
-{
+int main() try {
Vist::Instance().start();
return EXIT_SUCCESS;
-} catch(const std::exception&)
-{
+} catch(const std::exception&) {
return EXIT_FAILURE;
}
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
#include <gtest/gtest.h>
int main(int argc, char* argv[]) {
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file notification.cpp
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Implementation of notification
- */
-#include "notification.h"
+#include "notification.hpp"
#include <mutex>
* limitations under the License
*/
-
-/**
- * @file notification.h
- * @brief Notify to registered stuffs when event-callback called
- */
-
-
#pragma once
#include <map>
#include <gtest/gtest.h>
-#include "../notification.h"
+#include <vist/notification/notification.hpp>
+
#include <osquery/logger.h>
using namespace vist;
class NotificationTests : public testing::Test {};
-TEST_F(NotificationTests, test_add_positive) {
+TEST_F(NotificationTests, test_add_positive)
+{
auto& notifier = Notification::instance();
auto callback = [](const Row& row) {
EXPECT_TRUE(s.ok());
}
-TEST_F(NotificationTests, test_add_negative) {
+TEST_F(NotificationTests, test_add_negative)
+{
auto& notifier = Notification::instance();
auto callback = [](const Row& row) {
EXPECT_FALSE(s.ok());
}
-TEST_F(NotificationTests, test_emit_positive) {
+TEST_F(NotificationTests, test_emit_positive)
+{
auto& notifier = Notification::instance();
int called = 0;
#pragma once
-#include <vist/policy/sdk/policy-value.h>
+#include <vist/policy/sdk/policy-value.hpp>
#include <string>
#include <unordered_map>
* limitations under the License
*/
-#include <vist/policy/api.h>
+#include <vist/policy/api.hpp>
-#include "policy-manager.h"
+#include "policy-manager.hpp"
namespace vist {
namespace policy {
* See the License for the specific language governing permissions and
* limitations under the License
*/
+
#pragma once
#include <string>
* limitations under the License
*/
-#include "policy-loader.h"
+#include "policy-loader.hpp"
namespace vist {
namespace policy {
#pragma once
-#include <vist/policy/sdk/policy-provider.h>
+#include <vist/policy/sdk/policy-provider.hpp>
+#include <memory>
#include <stdexcept>
#include <string>
-#include <memory>
#include <dlfcn.h>
* limitations under the License
*/
-#include "policy-manager.h"
-#include "policy-loader.h"
+#include "policy-manager.hpp"
+#include "policy-loader.hpp"
-#include <vist/common/audit/logger.h>
+#include <vist/logger.hpp>
#include <klay/filesystem.h>
#pragma once
-#include <vist/policy/sdk/policy-provider.h>
-#include <vist/policy/sdk/policy-value.h>
+#include <vist/policy/sdk/policy-provider.hpp>
+#include <vist/policy/sdk/policy-value.hpp>
-#include "policy-storage.h"
+#include "policy-storage.hpp"
#include <exception>
#include <memory>
* limitations under the License
*/
-#include "policy-storage.h"
+#include "policy-storage.hpp"
-#include <vist/common/audit/logger.h>
+#include <vist/logger.hpp>
+#include <vist/query-builder.hpp>
#include <klay/db/column.h>
-#include <klay/db/query-builder.h>
#include <klay/db/statement.h>
#include <klay/exception.h>
-#include <fstream>
#include <algorithm>
+#include <fstream>
-using namespace query_builder;
+using namespace vist::tsqb;
using namespace vist::policy::schema;
namespace {
#pragma once
-#include <vist/policy/sdk/policy-value.h>
+#include <vist/policy/sdk/policy-value.hpp>
-#include "db-schema.h"
+#include "db-schema.hpp"
#include <memory>
#include <unordered_map>
#include <gtest/gtest.h>
-#include "../policy-manager.h"
+#include <vist/policy/core/policy-manager.hpp>
namespace vist {
namespace policy {
#include <memory>
-#include "../policy-storage.h"
+#include <vist/policy/core/policy-storage.hpp>
using namespace vist::policy;
#pragma once
-#include <vist/policy/sdk/policy-value.h>
+#include <vist/policy/sdk/policy-value.hpp>
#include <string>
#include <stdexcept>
#pragma once
-#include <vist/policy/sdk/policy-model.h>
+#include <vist/policy/sdk/policy-model.hpp>
#include <cstddef>
#include <memory>
#include <gtest/gtest.h>
-#include "../policy-model.h"
-#include "../policy-provider.h"
+#include <vist/policy/sdk/policy-model.hpp>
+#include <vist/policy/sdk/policy-provider.hpp>
#include <exception>
* limitations under the License
*/
/*
- * @file tsqb.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief TSQB is type-safe query builder
+ * @brief namespace TSQB means type-safe query builder
*/
#pragma once
-#include "include/database.hxx"
-#include "include/table.hxx"
-#include "include/column.hxx"
-#include "include/expression.hxx"
-#include "include/condition.hxx"
-#include "include/util.hxx"
+#include "query-builder/column.hpp"
+#include "query-builder/condition.hpp"
+#include "query-builder/database.hpp"
+#include "query-builder/expression.hpp"
+#include "query-builder/table.hpp"
+#include "query-builder/util.hpp"
# See the License for the specific language governing permissions and
# limitations under the License
+/// TSQB: Type Safe Query Builder
FILE(GLOB TSQB_TESTS "tests/*.cpp")
ADD_VIST_TEST(${TSQB_TESTS})
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file column-pack.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Tie different types of columns
- */
#pragma once
-#include "type.hxx"
+#include "type.hpp"
#include <string>
#include <vector>
+namespace vist {
namespace tsqb {
namespace internal {
} // namespace internal
} // namespace tsqb
+} // namespace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file culumn.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Capture member pointer of struct and use it for matching with column
- */
#pragma once
#include <string>
#include <tuple>
+namespace vist {
namespace tsqb {
template<typename Object, typename Field>
}
} // namespace tsqb
+} // namespace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file condition.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Represent the condition statement of SQL
- */
#pragma once
-#include "type.hxx"
+#include "type.hpp"
+namespace vist {
namespace tsqb {
namespace condition {
} // namespace condition
} // namespace tsqb
+} // namespace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file crud.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Represent four basic functions of CRUD
- */
#pragma once
-#include "column.hxx"
-#include "expression.hxx"
+#include "column.hpp"
+#include "expression.hpp"
#include <string>
#include <sstream>
+namespace vist {
namespace tsqb {
template<typename T>
}
} // namespace tsqb
+} // namespace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file database.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Represent the database scheme of SQL
- */
#pragma once
-#include "crud.hxx"
-#include "condition.hxx"
-#include "expression.hxx"
-#include "table-pack.hxx"
-#include "tuple-helper.hxx"
-#include "util.hxx"
+#include "crud.hpp"
+#include "condition.hpp"
+#include "expression.hpp"
+#include "table-pack.hpp"
+#include "tuple-helper.hpp"
+#include "util.hpp"
#include <vector>
#include <set>
#include <sstream>
#include <algorithm>
+namespace vist {
namespace tsqb {
template<typename... Tables>
}
} // namespace tsqb
+} // namespace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file expression.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Represent the expression of SQL
- */
#pragma once
-#include "column.hxx"
-#include "type.hxx"
-#include "condition.hxx"
+#include "column.hpp"
+#include "type.hpp"
+#include "condition.hpp"
#include <type_traits>
+namespace vist {
namespace tsqb {
template<typename Type>
}
} // namespace tsqb
+} // namespace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file table-pack.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Tie diffirent types of tables
- */
#pragma once
#include <set>
#include <string>
+namespace vist {
namespace tsqb {
namespace internal {
} // namespace internal
} // namespace tsqb
+} // namespace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file table.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Represent the table of SQL
- */
#pragma once
-#include "crud.hxx"
-#include "column.hxx"
-#include "column-pack.hxx"
-#include "tuple-helper.hxx"
-#include "util.hxx"
+#include "crud.hpp"
+#include "column.hpp"
+#include "column-pack.hpp"
+#include "tuple-helper.hpp"
+#include "util.hpp"
#include <vector>
#include <string>
#include <sstream>
+namespace vist {
namespace tsqb {
template<typename... Columns>
}
} // namespace tsqb
+} // namespace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file tsqb-tests.cpp
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Testcases of tsqb
- */
-#include "tsqb.hxx"
+#include <vist/query-builder.hpp>
#include <gtest/gtest.h>
-using namespace tsqb;
+using namespace vist::tsqb;
struct Admin {
int id;
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file tuple-helper.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Iterator method for tuple
- */
#pragma once
#include <tuple>
+namespace vist {
namespace tsqb {
namespace tuple_helper {
namespace internal {
} // namspace tuple-hepler
} // namspace tsqb
+} // namspace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file type.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @brief Make type safety with compile time checking
- */
#pragma once
#include <type_traits>
+namespace vist {
namespace tsqb {
namespace type {
} // namespace type
} // namespace tsqb
+} // namespace vist
* See the License for the specific language governing permissions and
* limitations under the License
*/
-/*
- * @file util.hxx
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- */
#pragma once
#include <algorithm>
#include <cctype>
+namespace vist {
namespace tsqb {
namespace util {
} // namespace util
} // namespace tsqb
+} // namespace vist
#include <gtest/gtest.h>
-#include "../vist.h"
+#include <vist/service/vist.hpp>
+#include <vist/policy/core/policy-manager.hpp>
#include <iostream>
#include <chrono>
#include <thread>
-#include <vist/policy/core/policy-manager.h>
-
using namespace vist;
class CoreTests : public testing::Test {};
-TEST_F(CoreTests, query_select) {
+TEST_F(CoreTests, query_select)
+{
auto rows = Vist::Query("SELECT * FROM policy");
EXPECT_TRUE(rows.size() > 0);
EXPECT_EQ(rows[0]["name"], "bluetooth");
}
-TEST_F(CoreTests, query_update) {
+TEST_F(CoreTests, query_update)
+{
auto& manager = policy::PolicyManager::Instance();
manager.enroll("admin");
* limitations under the License
*/
-#include "vist.h"
+#include "vist.hpp"
-#include <vist/common/ipc/server.h>
-#include <vist/common/audit/logger.h>
+#include <vist/ipc/server.hpp>
+#include <vist/logger.hpp>
#include <stdexcept>
#include <gtest/gtest.h>
-#include "../exception.h"
+#include <vist/exception.hpp>
enum class ErrCode {
InvalidArgument = 1,
msg = e.what();
}
- EXPECT_TRUE(!raised) << msg;
+ EXPECT_TRUE(raised);
EXPECT_EQ(ec, ErrCode::RuntimeError);
EXPECT_NE(std::string::npos, msg.find("Additional"));
}