fix comments for doxygen in the nmdaemon
authorAndrey Zabolotnyi <a.zabolotnyi@samsung.com>
Wed, 8 Nov 2017 14:54:27 +0000 (16:54 +0200)
committerAndrey Zabolotnyi <a.zabolotnyi@samsung.com>
Wed, 8 Nov 2017 14:54:27 +0000 (16:54 +0200)
24 files changed:
device_core/nmdaemon/agentpolicyservice.h
device_core/nmdaemon/audit_trail_client.cpp
device_core/nmdaemon/audit_trail_client.h
device_core/nmdaemon/control_resource.h
device_core/nmdaemon/device_list.h
device_core/nmdaemon/dpm/iot_common_enforce.h
device_core/nmdaemon/dpm/iot_i_policy_group_enforce.h
device_core/nmdaemon/dpm/iot_policy_enforce.h
device_core/nmdaemon/dpm/iot_tvext_enforce.h
device_core/nmdaemon/dpm/log.h
device_core/nmdaemon/hub_policy_resource.cpp
device_core/nmdaemon/hub_policy_resource.h
device_core/nmdaemon/hub_report_resource.cpp
device_core/nmdaemon/main_thread.h
device_core/nmdaemon/policyhandlerres.cpp
device_core/nmdaemon/proxythread.h
device_core/nmdaemon/reporthandler.h
device_core/nmdaemon/reporthandler_res.h
device_core/nmdaemon/reporthandlerfactory.h
device_core/nmdaemon/reporthandlermq.h
device_core/nmdaemon/thread_base.cpp
device_core/nmdaemon/thread_base.h
device_core/nmdaemon/utils.cpp
device_core/nmdaemon/utils.h

