Daemon name was changed.
authorDmytro Lomtiev <d.lomtev@samsung.com>
Mon, 19 Mar 2018 11:46:25 +0000 (13:46 +0200)
committerDmytro Lomtiev <d.lomtev@samsung.com>
Mon, 19 Mar 2018 12:41:07 +0000 (14:41 +0200)
48 files changed:
device-agent/CMakeLists.txt
device-agent/common/inc/samonitor_tag.h
device-agent/communication/src/connection.cpp
device-agent/communication/src/settings.cpp
device-agent/daemon/CMakeLists.txt [moved from device-agent/samonitor/CMakeLists.txt with 66% similarity]
device-agent/daemon/application_service.cpp [moved from device-agent/samonitor/application_service.cpp with 100% similarity]
device-agent/daemon/application_service.h [moved from device-agent/samonitor/application_service.h with 100% similarity]
device-agent/daemon/audit_trail_client.cpp [moved from device-agent/samonitor/audit_trail_client.cpp with 100% similarity]
device-agent/daemon/audit_trail_client.h [moved from device-agent/samonitor/audit_trail_client.h with 100% similarity]
device-agent/daemon/commandhandler.h [moved from device-agent/samonitor/commandhandler.h with 100% similarity]
device-agent/daemon/default.conf [moved from device-agent/samonitor/default.conf with 100% similarity]
device-agent/daemon/device_list.h [moved from device-agent/samonitor/device_list.h with 100% similarity]
device-agent/daemon/dpm/common_enforce.cpp [moved from device-agent/samonitor/dpm/common_enforce.cpp with 100% similarity]
device-agent/daemon/dpm/common_enforce.h [moved from device-agent/samonitor/dpm/common_enforce.h with 100% similarity]
device-agent/daemon/dpm/dpm_api_mapper.cpp [moved from device-agent/samonitor/dpm/dpm_api_mapper.cpp with 100% similarity]
device-agent/daemon/dpm/dpm_api_mapper.h [moved from device-agent/samonitor/dpm/dpm_api_mapper.h with 100% similarity]
device-agent/daemon/dpm/i_policy_group_enforce.h [moved from device-agent/samonitor/dpm/i_policy_group_enforce.h with 100% similarity]
device-agent/daemon/dpm/policy_enforce.cpp [moved from device-agent/samonitor/dpm/policy_enforce.cpp with 100% similarity]
device-agent/daemon/dpm/policy_enforce.h [moved from device-agent/samonitor/dpm/policy_enforce.h with 100% similarity]
device-agent/daemon/dpm/tvext_enforce.cpp [moved from device-agent/samonitor/dpm/tvext_enforce.cpp with 100% similarity]
device-agent/daemon/dpm/tvext_enforce.h [moved from device-agent/samonitor/dpm/tvext_enforce.h with 100% similarity]
device-agent/daemon/icommandhandler.h [moved from device-agent/samonitor/icommandhandler.h with 100% similarity]
device-agent/daemon/ireporter.h [moved from device-agent/samonitor/ireporter.h with 100% similarity]
device-agent/daemon/main.cpp [moved from device-agent/samonitor/main.cpp with 97% similarity]
device-agent/daemon/main_thread.cpp [moved from device-agent/samonitor/main_thread.cpp with 100% similarity]
device-agent/daemon/main_thread.h [moved from device-agent/samonitor/main_thread.h with 100% similarity]
device-agent/daemon/policyhandler.cpp [moved from device-agent/samonitor/policyhandler.cpp with 100% similarity]
device-agent/daemon/policyhandler.h [moved from device-agent/samonitor/policyhandler.h with 100% similarity]
device-agent/daemon/proxythread.h [moved from device-agent/samonitor/proxythread.h with 100% similarity]
device-agent/daemon/report_stub.cpp [moved from device-agent/samonitor/report_stub.cpp with 100% similarity]
device-agent/daemon/report_stub.h [moved from device-agent/samonitor/report_stub.h with 100% similarity]
device-agent/daemon/reportadapter.cpp [moved from device-agent/samonitor/reportadapter.cpp with 100% similarity]
device-agent/daemon/reportadapter.h [moved from device-agent/samonitor/reportadapter.h with 100% similarity]
device-agent/daemon/sam-agent.manifest [moved from device-agent/samonitor/samonitor.manifest with 100% similarity]
device-agent/daemon/sam.service [moved from device-agent/samonitor/samonitor.service with 72% similarity]
device-agent/daemon/settingshandler.cpp [moved from device-agent/samonitor/settingshandler.cpp with 100% similarity]
device-agent/daemon/settingshandler.h [moved from device-agent/samonitor/settingshandler.h with 100% similarity]
device-agent/daemon/systemdwrapper.cpp [moved from device-agent/samonitor/systemdwrapper.cpp with 100% similarity]
device-agent/daemon/systemdwrapper.h [moved from device-agent/samonitor/systemdwrapper.h with 100% similarity]
device-agent/daemon/thread_base.cpp [moved from device-agent/samonitor/thread_base.cpp with 100% similarity]
device-agent/daemon/thread_base.h [moved from device-agent/samonitor/thread_base.h with 100% similarity]
device-agent/daemon/utils.cpp [moved from device-agent/samonitor/utils.cpp with 100% similarity]
device-agent/daemon/utils.h [moved from device-agent/samonitor/utils.h with 100% similarity]
device-agent/packaging/sam.spec [moved from device-agent/packaging/samonitor.spec with 71% similarity]
device-agent/sam-agent.manifest.in [moved from device-agent/samonitor.manifest.in with 100% similarity]
device-agent/scripts/deploy.sh
device-agent/scripts/ssh_deploy.sh
device-agent/utest/CMakeLists.txt