index 488667a..5db00dd 100644 (file)
 namespace NMD
 {
 
+/**
+ * @typedef EnforcePolicyHandler
+ * @brief  Callback function for EnforcePolicy handling
+ * @param agentId [in] id of agent program that want to enforce policy
+ * @param jsonData [in] string that represent json data
+ */
 typedef std::function<void(const std::string& agentId, const std::string& jsonData)> EnforcePolicyHandler;
 
 /**
@@ -29,8 +35,8 @@ class AgentPolicyService: public IAgentPolicy
 public:
     /**
      * @brief enforcePolicy method sends policy (json data) from calling process to service daemon.
-     * @param agentId id of agent program that want to enforce policy
-     * @param jsonData string that represent json data
+     * @param agentId [in] id of agent program that want to enforce policy
+     * @param jsonData [in] string that represent json data
      * @return result code of type AgentPolicyResult
      */
     virtual int enforcePolicy(const std::string& agentId, const std::string& jsonData);
index 9f39c62..c06f0be 100644 (file)
@@ -28,9 +28,9 @@
 
 namespace
 {
-    const int DLP_REPORT_TYPE = 1111;
-    const int PAD_REPORT_TYPE = 1112;
-    const int FIM_REPORT_TYPE = 1113;
+const int DLP_REPORT_TYPE = 1111;
+const int PAD_REPORT_TYPE = 1112;
+const int FIM_REPORT_TYPE = 1113;
 }
 
 namespace NMD
@@ -244,23 +244,23 @@ void userLogCallback(audit_trail_user_h handle, void* user_data)
     switch(type)
     {
     case DLP_REPORT_TYPE:
-        {
-            report_type = "dlp";
-            log_type = "DLP";
-        }
-        break;
+    {
+        report_type = "dlp";
+        log_type = "DLP";
+    }
+    break;
     case PAD_REPORT_TYPE:
-        {
-            report_type = "pad";
-            log_type = "PAD";
-        }
-        break;
+    {
+        report_type = "pad";
+        log_type = "PAD";
+    }
+    break;
     default:
-        {
-            report_type = "fim";
-            log_type = "FIM";
-        }
-        break;
+    {
+        report_type = "fim";
+        log_type = "FIM";
+    }
+    break;
     }
 
     std::ostringstream os;
index dc7dcd9..3851d75 100644 (file)
@@ -25,9 +25,9 @@
 #include <audit-trail/mac.h>
 #include <audit-trail/syscall.h>
 #include <audit-trail/audit-trail.h>
-    #ifdef PROFILE_MOBILE
+#ifdef PROFILE_MOBILE
 #include <audit-trail/user.h>
-    #endif
+#endif
 #endif
 #include "proxythread.h"
 #include "reporthandler.h"
index d76e79f..fe453ab 100644 (file)
@@ -30,8 +30,14 @@ public:
      */
     ControlResource(ICommandHandler* handler);
 
+    /**
+     * @brief Not copyconstructible
+     */
     ControlResource(const ControlResource& obj) = delete;
 
+    /**
+     * @brief Not copyconstructible
+     */
     ControlResource& operator=(const ControlResource& obj) = delete;
 
     /**
index c23b9b0..dfe8d47 100644 (file)
 #include <vector>
 
 /**
- * @brief A structure that contains info about device
+ * @brief A structure that contains info about device
  */
 struct DeviceInfo {
-    std::string duid; /**< Device unique ID */
-    std::string        name; /**< Device name */
-    std::string        model; /**< Device model */
-    std::string        type; /**< Device type */
-    bool               is_owned; /**< Is the device owned */
+    std::string duid;       /**< Device unique ID */
+    std::string        name;       /**< Device name */
+    std::string        model;      /**< Device model */
+    std::string        type;       /**< Device type */
+    bool               is_owned;   /**< Is the device owned */
 
-    static const int fields_count = 5;
+    static const int fields_count = 5; /**< Number of significant fields */
 
-    bool operator==(const DeviceInfo& r);
+    bool operator==(const DeviceInfo& r); /**< Equal operator */
 };
 
 /**
index fb5ebbf..cee802a 100644 (file)
@@ -30,15 +30,21 @@ class CommonPolicyEnforce: public IPolicyGroupEnforce
 {
 
 public:
-    CommonPolicyEnforce(PolicyEnforce&); /**< Default constructor    */
-    virtual ~CommonPolicyEnforce();      /**< Destructor             */
+    /**
+     * @brief Default Constructor
+     */
+    CommonPolicyEnforce(PolicyEnforce&);
+
+    /**
+     * @brief Destructor
+     */
+    virtual ~CommonPolicyEnforce();
 
     /**
      * @brief Init function. Used to init context of TV extensions policy group
-     * @param[in] PolicyContext instance
      * @return bool. True in case of success, false otherwise
      */
-    bool Init(/*PolicyContext&*/) override;
+    bool Init() override;
 
     /**
     * @brief De-Init function. Used to close tpm tvext context.
index 090f1ed..54b450d 100644 (file)
@@ -33,7 +33,10 @@ class IPolicyGroupEnforce
 {
 
 public:
-    virtual ~IPolicyGroupEnforce() {}; /**< Destructor */
+    /**
+     * @brief Destructor
+     */
+    virtual ~IPolicyGroupEnforce() {};
 
     /**
      * @brief Init function. Used to init context of related module of policy group
index 4e8051c..cd84fd8 100644 (file)
@@ -25,6 +25,10 @@ namespace iot
 namespace core
 {
 
+/**
+ * @typedef PolicyGroupMap
+ * @brief  Map of policy group appliers instances
+ */
 typedef std::map<std::string, IPolicyGroupEnforcePtr> PolicyGroupMap;
 
 /**
index f195176..936dc04 100644 (file)
@@ -18,8 +18,6 @@
 #include "iot_i_policy_group_enforce.h"
 #include "iot_policy_enforce.h"
 
-
-
 namespace iot
 {
 namespace core
@@ -33,8 +31,15 @@ class TvExtPolicyEnforce: public IPolicyGroupEnforce
 {
 
 public:
-    TvExtPolicyEnforce(PolicyEnforce&); /**< Default constructor    */
-    virtual ~TvExtPolicyEnforce();      /**< Destructor             */
+    /**
+     * @brief Default constructor
+     */
+    TvExtPolicyEnforce(PolicyEnforce&);
+
+    /**
+     * @brief Destructor
+     */
+    virtual ~TvExtPolicyEnforce();
 
     /**
      * @brief Init function. Used to init context of TV extensions policy group
index 1a26db1..79c9aeb 100644 (file)
@@ -5,18 +5,23 @@
  */
 /**
  * @file   log.h
- * @brief  //TODO: write brief file annotation
+ * @brief  Logging macro
  * @date   Created May 19, 2017
  * @author Mail to: <A HREF="mailto:i.metelytsia@samsung.com">Iurii Metelytsia, i.metelytsia@samsung.com</A>
  * @author Mail to: <A HREF="mailto:d.lomtev@samsung.com">Dmytro Lomtev, d.lomtev@samsung.com</A>
  */
 #include <stdio.h>
 
-
+/**
+ * @brief Error logging
+ */
 #ifndef LOG_ERR
 #define LOG_ERR(format, args...) printf("ERR  --  %s [%s:%d] " format "\n",__FILE__, __func__, __LINE__, ##args)
 #endif
 
+/**
+ * @brief Debug logging
+ */
 #ifndef LOG_DBG
 #define LOG_DBG(format, args...) printf("DBG  --  %s [%s:%d] " format "\n",__FILE__, __func__, __LINE__, ##args)
 #endif
index 934e76e..3626c70 100644 (file)
@@ -26,7 +26,9 @@ namespace PH = std::placeholders;
 
 #define TAG "nmdaemon"
 
-const std::string PolicyResource::HUB_POLICY_RESOURCE_URI{"/a/policy"};
+const std::string PolicyResource::HUB_POLICY_RESOURCE_URI {
+    "/a/policy"
+};
 const std::string PolicyResource::HUB_POLICY_RESORCE_TYPE{"core.policy"};
 
 PolicyResource::PolicyResource(PolicyHandler* handler, const std::string& hub_device_id,
@@ -35,15 +37,17 @@ PolicyResource::PolicyResource(PolicyHandler* handler, const std::string& hub_de
     : NetworkManager::IotResourceServer(
           HUB_POLICY_RESOURCE_URI,
           HUB_POLICY_RESORCE_TYPE,
-          {DEFAULT_INTERFACE},
-          OC_DISCOVERABLE | OC_OBSERVABLE)
-    , observers{}
-    , policies{}
-    , obs_mutex{}
-    , hub_did(hub_device_id)
-    , policy_handler(handler)
-    , hub(hub)
-    , proxy(proxy)
+{
+    DEFAULT_INTERFACE
+},
+OC_DISCOVERABLE | OC_OBSERVABLE)
+, observers{}
+, policies{}
+, obs_mutex{}
+, hub_did(hub_device_id)
+, policy_handler(handler)
+, hub(hub)
+, proxy(proxy)
 {
     assert(policy_handler != nullptr);
     assert(hub != nullptr);
@@ -104,7 +108,7 @@ OCEntityHandlerResult PolicyResource::postHandler(const OC::OCRepresentation& re
         OC::QueryParamsMap proxy_params{{"did", did}, {"agent", agent}};
 
         proxy->addDefferedTask(&PolicyHandler::pass, policy_handler, representation, proxy_params);
-    } catch (std::out_of_range&){
+    } catch (std::out_of_range&) {
         result = OC_EH_BAD_REQ;
     }
 
@@ -152,7 +156,7 @@ OCEntityHandlerResult PolicyResource::observHandler(const OC::OCRepresentation&
         } else {
             result = OC_EH_BAD_OPT;
         }
-    } catch (std::out_of_range&){
+    } catch (std::out_of_range&) {
         result = OC_EH_BAD_REQ;
     }
 
index 16fc90a..10b5390 100644 (file)
@@ -68,7 +68,7 @@ public:
      * @return error code
      */
     OCEntityHandlerResult getHandler(const OC::OCRepresentation& representation, const OC::QueryParamsMap& params,
-            OC::OCRepresentation& response_body) override;
+                                     OC::OCRepresentation& response_body) override;
 
     /**
     * @brief OCResource POST method handler
@@ -78,7 +78,7 @@ public:
     * @return error code
     */
     OCEntityHandlerResult postHandler(const OC::OCRepresentation& representation, const OC::QueryParamsMap& params,
-            OC::OCRepresentation& response_body) override;
+                                      OC::OCRepresentation& response_body) override;
 
     /**
     * @brief OCResource OBSERV method handler
@@ -88,7 +88,7 @@ public:
     * @return error code
     */
     OCEntityHandlerResult observHandler(const OC::OCRepresentation& representation,
-            const OC::QueryParamsMap& params, const OC::ObservationInfo& obsInfo) override;
+                                        const OC::QueryParamsMap& params, const OC::ObservationInfo& obsInfo) override;
 
     /**
      * @brief Used to proxy policy updates from server to primitive devices
index 291071f..f4b0a5b 100644 (file)
@@ -19,7 +19,9 @@ namespace PH = std::placeholders;
 
 #define TAG "nmdaemon"
 
-const std::string ReportResource::HUB_REPORT_RESOURCE_URI{"/a/report"};
+const std::string ReportResource::HUB_REPORT_RESOURCE_URI {
+    "/a/report"
+};
 const std::string ReportResource::HUB_REPORT_RESORCE_TYPE{"core.security"};
 
 ReportResource::ReportResource(ReportHandler& handler, ProxyThread* proxy)
index 144c709..7be7133 100644 (file)
@@ -1,14 +1,14 @@
-/**
- * Samsung Ukraine R&D Center (SRK under a contract between)
- * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
- * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved.
- */
-/**
- * @file   main_thread.h
- * @brief  Main thread
- * @date   Created Apr 18, 2017
- * @author Mail to: <A HREF="mailto:i.metelytsia@samsung.com">Iurii Metelytsia, i.metelytsia@samsung.com</A>
- */
+/**\r
+ * Samsung Ukraine R&D Center (SRK under a contract between)\r
+ * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)\r
+ * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved.\r
+ */\r
+/**\r
+ * @file   main_thread.h\r
+ * @brief  Main thread\r
+ * @date   Created Apr 18, 2017\r
+ * @author Mail to: <A HREF="mailto:i.metelytsia@samsung.com">Iurii Metelytsia, i.metelytsia@samsung.com</A>\r
+ */\r
 \r
 #ifndef __MAIN_THREAD_H__\r
 #define __MAIN_THREAD_H__\r
@@ -30,23 +30,48 @@ namespace NMD
 class MainThread : public ThreadBase\r
 {\r
 public:\r
-    MainThread(const std::string& device_name = "", const std::string& device_model = "",\r
+    /**\r
+     * @brief Constructor\r
+     * @param device_name  [in] the name of the device\r
+     * @param device_model [in] the model of the device\r
+     * @param device_type  [in] the type of the device\r
+     */\r
+    MainThread(const std::string& device_name = "",\r
+               const std::string& device_model = "",\r
                const std::string& device_type = "");\r
 \r
+    /**\r
+     * @brief Sets the device name\r
+     * @param device_name  [in] the name of the device\r
+     */\r
     void set_device_name(const std::string& device_name) {\r
         m_device_name = device_name;\r
     }\r
 \r
+    /**\r
+     * @brief Sets the device model\r
+     * @param device_model [in] the model of the device\r
+     */\r
     void set_device_model(const std::string& device_model) {\r
         m_device_model = device_model;\r
     }\r
 \r
+    /**\r
+     * @brief Sets the device type\r
+     * @param device_type  [in] the type of the device\r
+     */\r
     void set_device_type(const std::string& device_type) {\r
         m_device_type = device_type;\r
     }\r
 \r
+    /**\r
+     * @brief Destructor\r
+     */\r
     virtual ~MainThread();\r
 \r
+    /**\r
+     * @brief Main routine\r
+     */\r
     virtual void routine();\r
 \r
 private:\r
index 592cabd..086f0c3 100644 (file)
@@ -48,7 +48,7 @@ bool PolicyHandlerRes::init()
     if (m_resource) {
         QueryParamsMap query{{"did", iotivity->getDeviceID()}};
         m_resource->observe(ObserveType::Observe, query, std::bind(&PolicyHandlerRes::observeCallback, this, PH::_1, PH::_2,
-                          PH::_3, PH::_4));
+                            PH::_3, PH::_4));
     } else {
         LOG_D(TAG, "[RMI_THREADS] Policy resource not found");
     }