index 64316c5..3227968 100644 (file)
@@ -18,21 +18,25 @@ message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
 
 INCLUDE(FindPkgConfig)
 
-IF (NOT DEFINED SAMONITOR_CONFIG_FILE)
-       SET (SAMONITOR_CONFIG_FILE "samonitor.conf")
+IF (NOT DEFINED DAEMON_APP_NAME)
+       SET (DAEMON_APP_NAME "sam-agent")
 ENDIF()
 
-IF (NOT DEFINED SAMONITOR_CONFIG_DIR)
-       SET (SAMONITOR_CONFIG_DIR "/etc/samonitor")
+IF (NOT DEFINED DAEMON_CONFIG_FILE)
+       SET (DAEMON_CONFIG_FILE "sam.conf")
+ENDIF()
+
+IF (NOT DEFINED DAEMON_CONFIG_DIR)
+       SET (DAEMON_CONFIG_DIR "/etc/sam")
 ENDIF()
 
 if (NOT DEFINED LIBDIR)
        SET (LIBDIR ${LIB_INSTALL_DIR})
 endif (NOT DEFINED LIBDIR)
 
-if (NOT DEFINED TESTS_DIR)
-       SET (TESTS_DIR "/usr/apps/samonitor")
-endif (NOT DEFINED TESTS_DIR)
+if (NOT DEFINED BIN_DIR)
+       SET (BIN_DIR "/usr/apps/sam")
+endif (NOT DEFINED BIN_DIR)
 
 pkg_check_modules(pkgs REQUIRED boost libcurl dpm dlog audit-trail)
 
@@ -42,7 +46,7 @@ ENDFOREACH(flag)
 
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DTB_LOG -D__TIZEN__ -DDPM_BUILD_${DPM_BUILD_TYPE} -DPROFILE_${BUILD_PROFILE} -DDATA_DIR=${DATA_DIR}")
 
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DSAMONITOR_CONFIG_FILE=${SAMONITOR_CONFIG_DIR}/${SAMONITOR_CONFIG_FILE}")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DCONFIG_FILE_PATH=${DAEMON_CONFIG_DIR}/${DAEMON_CONFIG_FILE}")
 
 if (NOT DEFINED LIB_INCLUDE_DIR)
        SET(LIB_INCLUDE_DIR "/usr/include")
@@ -61,7 +65,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
 
 add_subdirectory(utest)
 add_subdirectory(communication)
-add_subdirectory(samonitor)
+add_subdirectory(daemon)
 
 add_custom_target(runtests
                                  COMMAND utest
index 18c62a4..047eeef 100644 (file)
@@ -13,7 +13,7 @@
 #define SA_MONITOR_TAG_H
 
 #ifndef TAG
-#   define TAG "SAMonitor"
+#   define TAG "SAM"
 #endif
 
 #endif // SA_MONITOR_TAG_H
index bf961e9..819f710 100644 (file)
@@ -46,7 +46,7 @@ int Connection::addEventListener(const std::string& type, EventListener* listene
     auto& where = listeners[type];
     where.push_back(listener);
     active.emplace(id, std::make_pair(std::ref(where), listener));
-    LOG_E(TAG, "Registered listener of type: %s", type.c_str());
+    LOG_D(TAG, "Registered listener of type: %s", type.c_str());
     return id;
 }
 
index 88289e4..9944863 100644 (file)
 #include "samonitor_tag.h"
 #include "macro.h"
 
-#if !defined(SAMONITOR_CONFIG_FILE)
-#   error "SAMONITOR_CONFIG_FILE must be defined"
+#if !defined(CONFIG_FILE_PATH)
+#   error "CONFIG_FILE_PATH must be defined"
 #endif
 
-#define CONFIG_FILE STRINGIFY(SAMONITOR_CONFIG_FILE)
+#define CONFIG_FILE STRINGIFY(CONFIG_FILE_PATH)
 
 // Defaults
 namespace
similarity index 66%
rename from device-agent/samonitor/CMakeLists.txt
rename to device-agent/daemon/CMakeLists.txt
index 9c36b8d..ab5642a 100644 (file)
@@ -1,8 +1,6 @@
 cmake_minimum_required (VERSION 2.8)
 
-get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-string(REPLACE " " "_" ProjectId ${ProjectId})
-project(${ProjectId} C CXX)
+project(${DAEMON_APP_NAME} C CXX)
 
 include_directories(
        ../communication/inc
@@ -44,9 +42,9 @@ else()
        message(FATAL_ERROR "systemd library not found")
 endif()
 
-install(TARGETS ${PROJECT_NAME} DESTINATION ${TESTS_DIR})
-install(FILES samonitor.manifest DESTINATION ${MANIFESTDIR})
-install(FILES samonitor.service DESTINATION ${SERVICE_INSTALL_DIR})
-install(FILES default.conf DESTINATION ${SAMONITOR_CONFIG_DIR} RENAME ${SAMONITOR_CONFIG_FILE})
+install(TARGETS ${PROJECT_NAME} DESTINATION ${BIN_DIR})
+install(FILES ${PROJECT_NAME}.manifest DESTINATION ${MANIFESTDIR})
+install(FILES sam.service DESTINATION ${SERVICE_INSTALL_DIR})
+install(FILES default.conf DESTINATION ${DAEMON_CONFIG_DIR} RENAME ${DAEMON_CONFIG_FILE})
 message(STATUS "Configuring: " ${ProjectId})
 message(STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS})
similarity index 97%
rename from device-agent/samonitor/main.cpp
rename to device-agent/daemon/main.cpp
index de4ddcb..1540f1e 100644 (file)
@@ -5,7 +5,7 @@
  */
 /**
  * @file   main.cpp
- * @brief  nmdaemon main entry point
+ * @brief  daemon main entry point
  * @date   Created Apr 18, 2017
  * @author Mail to: <A HREF="mailto:i.metelytsia@samsung.com">Iurii Metelytsia, i.metelytsia@samsung.com</A>
  * @author Mail to: <A HREF="mailto:a.gudz@samsung.com">Andriy Gudz, a.gudz@samsung.com</A>
@@ -32,7 +32,7 @@
 #include "utils.h"
 #include "systemdwrapper.h"
 
-#define TAG "[NMDAEMON] "
+#include "samonitor_tag.h"
 
 using namespace NMD;
 
similarity index 72%
rename from device-agent/samonitor/samonitor.service
rename to device-agent/daemon/sam.service
index 1eaa52a..acabe8e 100644 (file)
@@ -1,10 +1,10 @@
 [Unit]
-Description=samonitor
+Description=Suspisious activity monitor
 After=syslog.target network.target
 
 
 [Service]
-ExecStart=/usr/apps/samonitor/samonitor
+ExecStart=/usr/apps/sam/sam-agent
 Type=notify
 WatchdogSec=5s
 KillMode=process
similarity index 71%
rename from device-agent/packaging/samonitor.spec
rename to device-agent/packaging/sam.spec
index a37085f..c0076ca 100644 (file)
@@ -1,4 +1,4 @@
-Name:       samonitor
+Name:       sam
 Version:    1.0.0
 Release:    9
 Summary:    TODO
@@ -31,15 +31,16 @@ BuildRequires: python-xml
 
 
 
-%define _app_name samonitor
-%define _app_dir /usr/apps/%{_app_name}
+%define _project_name sam
+%define _app_name %{_project_name}-agent
+%define _app_dir /usr/apps/%{_project_name}
 %define _manifestdir /usr/share/packages
 %define _service_dir /usr/lib/systemd/system
 %define _service_symlink_dir /etc/systemd/system/multi-user.target.wants
 %define _lib_include_dir /usr/include
-%define _conf_dir /etc/%{_app_name}
-%define _conf_file %{_app_name}.conf
-%define _data_dir /opt/data/%{_app_name}
+%define _conf_dir /etc/%{_project_name}
+%define _conf_file %{_project_name}.conf
+%define _data_dir /opt/data/%{_project_name}
 
 %if ("%{GTEST_TYPE}" == "mock")
 %define _gtest_lib gmock_main
@@ -60,14 +61,16 @@ Suspicious Activity Monitor
 cmake -H./ -B./build-gbs \
     -DLIB_INSTALL_DIR=%{_libdir} \
     -DMANIFESTDIR=%{_manifestdir} \
-       -DTESTS_DIR=%{_app_dir} \
+       -DBIN_DIR=%{_app_dir} \
     -DGTEST_LIB=%{_gtest_lib} \
        -DLIB_INCLUDE_DIR=%{_lib_include_dir} \
        -DSERVICE_INSTALL_DIR=%{_service_dir} \
-       -DNWMANAGER_CONFIG_FILE=%{_conf_file} \
-       -DNWMANAGER_CONFIG_DIR=%{_conf_dir} \
+       -DDAEMON_CONFIG_FILE=%{_conf_file} \
+       -DDAEMON_CONFIG_DIR=%{_conf_dir} \
+       -DDAEMON_APP_NAME=%{_app_name} \
        -DCMAKE_BUILD_TYPE=%{build_type} \
        -DDPM_BUILD_TYPE=%{dpm_type} \
+       -DDAEMON_NAME=%{_app_name} \
        -DDATA_DIR=%{_data_dir} \
        #eol
 
@@ -88,30 +91,30 @@ rm -rf %{buildroot}
 # Suspicious Activity Monitor
 ##############################################
 
-%package samonitor
+%package sam
 Summary: Suspicious Activity Monitor
-Provides: samonitor
-%description samonitor
+Provides: sam
+%description sam
 Suspicious Activity Monitor daemon
 
 
-%post samonitor
+%post sam
 mkdir -p %{_data_dir}
-ln -sf %{_service_dir}/samonitor.service %{_service_symlink_dir}/samonitor.service
+ln -sf %{_service_dir}/%{_project_name}.service %{_service_symlink_dir}/%{_project_name}.service
 systemctl daemon-reload
-dpm-admin-cli -r samonitor -u owner
-dpm-admin-cli -r %{_app_dir}/samonitor -u owner
+dpm-admin-cli -r %{_app_name} -u owner
+dpm-admin-cli -r %{_app_dir}/%{_app_name} -u owner
 systemctl restart device-policy-manager
-systemctl restart samonitor
+systemctl restart %{_project_name}
 
-%postun samonitor
-systemctl stop samonitor
+%postun sam
+systemctl stop %{_project_name}
 rm -r %{_data_dir}
 
-%files samonitor
-%manifest %{_manifestdir}/samonitor.manifest
-%attr(0755,root,root) %{_app_dir}/samonitor
-%attr(0664,root,root) %{_service_dir}/samonitor.service
+%files sam
+%manifest %{_manifestdir}/%{_app_name}.manifest
+%attr(0755,root,root) %{_app_dir}/%{_app_name}
+%attr(0664,root,root) %{_service_dir}/%{_project_name}.service
 %attr(0664,root,root) %{_conf_dir}/%{_conf_file}
 
 
index 60882d2..b786b6c 100755 (executable)
@@ -63,8 +63,8 @@ GBS_RPMS_DIR=~/gbs_root_${PROFILE_NAME}/local/repos/${PROFILE_NAME}/${TARGET_ARC
 sdb root on
 sdb shell mount -o remount,rw /
 
-sdb shell "rpm -e --nodeps \$(rpm -qa 'nwmanager*')"
+sdb shell "rpm -e --nodeps \$(rpm -qa 'sam-*')"
 sdb shell rm -rf /tmp/rpms/
 sdb shell mkdir /tmp/rpms/
-sdb push ${GBS_RPMS_DIR}/samonitor-* /tmp/rpms/
+sdb push ${GBS_RPMS_DIR}/sam-* /tmp/rpms/
 sdb shell "rpm -ivh --nodeps --force /tmp/rpms/*.rpm"
index c121fc4..a7ad496 100755 (executable)
@@ -114,8 +114,8 @@ TARGET_HOST="root@${TARGET_IP}"
 PASS="sshpass -p ${SSH_PASSWORD}"
 ${PASS} ssh ${TARGET_HOST} "mount -o remount,rw /"
 
-${PASS} ssh ${TARGET_HOST} "rpm -e --nodeps \$(rpm -qa 'samonitor*')"
+${PASS} ssh ${TARGET_HOST} "rpm -e --nodeps \$(rpm -qa 'sam-*')"
 ${PASS} ssh ${TARGET_HOST} "rm -r /tmp/rpms/"
 ${PASS} ssh ${TARGET_HOST} "mkdir /tmp/rpms/"
-${PASS} scp ${GBS_RPMS_DIR}/samonitor-* ${TARGET_HOST}:/tmp/rpms/
+${PASS} scp ${GBS_RPMS_DIR}/sam-* ${TARGET_HOST}:/tmp/rpms/
 ${PASS} ssh ${TARGET_HOST} "rpm -Uvih --nodeps --force /tmp/rpms/*.rpm"
index 67d71f7..46f1f30 100644 (file)
@@ -13,17 +13,17 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wp,-U_FORTIFY_SOURCE")
 include_directories (
        mock
        ../communication/inc
-       ../samonitor
-       ../samonitor/dpm
+       ../daemon
+       ../daemon/dpm
        ../.
 )
 
 include_directories(BEFORE ../mock)
 
-FILE(GLOB SRCS *.cpp ../samonitor/*.cpp ../samonitor/dpm/*.cpp mock/*.cpp)
+FILE(GLOB SRCS *.cpp ../daemon/*.cpp ../daemon/dpm/*.cpp mock/*.cpp)
 
-FILE(GLOB DAEMON_MAIN ../samonitor/main.cpp)
-FILE(GLOB DAEMON_MAIN_THREAD ../samonitor/main_thread.cpp)
+FILE(GLOB DAEMON_MAIN ../daemon/main.cpp)
+FILE(GLOB DAEMON_MAIN_THREAD ../daemon/main_thread.cpp)
 
 list(REMOVE_ITEM SRCS ${DAEMON_MAIN})
 list(REMOVE_ITEM SRCS ${DAEMON_MAIN_THREAD})
@@ -53,7 +53,7 @@ else()
        target_link_libraries(${PROJECT_NAME} systemd)
 endif()
 
-install(TARGETS ${PROJECT_NAME} DESTINATION ${TESTS_DIR})
+install(TARGETS ${PROJECT_NAME} DESTINATION ${BIN_DIR})
 install(FILES tests.manifest DESTINATION ${MANIFESTDIR})
 
 message(STATUS "Configuring: " ${ProjectId})