index 8e410ac..67df10e 100644 (file)
 class ProxyThread : public NMD::ThreadBase
 {
 public:
+    /**
+     * @brief Constructor
+     */
     ProxyThread() {
     }
 
+    /**
+     * @brief Adds a deferred task
+     * @param func [in] the task's routine function
+     * @param args [in] an arguments for this function
+     */
     template<typename Func, typename... Args>
     void addDefferedTask(Func&& func, Args&& ... args) {
         addTask(std::async(std::launch::deferred, std::forward<Func>(func), std::forward<Args>(args)...));
     }
 
+    /**
+     * @brief Adds a deferred task
+     * @param task [in] the task to add
+     */
     void addTask(std::future<void>&& task)
     {
         std::unique_lock<std::mutex> lock{mtx};
@@ -41,14 +53,23 @@ public:
         notice.notify_one();
     }
 
+    /**
+     * @brief Destructor
+     */
     virtual ~ProxyThread() {
     }
 
+    /**
+     * @brief Stops the proxy thread
+     */
     void stop() override {
         m_running = false;
         notice.notify_all();
     }
 
+    /**
+     * @brief Main routine
+     */
     void routine() override {
         std::unique_lock<std::mutex> lock{mtx};
 
index 0c12431..b4a5d95 100644 (file)
@@ -37,8 +37,8 @@ public:
 
     /**
      * @brief pass sends report representation to server
-     * @param rep representation to send
-     * @param params post query parameters
+     * @param rep [in] representation to send
+     * @param params [in] post query parameters
      */
     virtual void pass(const OC::OCRepresentation& rep, const OC::QueryParamsMap& params) = 0;
 
index 6b76fd1..dd23a25 100644 (file)
@@ -26,14 +26,15 @@ class ReportHandlerRes: public ReportHandler, public NetworkManager::IotResource
 public:
     /**
      * @brief ReportHandlerRes constructor
-     * @param iotivity pointer to IoTivity instance
+     * @param iotivity [in] pointer to IoTivity instance
+     * @param server_id [in] server id
      */
     ReportHandlerRes(NetworkManager::IoTivity* iotivity, const std::string& server_id = "");
 
     /**
      * @brief pass sends report representation to server
-     * @param rep representation to send
-     * @param params post query parameters
+     * @param rep [in] representation to send
+     * @param params [in] post query parameters
      */
     void pass(const OC::OCRepresentation& rep, const OC::QueryParamsMap& params) override;
 
index 39994ac..5ccb774 100644 (file)
@@ -26,6 +26,7 @@ class ReportHandlerFactory
 public:
     /**
      * @brief createWithResource creates ReportHandler using resource layer for communication
+     * @param iotivity [in] pointer to the IoTivity instance
      * @param sid [in] optional server id (with id used for primitive devices)
      * @return handler shared pointer
      */
index 62c4c64..c0c57ee 100644 (file)
@@ -31,8 +31,8 @@ public:
 
     /**
      * @brief pass sends report representation to server
-     * @param rep representation to send
-     * @param params post query parameters
+     * @param rep [in] representation to send
+     * @param params [in] post query parameters
      */
     void pass(const OC::OCRepresentation& rep, const OC::QueryParamsMap& params) override;
 
index c0ef7e8..eb3f060 100644 (file)
@@ -1,14 +1,14 @@
-/**
- * Samsung Ukraine R&D Center (SRK under a contract between)
- * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
- * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved.
- */
-/**
- * @file   thread_base.cpp
- * @brief  Base thread class
- * @date   Created Jul 14, 2017
- * @author Mail to: <A HREF="mailto:d.lomtev@samsung.com">Dmytro Lomtev, d.lomtev@samsung.com</A>
- */
+/**\r
+ * Samsung Ukraine R&D Center (SRK under a contract between)\r
+ * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)\r
+ * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved.\r
+ */\r
+/**\r
+ * @file   thread_base.cpp\r
+ * @brief  Base thread class\r
+ * @date   Created Jul 14, 2017\r
+ * @author Mail to: <A HREF="mailto:d.lomtev@samsung.com">Dmytro Lomtev, d.lomtev@samsung.com</A>\r
+ */\r
 \r
 #include "thread_base.h"\r
 \r
index 44f607b..3302e00 100644 (file)
@@ -1,14 +1,14 @@
-/**
- * Samsung Ukraine R&D Center (SRK under a contract between)
- * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
- * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved.
- */
-/**
- * @file   thread_base.h
- * @brief  Base thread class
- * @date   Created Jul 14, 2017
- * @author Mail to: <A HREF="mailto:d.lomtev@samsung.com">Dmytro Lomtev, d.lomtev@samsung.com</A>
- */
+/**\r
+ * Samsung Ukraine R&D Center (SRK under a contract between)\r
+ * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)\r
+ * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved.\r
+ */\r
+/**\r
+ * @file   thread_base.h\r
+ * @brief  Base thread class\r
+ * @date   Created Jul 14, 2017\r
+ * @author Mail to: <A HREF="mailto:d.lomtev@samsung.com">Dmytro Lomtev, d.lomtev@samsung.com</A>\r
+ */\r
 #ifndef __THREAD_BASE_H__\r
 #define __THREAD_BASE_H__\r
 \r
index 2704226..a7e46bb 100644 (file)
@@ -158,7 +158,7 @@ static bool wl(const char* _msg, va_list _vl)
 
     FILE* file = fopen(log_file_path_name.c_str(), "a+");
     if (file) {
-        res = (bool)vfprintf(file, _msg, _vl);
+        res = (bool)(vfprintf(file, _msg, _vl) > 0);
         fclose(file);
     }
 
index 8dfa75d..c6e0dd8 100644 (file)
 namespace NMD
 {
 
-extern std::string dat_file_path_name;
-extern std::string cfg_file_path_name;
-extern std::string log_file_path_name;
-extern std::string hub_file_path_name;
+extern std::string dat_file_path_name; /**< name of IoTivity's persistent storage file  */
+extern std::string cfg_file_path_name; /**< name of config file  */
+extern std::string log_file_path_name; /**< name of log file  */
+extern std::string hub_file_path_name; /**< name of hub cache file  */
 
 /**
  * @brief Returns current path
@@ -41,14 +41,14 @@ extern WorkingMode g_working_mode;
  * @brief The structure contains configuration info for Network Manager daemon
  */
 typedef struct {
-    std::string host;
-    std::string auth_provider;
-    std::string auth_code;
-    std::string uid;
-    std::string access_token;
-
-    std::string ssid;
-    std::string pwd;
+    std::string host;           /**< address of server. ex: "coap+tcp://106.125.46.44:5683" */
+    std::string auth_provider;  /**< name of OAuth2 service provider */
+    std::string auth_code;      /**< OAuth2 access token */
+    std::string uid;            /**< ID used for iot cloud signIn method */
+    std::string access_token;   /**< access token used for iot cloud signIn method */
+
+    std::string ssid;           /**< server id */
+    std::string pwd;            /**< password */
 } nmdaemon_config;
 
 /**
@@ -86,9 +86,17 @@ const char* wmodeAsString(WorkingMode wmode);
  */
 const char* wmodeAsString();
 
+/**
+ * @brief Writes message to the log file named "log_file_path_name"
+ * @return true on success
+ */
 bool write_log(const char* _msg, ...);
 
 #if defined(__TIZEN__)
+/**
+ * @brief Returns a device model name
+ * @return device model name
+ */
 std::string get_device_model_name();
 #endif
 }